Browse files

beginning to add a "child subtrees" concept to TFS remotes

Signed-off-by: Gordon Burgett <gordon.burgett@gmail.com>
  • Loading branch information...
1 parent c8300df commit c2205b21fe165fb98e7ec428b8f7426e9313c89e @gburgett committed Apr 4, 2013
Showing with 22 additions and 16 deletions.
  1. +11 −16 GitTfs/Commands/Subtree.cs
  2. +11 −0 GitTfs/Core/RemoteInfo.cs
View
27 GitTfs/Commands/Subtree.cs
@@ -90,25 +90,20 @@ public int DoAdd(string tfsUrl, string tfsRepositoryPath)
var fetch = Squash ? this._quickFetch : this._fetch;
+
+ //create a remote for the new subtree
string remoteId = "subtree/" + Prefix;
- IGitTfsRemote remote;
- if (_globals.Repository.HasRemote(remoteId))
- {
- remote = _globals.Repository.ReadTfsRemote(remoteId);
- }
- else
+ IGitTfsRemote remote = _globals.Repository.CreateTfsRemote(new RemoteInfo
{
- //create a remote for the new subtree
- remote = _globals.Repository.CreateTfsRemote(new RemoteInfo
- {
- Id = remoteId,
- Url = tfsUrl,
- Repository = tfsRepositoryPath,
- RemoteOptions = _remoteOptions,
- });
- _stdout.WriteLine("-> new remote " + remote.Id);
- }
+ Id = remoteId,
+ Url = tfsUrl,
+ Repository = tfsRepositoryPath,
+ RemoteOptions = _remoteOptions,
+ });
+ _stdout.WriteLine("-> new remote " + remote.Id);
+
+ var parentRemote = _globals.Repository.
int result = fetch.Run(remote.Id);
View
11 GitTfs/Core/RemoteInfo.cs
@@ -17,6 +17,17 @@ public class RemoteInfo
public IEnumerable<string> Aliases { get; set; }
public bool Autotag { get; set; }
+ /// <summary>
+ /// Gets or sets the list of other remotes which have been added as subtrees under this remote.
+ /// All subtrees will have the same <see cref="Url"/> as this remote.
+ /// </summary>
+ /// <remarks>
+ /// We track subtree remotes in this way so that a "git tfs pull" or a "git tfs checkin" will pull
+ /// all known subtrees as well. This facilitates a git repo which contains multiple TFS projects on the
+ /// same server.
+ /// </remarks>
+ public List<string> Subtrees { get; set; }
+
public RemoteOptions RemoteOptions
{
get { return new RemoteOptions { IgnoreRegex = IgnoreRegex, Username = Username, Password = Password }; }

0 comments on commit c2205b2

Please sign in to comment.