Ejemplo n.º 1
0
			protected override void Run ()
			{
				foreach (VersionControlItemList list in items.SplitByRepository ())
					list[0].Repository.Revert (list.Paths, true, Monitor);
				
				Monitor.ReportSuccess (GettextCatalog.GetString ("Revert operation completed."));
				Gtk.Application.Invoke (delegate {
					foreach (VersionControlItem item in items) {
						if (!item.IsDirectory) {
							// Reload reverted files
							Document doc = IdeApp.Workbench.GetDocument (item.Path);
							if (doc != null)
								doc.Reload ();
							FileService.NotifyFileChanged (item.Path);
						}
						VersionControlService.NotifyFileStatusChanged (item.Repository, item.Path, item.IsDirectory);
					}
				});
			}
Ejemplo n.º 2
0
 protected override Task RunAsync()
 {
     try {
         foreach (VersionControlItemList list in items.SplitByRepository())
         {
             list [0].Repository.Unlock(Monitor, list.Paths);
         }
         Gtk.Application.Invoke((o, args) => {
             VersionControlService.NotifyFileStatusChanged(items);
         });
         Monitor.ReportSuccess(GettextCatalog.GetString("Unlock operation completed."));
     } catch (OperationCanceledException) {
         return(Task.CompletedTask);
     } catch (Exception ex) {
         LoggingService.LogError("Unlock operation failed", ex);
         MessageService.ShowError(GettextCatalog.GetString("Version control command failed."), ex);
     }
     return(Task.CompletedTask);
 }
Ejemplo n.º 3
0
 protected override async Task RunAsync()
 {
     foreach (VersionControlItemList list in items.SplitByRepository())
     {
         try {
             await list[0].Repository.UpdateAsync(list.Paths, true, Monitor);
         } catch (OperationCanceledException) {
             return;
         } catch (Exception ex) {
             LoggingService.LogError("Update operation failed", ex);
             Monitor.ReportError(ex.Message, null);
             return;
         }
     }
     Gtk.Application.Invoke((o, args) => {
         VersionControlService.NotifyFileStatusChanged(items);
     });
     Monitor.ReportSuccess(GettextCatalog.GetString("Update operation completed."));
 }
            protected override void Run()
            {
                // A revert operation can create or remove a directory, so the directory
                // check must be done before and after the revert.

                bool isDir = Directory.Exists(path);

                if (toRevision)
                {
                    //we discard working changes (we are warning the user), it's the more intuitive action
                    vc.Revert(path, true, Monitor);

                    vc.RevertToRevision(path, revision, Monitor);
                }
                else
                {
                    vc.RevertRevision(path, revision, Monitor);
                }

                if (!(isDir || Directory.Exists(path)))
                {
                    isDir = false;
                }

                Monitor.ReportSuccess(GettextCatalog.GetString("Revert operation completed."));
                Gtk.Application.Invoke(delegate {
                    if (!isDir)
                    {
                        // Reload reverted files
                        Document doc = IdeApp.Workbench.GetDocument(path);
                        if (doc != null)
                        {
                            doc.Reload();
                        }
                        VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, false));
                        FileService.NotifyFileChanged(path);
                    }
                    else
                    {
                        VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, true));
                    }
                });
            }
Ejemplo n.º 5
0
            protected override void Run()
            {
                success = true;
                try {
                    // store global comment before commit.
                    VersionControlService.SetCommitComment(changeSet.BaseLocalPath, changeSet.GlobalComment, true);

                    vc.Commit(changeSet, Monitor);
                    Monitor.ReportSuccess(GettextCatalog.GetString("Commit operation completed."));

                    // Reset the global comment on successful commit.
                    VersionControlService.SetCommitComment(changeSet.BaseLocalPath, "", true);
                } catch (Exception ex) {
                    LoggingService.LogError("Commit operation failed", ex);
                    Monitor.ReportError(ex.Message, null);
                    success = false;
                    throw;
                }
            }
Ejemplo n.º 6
0
        protected override void Run()
        {
            if (!VersionControlService.CheckVersionControlInstalled())
            {
                return;
            }

            SelectRepositoryDialog del = new SelectRepositoryDialog(SelectRepositoryMode.Checkout);

            try {
                if (MessageService.RunCustomDialog(del) == (int)Gtk.ResponseType.Ok && del.Repository != null)
                {
                    CheckoutWorker w = new CheckoutWorker(del.Repository, del.TargetPath);
                    w.Start();
                }
            } finally {
                del.Destroy();
            }
        }
            protected override void Run()
            {
                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    VersionControlItemList files = list.GetFiles();
                    if (files.Count > 0)
                    {
                        files[0].Repository.DeleteFiles(files.Paths, true, Monitor, true);
                    }
                    VersionControlItemList dirs = list.GetDirectories();
                    if (dirs.Count > 0)
                    {
                        dirs[0].Repository.DeleteDirectories(dirs.Paths, true, Monitor, true);
                    }
                }

                Gtk.Application.Invoke(delegate {
                    VersionControlService.NotifyFileStatusChanged(items);
                });
            }
Ejemplo n.º 8
0
        public void SetStatus(VersionInfo versionInfo, bool notify = true)
        {
            if (!versionInfo.IsInitialized)
            {
                versionInfo.Init(repo);
            }

            if (fileStatus.TryGetValue(versionInfo.LocalPath, out var vi) && vi.Equals(versionInfo))
            {
                vi.RequiresRefresh = false;
                return;
            }

            fileStatus [versionInfo.LocalPath] = versionInfo;

            if (notify)
            {
                VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory));
            }
        }
Ejemplo n.º 9
0
        Repository GetRepository(FilePath path)
        {
            path = path.FullPath;

            Project p = IdeApp.Workspace.GetProjectContainingFile(path);

            if (p != null)
            {
                return(VersionControlService.GetRepository(p));
            }

            foreach (Project prj in IdeApp.Workspace.GetAllProjects())
            {
                if (path == prj.BaseDirectory || path.IsChildPathOf(prj.BaseDirectory))
                {
                    return(VersionControlService.GetRepository(prj));
                }
            }
            return(null);
        }
Ejemplo n.º 10
0
        public async Task SetStatusAsync(VersionInfo versionInfo, bool notify = true, CancellationToken cancellationToken = default)
        {
            if (!versionInfo.IsInitialized)
            {
                await versionInfo.InitAsync(repo, cancellationToken).ConfigureAwait(false);
            }

            if (fileStatus.TryGetValue(versionInfo.LocalPath, out var vi) && vi.Equals(versionInfo))
            {
                vi.RequiresRefresh = false;
                return;
            }

            fileStatus [versionInfo.LocalPath] = versionInfo;

            if (notify)
            {
                VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory));
            }
        }
Ejemplo n.º 11
0
            protected override void Run()
            {
                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    list[0].Repository.Ignore(list.Paths);
                }

                Gtk.Application.Invoke(delegate {
                    foreach (VersionControlItem item in items)
                    {
                        if (!item.IsDirectory)
                        {
                            FileService.NotifyFileChanged(item.Path);
                        }
                    }

                    VersionControlService.NotifyFileStatusChanged(items);
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Ignore operation completed."));
            }
Ejemplo n.º 12
0
            protected override void Run()
            {
                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    VersionControlItemList files = list.GetFiles();
                    if (files.Count > 0)
                    {
                        files[0].Repository.DeleteFiles(files.Paths, true, Monitor, true);
                    }
                    VersionControlItemList dirs = list.GetDirectories();
                    if (dirs.Count > 0)
                    {
                        dirs[0].Repository.DeleteDirectories(dirs.Paths, true, Monitor, true);
                    }
                }

                Gtk.Application.Invoke((o, args) => {
                    VersionControlService.NotifyFileStatusChanged(items);
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Remove operation completed."));
            }
Ejemplo n.º 13
0
 public static async Task CommitAsync(Repository vc, ChangeSet changeSet)
 {
     try {
         VersionControlService.NotifyPrepareCommit(vc, changeSet);
         if (!await VerifyUnsavedChangesAsync(changeSet))
         {
             return;
         }
         CommitDialog dlg = new CommitDialog(vc, changeSet);
         try {
             MessageService.RunCustomDialog(dlg);
         } finally {
             dlg.Destroy();
             dlg.Dispose();
         }
         VersionControlService.NotifyAfterCommit(vc, changeSet, false);
     }
     catch (Exception ex) {
         MessageService.ShowError(GettextCatalog.GetString("Version control command failed."), ex);
     }
 }
Ejemplo n.º 14
0
        public static Repository GetRepository(IWorkspaceObject entry)
        {
            InternalRepositoryReference repoRef = (InternalRepositoryReference)entry.ExtendedProperties [typeof(InternalRepositoryReference)];

            if (repoRef != null)
            {
                return(repoRef.Repo);
            }

            Repository repo = VersionControlService.GetRepositoryReference(entry.BaseDirectory, entry.Name);
            InternalRepositoryReference rref = null;

            if (repo != null)
            {
                repo.AddRef();
                rref = new InternalRepositoryReference(repo);
            }
            entry.ExtendedProperties [typeof(InternalRepositoryReference)] = rref;

            return(repo);
        }
Ejemplo n.º 15
0
        public async Task DeleteDirectoriesAsync(FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal = true)
        {
            FileUpdateEventArgs args = new FileUpdateEventArgs();
            var metadata             = new DeleteMetadata(VersionControlSystem)
            {
                PathsCount = localPaths.Length, Force = force, KeepLocal = keepLocal
            };

            using (var tracker = Instrumentation.DeleteCounter.BeginTiming(metadata, monitor.CancellationToken)) {
                try {
                    await OnDeleteDirectoriesAsync(localPaths, force, monitor, keepLocal);

                    foreach (var path in localPaths)
                    {
                        args.Add(new FileUpdateEventInfo(this, path, true));
                    }
                } catch (Exception e) {
                    LoggingService.LogError("Failed to delete directory", e);
                    metadata.SetFailure();
                    if (!keepLocal)
                    {
                        try {
                            foreach (var path in localPaths)
                            {
                                FileService.AssertCanDeleteDirectory(path, RootPath);
                                Directory.Delete(path, true);
                            }
                        } catch (Exception e2) {
                            LoggingService.LogInternalError(e2);
                        }
                    }
                }
            }
            ClearCachedVersionInfo(localPaths);
            if (args.Any())
            {
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
/*		public override void PrepareChildNodes (object dataObject)
 *              {
 *                      if (dataObject is IWorkspaceObject) {
 *                              IWorkspaceObject ce = (IWorkspaceObject) dataObject;
 *                              Repository rep = VersionControlService.GetRepository (ce);
 *                              if (rep != null)
 *                                      rep.GetDirectoryVersionInfo (ce.BaseDirectory, false, false);
 *                      } else if (dataObject is ProjectFolder) {
 *                              ProjectFolder ce = (ProjectFolder) dataObject;
 *                              if (ce.ParentWorkspaceObject != null) {
 *                                      Repository rep = VersionControlService.GetRepository (ce.ParentWorkspaceObject);
 *                                      if (rep != null)
 *                                              rep.GetDirectoryVersionInfo (ce.Path, false, false);
 *                              }
 *                      }
 *                      base.PrepareChildNodes (dataObject);
 *              }
 */
        static void AddFolderOverlay(Repository rep, string folder, NodeInfo nodeInfo, bool skipVersionedOverlay)
        {
            Xwt.Drawing.Image overlay = null;
            VersionInfo       vinfo   = rep.GetVersionInfo(folder);

            if (vinfo == null || !vinfo.IsVersioned)
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(VersionStatus.Unversioned);
            }
            else if (vinfo.IsVersioned && !vinfo.HasLocalChanges)
            {
                if (!skipVersionedOverlay)
                {
                    overlay = VersionControlService.overlay_controled;
                }
            }
            else
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(vinfo.Status);
            }
            nodeInfo.OverlayBottomRight = overlay;
        }
Ejemplo n.º 17
0
        public void SetStatus(VersionInfo versionInfo, bool notify = true)
        {
            try {
                fileLock.EnterWriteLock();

                VersionInfo vi;
                if (fileStatus.TryGetValue(versionInfo.LocalPath, out vi) && vi.Equals(versionInfo))
                {
                    vi.RequiresRefresh = false;
                    return;
                }
                versionInfo.Init(repo);
                fileStatus [versionInfo.LocalPath] = versionInfo;
            } finally {
                fileLock.ExitWriteLock();
            }

            if (notify)
            {
                VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory));
            }
        }
        public override void NotifyFilesChanged(IEnumerable <FilePath> files)
        {
            FileUpdateEventArgs args = new FileUpdateEventArgs();

            foreach (var file in files)
            {
                var rep = GetRepository(file);
                // FIXME: Remove workaround https://devdiv.visualstudio.com/DevDiv/_workitems/edit/982818
                if (rep != null && !rep.IsDisposed && File.Exists(file))
                {
                    rep.ClearCachedVersionInfo(file);
                    if (rep.TryGetFileUpdateEventInfo(rep, file, out var eventInfo))
                    {
                        args.Add(eventInfo);
                    }
                }
            }
            if (args.Count > 0)
            {
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Ejemplo n.º 19
0
        public void SetStatus(IEnumerable <VersionInfo> versionInfos)
        {
            FileUpdateEventArgs args = null;

            try {
                fileLock.EnterWriteLock();
                foreach (var versionInfo in versionInfos)
                {
                    if (!versionInfo.IsInitialized)
                    {
                        versionInfo.Init(repo);
                    }
                    VersionInfo vi;
                    if (fileStatus.TryGetValue(versionInfo.LocalPath, out vi) && vi.Equals(versionInfo))
                    {
                        vi.RequiresRefresh = false;
                        continue;
                    }
                    fileStatus [versionInfo.LocalPath] = versionInfo;
                    var a = new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory);
                    if (args == null)
                    {
                        args = a;
                    }
                    else
                    {
                        args.MergeWith(a);
                    }
                }
            } finally {
                fileLock.ExitWriteLock();
            }
            if (args != null)
            {
                //	Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Ejemplo n.º 20
0
        public static void Commit(Repository vc, ChangeSet changeSet)
        {
            try {
                VersionControlService.NotifyPrepareCommit(vc, changeSet);

                CommitDialog dlg = new CommitDialog(changeSet);
                try {
                    if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok)
                    {
                        VersionControlService.NotifyBeforeCommit(vc, changeSet);
                        new CommitWorker(vc, changeSet, dlg).Start();
                        return;
                    }
                    dlg.EndCommit(false);
                } finally {
                    dlg.Destroy();
                }
                VersionControlService.NotifyAfterCommit(vc, changeSet, false);
            }
            catch (Exception ex) {
                MessageService.ShowException(ex, GettextCatalog.GetString("Version control command failed."));
            }
        }
Ejemplo n.º 21
0
        void AddFolderOverlay(Repository rep, string folder, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon, object dataObject)
        {
            Gdk.Pixbuf  overlay = null;
            VersionInfo vinfo   = GetVersionInfo(rep, folder, dataObject, false);

            if (vinfo == null)
            {
                ThreadPool.QueueUserWorkItem(x => {
                    VersionInfo info = GetVersionInfo(rep, folder, dataObject, true);
                    if (info != null)
                    {
                        DispatchService.GuiDispatch(() => UpdatePath(folder));
                    }
                });
                vinfo = VersionInfo.CreateUnversioned(folder, true);
            }
            else if (!vinfo.IsVersioned)
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(VersionStatus.Unversioned);
            }
            else if (vinfo.IsVersioned && !vinfo.HasLocalChanges)
            {
                overlay = VersionControlService.overlay_controled;
            }
            else
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(vinfo.Status);
            }
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
                if (closedIcon != null)
                {
                    AddOverlay(ref closedIcon, overlay);
                }
            }
        }
Ejemplo n.º 22
0
        public static bool Commit(VersionControlItemList items, bool test)
        {
            if (items.Count != 1)
            {
                return(false);
            }

            VersionControlItem item = items [0];

            if (item.VersionInfo.CanCommit)
            {
                if (test)
                {
                    return(true);
                }
                ChangeSet cset = item.Repository.CreateChangeSet(item.Path);
                cset.GlobalComment = VersionControlService.GetCommitComment(cset.BaseLocalPath);

                foreach (VersionInfo vi in item.Repository.GetDirectoryVersionInfo(item.Path, false, true))
                {
                    if (vi.HasLocalChanges)
                    {
                        cset.AddFile(vi);
                    }
                }
                if (!cset.IsEmpty)
                {
                    Commit(item.Repository, cset, false);
                }
                else
                {
                    MessageService.ShowMessage(GettextCatalog.GetString("There are no changes to be committed."));
                    return(false);
                }
            }
            return(false);
        }
Ejemplo n.º 23
0
            protected override void Finished()
            {
                dlg.EndCommit(success);
                dlg.Dispose();
                VersionControlService.NotifyAfterCommit(vc, changeSet, success);
                ArrayList dirs  = new ArrayList();
                ArrayList files = new ArrayList();

                foreach (ChangeSetItem it in changeSet.Items)
                {
                    if (it.IsDirectory)
                    {
                        dirs.Add(it.LocalPath);
                    }
                    else
                    {
                        files.Add(it.LocalPath);
                    }
                }

                FileUpdateEventArgs args = new FileUpdateEventArgs();

                foreach (FilePath path in dirs)
                {
                    args.Add(new FileUpdateEventInfo(vc, path, true));
                }
                foreach (FilePath path in files)
                {
                    args.Add(new FileUpdateEventInfo(vc, path, false));
                }

                if (args.Count > 0)
                {
                    VersionControlService.NotifyFileStatusChanged(args);
                }
            }
Ejemplo n.º 24
0
        public async Task SetStatusAsync(IEnumerable <VersionInfo> versionInfos, CancellationToken cancellationToken = default)
        {
            FileUpdateEventArgs args = null;

            foreach (var versionInfo in versionInfos)
            {
                if (!versionInfo.IsInitialized)
                {
                    await versionInfo.InitAsync(repo, cancellationToken);
                }

                if (fileStatus.TryGetValue(versionInfo.LocalPath, out var vi) && vi.Equals(versionInfo))
                {
                    vi.RequiresRefresh = false;
                    continue;
                }

                fileStatus [versionInfo.LocalPath] = versionInfo;

                var a = new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory);
                if (args == null)
                {
                    args = a;
                }
                else
                {
                    args.MergeWith(a);
                }
            }

            if (args != null)
            {
                //	Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Ejemplo n.º 25
0
 protected virtual IProgressMonitor CreateProgressMonitor()
 {
     return(VersionControlService.GetProgressMonitor(GetDescription(), OperationType));
 }
        public static VersionControlItem CreateItem(object obj, bool projRecurse = true)
        {
            string           path;
            bool             isDir;
            IWorkspaceObject pentry;
            Repository       repo;
            VersionInfo      versionInfo = null;

            if (obj is ProjectFile)
            {
                ProjectFile file = (ProjectFile)obj;
                path        = file.FilePath;
                isDir       = false;
                pentry      = file.Project;
                versionInfo = file.ExtendedProperties [typeof(VersionInfo)] as VersionInfo;
            }
            else if (obj is SystemFile)
            {
                SystemFile file = (SystemFile)obj;
                path   = file.Path;
                isDir  = false;
                pentry = file.ParentWorkspaceObject;
            }
            else if (obj is ProjectFolder)
            {
                ProjectFolder f = (ProjectFolder)obj;
                path   = f.Path;
                isDir  = true;
                pentry = f.ParentWorkspaceObject;
            }
            else if (!projRecurse && obj is Solution)
            {
                Solution sol = (Solution)obj;
                path   = sol.FileName;
                isDir  = false;
                pentry = sol;
            }
            else if (!projRecurse && obj is Project)
            {
                Project proj = (Project)obj;
                path   = proj.FileName;
                isDir  = false;
                pentry = proj;
            }
            else if (!projRecurse && obj is UnknownSolutionItem)
            {
                UnknownSolutionItem item = (UnknownSolutionItem)obj;
                path   = item.FileName;
                isDir  = false;
                pentry = item;
            }
            else if (obj is IWorkspaceObject)
            {
                pentry = ((IWorkspaceObject)obj);
                path   = pentry.BaseDirectory;
                isDir  = true;
            }
            else
            {
                return(null);
            }

            if (pentry == null)
            {
                return(null);
            }

            repo = VersionControlService.GetRepository(pentry);
            return(new VersionControlItem(repo, pentry, path, isDir, versionInfo));
        }
Ejemplo n.º 27
0
        public static bool Publish(IWorkspaceObject entry, FilePath localPath, bool test)
        {
            if (test)
            {
                return(VersionControlService.CheckVersionControlInstalled() && VersionControlService.GetRepository(entry) == null);
            }

            List <FilePath> files = new List <FilePath> ();

            // Build the list of files to be checked in
            string moduleName = entry.Name;

            if (localPath == entry.BaseDirectory)
            {
                GetFiles(files, entry);
            }
            else if (entry is Project)
            {
                foreach (ProjectFile file in ((Project)entry).Files.GetFilesInPath(localPath))
                {
                    if (file.Subtype != Subtype.Directory)
                    {
                        files.Add(file.FilePath);
                    }
                }
            }
            else
            {
                return(false);
            }

            if (files.Count == 0)
            {
                return(false);
            }

            SelectRepositoryDialog dlg = new SelectRepositoryDialog(SelectRepositoryMode.Publish);

            try {
                dlg.ModuleName = moduleName;
                dlg.Message    = GettextCatalog.GetString("Initial check-in of module {0}", moduleName);
                do
                {
                    if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok && dlg.Repository != null)
                    {
                        AlertButton publishButton = new AlertButton("_Publish");
                        if (MessageService.AskQuestion(GettextCatalog.GetString("Are you sure you want to publish the project?"), GettextCatalog.GetString("The project will be published to the repository '{0}', module '{1}'.", dlg.Repository.Name, dlg.ModuleName), AlertButton.Cancel, publishButton) == publishButton)
                        {
                            PublishWorker w = new PublishWorker(dlg.Repository, dlg.ModuleName, localPath, files.ToArray(), dlg.Message);
                            w.Start();
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                } while (true);
            } finally {
                dlg.Destroy();
            }
            return(true);
        }
Ejemplo n.º 28
0
 public override void ApplyChanges()
 {
     VersionControlService.IsGloballyDisabled = disableVersionControl.Active;
     VersionControlService.SaveConfiguration();
 }
        public override void BuildNode(ITreeBuilder builder, object dataObject, NodeInfo nodeInfo)
        {
            if (!builder.Options["ShowVersionControlOverlays"])
            {
                return;
            }

            // Add status overlays

            if (dataObject is WorkspaceObject)
            {
                WorkspaceObject ce  = (WorkspaceObject)dataObject;
                Repository      rep = VersionControlService.GetRepository(ce);
                if (rep != null)
                {
                    rep.GetDirectoryVersionInfoAsync(ce.BaseDirectory, false, false);
                    AddFolderOverlay(rep, ce.BaseDirectory, nodeInfo, false);
                }
                return;
            }
            else if (dataObject is ProjectFolder)
            {
                ProjectFolder ce = (ProjectFolder)dataObject;
                if (ce.ParentWorkspaceObject != null)
                {
                    Repository rep = VersionControlService.GetRepository(ce.ParentWorkspaceObject);
                    if (rep != null)
                    {
                        rep.GetDirectoryVersionInfoAsync(ce.Path, false, false);
                        AddFolderOverlay(rep, ce.Path, nodeInfo, true);
                    }
                }
                return;
            }

            WorkspaceObject prj;
            FilePath        file;

            if (dataObject is ProjectFile)
            {
                ProjectFile pfile = (ProjectFile)dataObject;
                prj  = pfile.Project;
                file = pfile.FilePath;
            }
            else
            {
                SystemFile pfile = (SystemFile)dataObject;
                prj  = pfile.ParentWorkspaceObject;
                file = pfile.Path;
            }

            if (prj == null)
            {
                return;
            }

            Repository repo = VersionControlService.GetRepository(prj);

            if (repo == null)
            {
                return;
            }

            if (repo.TryGetVersionInfo(file, out var vi))
            {
                var overlay = VersionControlService.LoadOverlayIconForStatus(vi.Status);
                if (overlay != null)
                {
                    nodeInfo.OverlayBottomRight = overlay;
                }
            }
        }
Ejemplo n.º 30
0
 protected override void Update(CommandInfo info)
 {
     info.Enabled = VersionControlService.CheckVersionControlInstalled();
     info.Visible = !VersionControlService.IsGloballyDisabled;
 }