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);
            }
        }