NotifyFileStatusChanged() публичный статический Метод

public static NotifyFileStatusChanged ( MonoDevelop.VersionControl.FileUpdateEventArgs args ) : void
args MonoDevelop.VersionControl.FileUpdateEventArgs
Результат void
Пример #1
0
        public void SetStatus(IEnumerable <VersionInfo> versionInfos)
        {
            FileUpdateEventArgs args = null;

            lock (fileStatus) {
                foreach (var versionInfo in versionInfos)
                {
                    VersionInfo vi;
                    if (fileStatus.TryGetValue(versionInfo.LocalPath, out vi) && vi.Equals(versionInfo))
                    {
                        vi.RequiresRefresh = false;
                        continue;
                    }
                    versionInfo.Init(repo);
                    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);
            }
        }
Пример #2
0
        public void ClearCachedVersionInfo(FilePath rootPath)
        {
            FileUpdateEventArgs args = null;
            var canonicalPath        = rootPath.CanonicalPath;

            foreach (var p in fileStatus.Where(e => e.Key.IsChildPathOf(rootPath) || e.Key == canonicalPath))
            {
                p.Value.RequiresRefresh = true;

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

            foreach (var p in directoryStatus.Where(e => e.Key.IsChildPathOf(rootPath) || e.Key == canonicalPath))
            {
                p.Value.RequiresRefresh = true;
            }

            if (args != null)
            {
                //	Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Пример #3
0
            protected override void Run()
            {
                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    list[0].Repository.Revert(list.Paths, true, Monitor);
                }

                Gtk.Application.Invoke(delegate {
                    foreach (VersionControlItem item in items)
                    {
                        if (!item.IsDirectory)
                        {
                            FileService.NotifyFileChanged(item.Path);
                            // Reload reverted files
                            Document doc = IdeApp.Workbench.GetDocument(item.Path);
                            if (doc != null && System.IO.File.Exists(item.Path))
                            {
                                doc.Reload();
                            }
                        }
                    }
                    VersionControlService.NotifyFileStatusChanged(items);
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Revert operation completed."));
            }
Пример #4
0
            protected override async Task RunAsync()
            {
                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    try {
                        await list[0].Repository.RevertAsync(list.Paths, true, Monitor);
                    } catch (OperationCanceledException) {
                        return;
                    } catch (Exception ex) {
                        LoggingService.LogError("Revert operation failed", ex);
                        Monitor.ReportError(ex.Message, null);
                        return;
                    }
                }

                Gtk.Application.Invoke((o, args) => {
                    foreach (VersionControlItem item in items)
                    {
                        if (!item.IsDirectory)
                        {
                            // Reload reverted files
                            Document doc = IdeApp.Workbench.GetDocument(item.Path);
                            if (doc != null && System.IO.File.Exists(item.Path))
                            {
                                doc.Reload();
                            }
                        }
                    }
                    VersionControlService.NotifyFileStatusChanged(items);
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Revert operation completed."));
            }
Пример #5
0
        public void SetStatus(VersionInfo versionInfo, bool notify = true)
        {
            try {
                fileLock.EnterWriteLock();

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

            if (notify)
            {
                VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory));
            }
        }
Пример #6
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);
                    }
                }
                foreach (FilePath path in dirs)
                {
                    VersionControlService.NotifyFileStatusChanged(vc, path, true);
                }
                foreach (FilePath path in files)
                {
                    VersionControlService.NotifyFileStatusChanged(vc, path, false);
                }
            }
Пример #7
0
        public async Task DeleteFilesAsync(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 OnDeleteFilesAsync(localPaths, force, monitor, keepLocal);

                    foreach (var path in localPaths)
                    {
                        args.Add(new FileUpdateEventInfo(this, path, false));
                    }
                } catch (Exception e) {
                    LoggingService.LogError("Failed to delete file", e);
                    metadata.SetFailure();
                    if (!keepLocal)
                    {
                        foreach (var path in localPaths)
                        {
                            File.Delete(path);
                        }
                    }
                }
            }
            ClearCachedVersionInfo(localPaths);
            if (args.Any())
            {
                VersionControlService.NotifyFileStatusChanged(args);
            }
        }
Пример #8
0
        public override void NotifyFilesChanged(IEnumerable <FilePath> files)
        {
            FileUpdateEventArgs args = new FileUpdateEventArgs();

            args.AddRange(files.Select(f => new FileUpdateEventInfo(GetRepository(f), f, false)));
            VersionControlService.NotifyFileStatusChanged(args);
        }
Пример #9
0
        protected override void Run()
        {
            vc.Publish(moduleName, path, files, message, Monitor);
            Monitor.ReportSuccess(GettextCatalog.GetString("Publish operation completed."));

            Gtk.Application.Invoke(delegate {
                VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, true));
            });
        }
Пример #10
0
        public override void NotifyFilesChanged(IEnumerable <FilePath> files)
        {
            FileUpdateEventArgs args = new FileUpdateEventArgs();

            args.AddRange(files.Select(f => {
                var rep = GetRepository(f);
                rep.ClearCachedVersionInfo(f);
                return(new FileUpdateEventInfo(rep, f, false));
            }));
            VersionControlService.NotifyFileStatusChanged(args);
        }
Пример #11
0
 protected override void Run()
 {
     foreach (VersionControlItemList list in items.SplitByRepository())
     {
         list[0].Repository.Update(list.Paths, true, Monitor);
     }
     Gtk.Application.Invoke((o, args) => {
         VersionControlService.NotifyFileStatusChanged(items);
     });
     Monitor.ReportSuccess(GettextCatalog.GetString("Update operation completed."));
 }
Пример #12
0
            protected override void Run()
            {
                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    list[0].Repository.Unlock(Monitor, list.Paths);
                }

                Gtk.Application.Invoke(delegate {
                    VersionControlService.NotifyFileStatusChanged(items);
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Unlock operation completed."));
            }
            protected override void Run()
            {
                IProgressMonitor monitor = Monitor;

                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    list[0].Repository.Add(list.Paths, true, monitor);
                }

                Gtk.Application.Invoke(delegate {
                    VersionControlService.NotifyFileStatusChanged(items);
                });
            }
Пример #14
0
            protected override void Run()
            {
                IProgressMonitor monitor = Monitor;

                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    list[0].Repository.Add(list.Paths, true, monitor);
                }

                Gtk.Application.Invoke(delegate {
                    VersionControlService.NotifyFileStatusChanged(items);
                });
                monitor.ReportSuccess(GettextCatalog.GetString("Add operation completed."));
            }
Пример #15
0
            protected override async Task RunAsync()
            {
                ProgressMonitor monitor = Monitor;

                foreach (VersionControlItemList list in items.SplitByRepository())
                {
                    await list[0].Repository.AddAsync(list.Paths, true, monitor);
                }

                Gtk.Application.Invoke((o, args) => {
                    VersionControlService.NotifyFileStatusChanged(items);
                });
                monitor.ReportSuccess(GettextCatalog.GetString("Add operation completed."));
            }
Пример #16
0
            protected override void Run()
            {
                try {
                    vc.Publish(moduleName, path, files, message, Monitor);
                } catch (VersionControlException e) {
                    Monitor.ReportError(e.Message, null);
                    return;
                }

                Gtk.Application.Invoke((o, args) => {
                    VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, true));
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Publish operation completed."));
            }
Пример #17
0
            protected override async Task RunAsync()
            {
                try {
                    // 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
                        await vc.RevertAsync(path, true, Monitor);

                        await vc.RevertToRevisionAsync(path, revision, Monitor);
                    }
                    else
                    {
                        await vc.RevertRevisionAsync(path, revision, Monitor);
                    }

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

                    Gtk.Application.Invoke((o, args) => {
                        if (!isDir)
                        {
                            // Reload reverted files
                            Document doc = IdeApp.Workbench.GetDocument(path);
                            if (doc != null)
                            {
                                doc.Reload();
                            }
                            VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, false));
                        }
                        else
                        {
                            VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, true));
                        }
                    });
                    Monitor.ReportSuccess(GettextCatalog.GetString("Revert operation completed."));
                } catch (OperationCanceledException) {
                    return;
                } catch (Exception ex) {
                    LoggingService.LogError("Revert operation failed", ex);
                    Monitor.ReportError(ex.Message, null);
                }
            }
Пример #18
0
        public override void NotifyFilesChanged(IEnumerable <FilePath> files)
        {
            FileUpdateEventArgs args = new FileUpdateEventArgs();

            foreach (var file in files)
            {
                var rep = GetRepository(file);
                if (rep != null && !rep.IsDisposed)
                {
                    rep.ClearCachedVersionInfo(file);
                    args.Add(new FileUpdateEventInfo(rep, file, false));
                }
            }
            VersionControlService.NotifyFileStatusChanged(args);
        }
Пример #19
0
 protected override void Run()
 {
     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 (Exception ex) {
         LoggingService.LogError("Unlock operation failed", ex);
         MessageService.ShowError(GettextCatalog.GetString("Version control command failed."), ex);
     }
 }
Пример #20
0
 public void SetStatus(VersionInfo versionInfo, bool notify = true)
 {
     lock (fileStatus) {
         VersionInfo vi;
         if (fileStatus.TryGetValue(versionInfo.LocalPath, out vi) && vi.Equals(versionInfo))
         {
             vi.RequiresRefresh = false;
             return;
         }
         versionInfo.Init(repo);
         fileStatus [versionInfo.LocalPath] = versionInfo;
     }
     if (notify)
     {
         VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(repo, versionInfo.LocalPath, versionInfo.IsDirectory));
     }
 }
Пример #21
0
 protected override void Run()
 {
     foreach (VersionControlItemList list in items.SplitByRepository())
     {
         try {
             list [0].Repository.Ignore(list.Paths);
         } catch (Exception ex) {
             LoggingService.LogError("Ignore operation failed", ex);
             Monitor.ReportError(ex.Message, null);
             return;
         }
     }
     Gtk.Application.Invoke((o, args) => {
         VersionControlService.NotifyFileStatusChanged(items);
     });
     Monitor.ReportSuccess(GettextCatalog.GetString("Ignore operation completed."));
 }
Пример #22
0
            protected override async Task RunAsync()
            {
                try {
                    await vc.PublishAsync(moduleName, path, files, message, Monitor);
                } catch (OperationCanceledException) {
                    return;
                } catch (VersionControlException e) {
                    LoggingService.LogError("Publish operation failed", e);
                    Monitor.ReportError(e.Message, null);
                    return;
                }

                Gtk.Application.Invoke((o, args) => {
                    VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, true));
                });
                Monitor.ReportSuccess(GettextCatalog.GetString("Publish operation completed."));
            }
Пример #23
0
            protected override void Finished()
            {
                dlg.EndCommit(success);
                dlg.Destroy();
                FileUpdateEventArgs args = new FileUpdateEventArgs();

                foreach (ChangeSetItem it in changeSet.Items)
                {
                    args.Add(new FileUpdateEventInfo(vc, it.LocalPath, it.IsDirectory));
                }

                if (args.Count > 0)
                {
                    VersionControlService.NotifyFileStatusChanged(args);
                }

                VersionControlService.NotifyAfterCommit(vc, changeSet, success);
            }
            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));
                    }
                });
            }
Пример #25
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."));
 }
Пример #26
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."));
            }
            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);
                });
            }
Пример #28
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));
            }
        }
Пример #29
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."));
            }
        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);
            }
        }