Пример #1
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."));
            }
Пример #2
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."));
            }
Пример #3
0
        public static bool Commit(VersionControlItemList items, bool test)
        {
            int filesToCommit = 0;

            VersionControlItemList[] itemListsByRepo = items.SplitByRepository();

            foreach (VersionControlItemList itemList in itemListsByRepo)
            {
                // Generate base folder path.
                FilePath basePath = itemList.FindMostSpecificParent(FilePath.Null);

                Repository repo = itemList.First().Repository;

                ChangeSet cset = repo.CreateChangeSet(basePath);
                cset.GlobalComment = VersionControlService.GetCommitComment(cset.BaseLocalPath);

                foreach (var item in itemList)
                {
                    if (!item.VersionInfo.CanCommit)
                    {
                        continue;
                    }

                    if (test)
                    {
                        return(true);
                    }

                    foreach (VersionInfo vi in repo.GetDirectoryVersionInfo(item.Path, false, true))
                    {
                        if (vi.HasLocalChanges)
                        {
                            filesToCommit++;
                            if (test)
                            {
                                continue;
                            }

                            cset.AddFile(vi);
                        }
                    }
                }

                if (!cset.IsEmpty)
                {
                    Commit(repo, cset, false);
                }
                else if (!test)
                {
                    MessageService.ShowMessage(GettextCatalog.GetString("There are no changes to be committed."));
                    continue;
                }
            }
            return(filesToCommit != 0);
        }
Пример #4
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."));
 }
Пример #5
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);
                });
            }
Пример #7
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."));
            }
Пример #8
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."));
            }
Пример #9
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);
     }
 }
Пример #10
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."));
 }
Пример #11
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."));
 }
Пример #12
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);
                });
            }
Пример #14
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."));
            }