Sep.Git.Tfs.Commands.Branch.DisplayBranchData C# (CSharp) Method

DisplayBranchData() public method

public DisplayBranchData ( ) : int
return int
        public int DisplayBranchData()
        {
            // should probably pull this from options so that it is settable from the command-line
            const string remoteId = GitTfsConstants.DefaultRepositoryId;

            var tfsRemotes = _globals.Repository.ReadAllTfsRemotes();
            if (DisplayRemotes)
            {
                if (!ManageAll)
                {
                    var remote = _globals.Repository.ReadTfsRemote(remoteId);

                    Trace.TraceInformation("\nTFS branch structure:");
                    WriteRemoteTfsBranchStructure(remote.Tfs, remote.TfsRepositoryPath, tfsRemotes);
                    return GitTfsExitCodes.OK;
                }
                else
                {
                    var remote = tfsRemotes.First(r => r.Id == remoteId);
                    if (!remote.Tfs.CanGetBranchInformation)
                    {
                        throw new GitTfsException("error: this version of TFS doesn't support this functionality");
                    }
                    foreach (var branch in remote.Tfs.GetBranches().Where(b => b.IsRoot))
                    {
                        var root = remote.Tfs.GetRootTfsBranchForRemotePath(branch.Path);
                        var visitor = new WriteBranchStructureTreeVisitor(remote.TfsRepositoryPath, tfsRemotes);
                        root.AcceptVisitor(visitor);
                    }
                    return GitTfsExitCodes.OK;
                }
            }

            WriteTfsRemoteDetails(tfsRemotes);
            return GitTfsExitCodes.OK;
        }