making changes proposed in pull request

Signed-off-by: Gordon Burgett <gordon.burgett@gmail.com>
This commit is contained in:
Gordon Burgett
2013-04-15 17:43:26 -05:00
parent 1c54f69b24
commit 74fe7dde8a
2 changed files with 11 additions and 22 deletions
+6 -17
View File
@@ -155,12 +155,11 @@ namespace Sep.Git.Tfs.Commands
{2}", Prefix, remote.MaxCommitHash, msg);
List<string> args = new List<string>(){"subtree", "add",
_globals.Repository.CommandNoisy(
"subtree", "add",
"--prefix=" + p,
string.Format("-m {0}", msg),
remote.RemoteRef
};
command(args);
remote.RemoteRef);
//update the owner remote to point at the commit where the newly created subtree was merged.
var commit = _globals.Repository.GetCurrentCommit();
@@ -184,8 +183,7 @@ namespace Sep.Git.Tfs.Commands
if (result == GitTfsExitCodes.OK)
{
var p = Prefix.Replace(" ", "\\ ");
List<string> args = new List<string>(){ "subtree", "merge", "--prefix=" + p, remote.RemoteRef };
command(args);
_globals.Repository.CommandNoisy("subtree", "merge", "--prefix=" + p, remote.RemoteRef);
result = GitTfsExitCodes.OK;
}
@@ -197,10 +195,8 @@ namespace Sep.Git.Tfs.Commands
ValidatePrefix();
var p = Prefix.Replace(" ", "\\ ");
List<string> args = new List<string>() { "subtree", "split", "--prefix=" + p, "-b", p };
command(args);
args = new List<string>() { "checkout", p };
command(args);
_globals.Repository.CommandNoisy("subtree", "split", "--prefix=" + p, "-b", p);
_globals.Repository.CommandNoisy("checkout", p);
//update subtree refs if needed
var owners = _globals.Repository.GetLastParentTfsCommits("HEAD").Where(x => !x.Remote.IsSubtree && x.Remote.TfsRepositoryPath == null).ToList();
@@ -224,12 +220,5 @@ namespace Sep.Git.Tfs.Commands
.WithRecommendation("Add the subtree using 'git tfs subtree add -p=<prefix> [tfs-server] [tfs-repository]'");
}
}
private void command(List<string> args)
{
_stdout.WriteLine("git " + string.Join(" ", args));
_globals.Repository.CommandNoisy(args.ToArray());
}
}
}
+5 -5
View File
@@ -23,15 +23,15 @@ namespace Sep.Git.Tfs.Core
if (_globals.UserSpecifiedRemoteId != null)
tfsParents = tfsParents.Where(changeset => changeset.Remote.Id == _globals.UserSpecifiedRemoteId);
return WriteWith(tfsParents.ToList(), write);
return WriteWith(tfsParents, write);
}
private int WriteWith(List<TfsChangesetInfo> tfsParents, Func<TfsChangesetInfo, int> write)
private int WriteWith(IEnumerable<TfsChangesetInfo> tfsParents, Func<TfsChangesetInfo, int> write)
{
switch (tfsParents.Count)
switch (tfsParents.Count())
{
case 1:
var changeset = tfsParents[0];
var changeset = tfsParents.First();
return write(changeset);
case 0:
_stdout.WriteLine("No TFS parents found!");
@@ -40,7 +40,7 @@ namespace Sep.Git.Tfs.Core
//try looking for the non-subtree changesets
if (tfsParents.Any(x => x.Remote.IsSubtree))
{
return WriteWith(tfsParents.Where(x => !x.Remote.IsSubtree).ToList(), write);
return WriteWith(tfsParents.Where(x => !x.Remote.IsSubtree), write);
}
_stdout.WriteLine("More than one parent found! Use -i to choose the correct parent from: ");