示例#1
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);
        }
示例#2
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);
        }
示例#3
0
        public int Run(string tfsUrl, string tfsRepositoryPath)
        {
            _tfs.Url = tfsUrl;
            if (null != Username)
            {
                _tfs.Username = Username;
            }
            if (null != Password)
            {
                _tfs.Password = Password;
            }
            _tfs.EnsureAuthenticated();

            var commiters = _tfs.GetCommiters(tfsRepositoryPath);

            foreach (var item in commiters)
            {
                Console.WriteLine($"{item.Key} = {item.Value} <{item.Key}>");
            }
            return(0);
        }