WriteRemoteTfsBranchStructure() public static method

public static WriteRemoteTfsBranchStructure ( ITfsHelper tfsHelper, string tfsRepositoryPath, IEnumerable tfsRemotes = null ) : void
tfsHelper ITfsHelper
tfsRepositoryPath string
tfsRemotes IEnumerable
return void
Beispiel #1
0
        public int Run(string tfsUrl)
        {
            tfsHelper.Url      = tfsUrl;
            tfsHelper.Username = remoteOptions.Username;
            tfsHelper.Password = remoteOptions.Password;
            tfsHelper.EnsureAuthenticated();

            if (!tfsHelper.CanGetBranchInformation)
            {
                throw new GitTfsException("error: this version of TFS doesn't support this functionality");
            }

            string convertBranchMessage = "  -> Open 'Source Control Explorer' and for each folder corresponding to a branch, right click on the folder and select 'Branching and Merging' > 'Convert to branch'.";
            var    branches             = tfsHelper.GetBranches().Where(b => b.IsRoot).ToList();

            if (branches.IsEmpty())
            {
                Trace.TraceWarning("No TFS branches were found!");
                Trace.TraceWarning("\n\nPerhaps you should convert your branch folders into a branch in TFS:");
                Trace.TraceWarning(convertBranchMessage);
            }
            else
            {
                Trace.TraceInformation("TFS branches that could be cloned:");
                foreach (var branchObject in branches.Where(b => b.IsRoot))
                {
                    Branch.WriteRemoteTfsBranchStructure(tfsHelper, branchObject.Path);
                }
                Trace.TraceInformation("\nCloning root branches (marked by [*]) is recommended!");
                Trace.TraceInformation("\n\nPS:if your branch is not listed here, perhaps you should convert its containing folder into a branch in TFS:");
                Trace.TraceInformation(convertBranchMessage);
            }
            return(GitTfsExitCodes.OK);
        }
Beispiel #2
0
        public int Run(string tfsUrl)
        {
            if (!tfsHelper.CanGetBranchInformation)
            {
                throw new GitTfsException("error: this version of TFS doesn't support this functionnality");
            }

            tfsHelper.Url      = tfsUrl;
            tfsHelper.Username = remoteOptions.Username;
            tfsHelper.Password = remoteOptions.Password;
            tfsHelper.EnsureAuthenticated();
            var branches = tfsHelper.GetBranches().Where(b => b.IsRoot).ToList();

            if (branches.IsEmpty())
            {
                stdout.WriteLine("No TFS branches were found!");
            }
            else
            {
                stdout.WriteLine("TFS branches that could be cloned:");
                foreach (var branchObject in branches.Where(b => b.IsRoot))
                {
                    Branch.WriteRemoteTfsBranchStructure(tfsHelper, stdout, branchObject.Path);
                }
                stdout.WriteLine("\nCloning root branches (marked by [*]) is recommended!");
                stdout.WriteLine("\n\nPS:if your branch is not listed here, perhaps you should convert the containing folder to a branch in TFS.");
            }
            return(GitTfsExitCodes.OK);
        }