コード例 #1
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            IWorkspaceObject ob  = (IWorkspaceObject)dataObject;
            GitRepository    rep = VersionControlService.GetRepository(ob) as GitRepository;

            if (rep != null)
            {
                IWorkspaceObject rob;
                if (repos.TryGetValue(rep.RootPath.CanonicalPath, out rob))
                {
                    if (ob == rob)
                    {
                        label += " (" + rep.GetCurrentBranch() + ")";
                    }
                }
            }
        }
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var ob  = (WorkspaceObject)dataObject;
            var rep = VersionControlService.GetRepository(ob) as GitRepository;

            if (rep != null)
            {
                WorkspaceObject rob;
                if (repos.TryGetValue(rep.RootPath, out rob))
                {
                    if (ob == rob)
                    {
                        nodeInfo.Label += " (" + rep.GetCurrentBranch() + ")";
                    }
                }
            }
        }
コード例 #3
0
        protected override void Run()
        {
            var             solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
            List <FilePath> paths    = new List <FilePath>();

            //Add Solution
            paths.Add(solution.BaseDirectory);
            //Add linked files.
            foreach (var path in solution.GetItemFiles(true))
            {
                if (!path.IsChildPathOf(solution.BaseDirectory))
                {
                    paths.Add(path);
                }
            }
            var repo = (TFSRepository)VersionControlService.GetRepository(solution);

            ResolveConflictsView.Open(repo, paths);
        }
コード例 #4
0
        void HandleDocumentOpened(object sender, Ide.Gui.DocumentEventArgs e)
        {
            if (e.Document.Project == null)
            {
                return;
            }
            var repo = VersionControlService.GetRepository(e.Document.Project);

            if (repo == null)
            {
                return;
            }
            if (!e.Document.IsFile || !repo.GetVersionInfo(e.Document.FileName).IsVersioned)
            {
                return;
            }
            var item = new VersionControlItem(repo, e.Document.Project, e.Document.FileName, false, null);

            DiffView.AttachViewContents(e.Document, item);
        }
コード例 #5
0
        void HandleDocumentOpened(object sender, Ide.Gui.DocumentEventArgs e)
        {
            if (!e.Document.IsFile || e.Document.Project == null)
            {
                return;
            }

            var repo = VersionControlService.GetRepository(e.Document.Project);

            if (repo == null || !repo.GetVersionInfo(e.Document.FileName).IsVersioned)
            {
                return;
            }

            var item = new VersionControlItem(repo, e.Document.Project, e.Document.FileName, false, null);

            TryAttachView <IDiffView> (e.Document, item, DiffCommand.DiffViewHandlers);
            TryAttachView <IBlameView> (e.Document, item, BlameCommand.BlameViewHandlers);
            TryAttachView <ILogView> (e.Document, item, LogCommand.LogViewHandlers);
            TryAttachView <IMergeView> (e.Document, item, MergeCommand.MergeViewHandlers);
        }
コード例 #6
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var ob  = (WorkspaceObject)dataObject;
            var rep = VersionControlService.GetRepository(ob) as GitRepository;

            if (rep != null)
            {
                WorkspaceObject rob;
                if (repos.TryGetValue(rep.RootPath, out rob))
                {
                    if (ob == rob)
                    {
                        string branch = rep.GetCurrentBranch();
                        if (branch == "(no branch)")
                        {
                            branch = rep.RootRepository.ObjectDatabase.ShortenObjectId(rep.RootRepository.Head.Tip);
                        }
                        nodeInfo.Label += " (" + branch + ")";
                    }
                }
            }
        }
コード例 #7
0
        void HandleDocumentChanged(object sender, EventArgs e)
        {
            var document = Ide.IdeApp.Workbench.ActiveDocument;

            try
            {
                if (document == null || !document.IsFile || document.Project == null || document.Window.FindView <IDiffView> () >= 0)
                {
                    return;
                }

                var repo = VersionControlService.GetRepository(document.Project);
                if (repo == null)
                {
                    return;
                }

                var versionInfo = repo.GetVersionInfo(document.FileName);
                if (!versionInfo.IsVersioned)
                {
                    return;
                }

                var item   = new VersionControlItem(repo, document.Project, document.FileName, false, null);
                var vcInfo = new VersionControlDocumentInfo(document.PrimaryView, item, item.Repository);
                TryAttachView <IDiffView> (document, vcInfo, DiffCommand.DiffViewHandlers);
                TryAttachView <IBlameView> (document, vcInfo, BlameCommand.BlameViewHandlers);
                TryAttachView <ILogView> (document, vcInfo, LogCommand.LogViewHandlers);
                TryAttachView <IMergeView> (document, vcInfo, MergeCommand.MergeViewHandlers);
            }
            catch (Exception ex)
            {
                // If a user is hitting this, it will show a dialog box every time they
                // switch to a document or open a document, so suppress the crash dialog
                // This bug *should* be fixed already, but it's hard to tell.
                LogReportingService.ReportUnhandledException(ex, false, true);
            }
        }
コード例 #8
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            var ob  = (WorkspaceObject)dataObject;
            var rep = VersionControlService.GetRepository(ob) as GitRepository;

            if (rep != null)
            {
                WorkspaceObject rob;
                if (repos.TryGetValue(rep.RootPath, out rob))
                {
                    if (ob == rob)
                    {
                        string branch = rep.CachedCurrentBranch;
                        //FIXME: we need to find a better way to get this sync
                        using (var cts = new CancellationTokenSource()) {
                            var getBranch = rep.GetCurrentBranchAsync(cts.Token);
                            if (!getBranch.Wait(250))
                            {
                                cts.Cancel();
                                LoggingService.LogError("Getting current Git branch timed out");
                            }
                            else if (!getBranch.IsFaulted)
                            {
                                branch = getBranch.Result;
                            }
                        }

                        if (branch == GitRepository.DefaultNoBranchName)
                        {
                            using (var RootRepository = new LibGit2Sharp.Repository(rep.RootPath))
                                branch = RootRepository.ObjectDatabase.ShortenObjectId(RootRepository.Head.Tip);
                        }
                        nodeInfo.Label += " (" + branch + ")";
                    }
                }
            }
        }
コード例 #9
0
        protected override void Update(CommandInfo info)
        {
            if (VersionControlService.IsGloballyDisabled)
            {
                info.Visible = false;
                return;
            }

            var solution = IdeApp.ProjectOperations.CurrentSelectedSolution;

            if (solution == null)
            {
                info.Visible = false;
                return;
            }

            var repo = VersionControlService.GetRepository(solution) as TFSRepository;

            if (repo == null)
            {
                info.Visible = false;
                return;
            }
        }