示例#1
0
        public static bool Commit(Repository vc, ChangeSet changeSet, bool test)
        {
            try {
                if (changeSet.IsEmpty)
                {
                    if (!test)
                    {
                        MessageService.ShowMessage(GettextCatalog.GetString("There are no changes to be committed."));
                    }
                    return(false);
                }
                if (vc.CanCommit(changeSet.BaseLocalPath))
                {
                    if (test)
                    {
                        return(true);
                    }

                    if (!VersionControlService.NotifyPrepareCommit(vc, changeSet))
                    {
                        return(false);
                    }
                    CommitDialog dlg = new CommitDialog(changeSet);
                    try {
                        if (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok)
                        {
                            if (VersionControlService.NotifyBeforeCommit(vc, changeSet))
                            {
                                new CommitWorker(vc, changeSet, dlg).Start();
                                return(true);
                            }
                        }
                        dlg.EndCommit(false);
                    } finally {
                        dlg.Destroy();
                    }
                    VersionControlService.NotifyAfterCommit(vc, changeSet, false);
                }
                return(false);
            }
            catch (Exception ex) {
                if (test)
                {
                    LoggingService.LogError(ex.ToString());
                }
                else
                {
                    MessageService.ShowException(ex, GettextCatalog.GetString("Version control command failed."));
                }
                return(false);
            }
        }
示例#2
0
		public static bool Commit (Repository vc, ChangeSet changeSet, bool test)
		{
			try {
				if (changeSet.IsEmpty) {
					if (!test)
						MessageService.ShowMessage (GettextCatalog.GetString ("There are no changes to be committed."));
					return false;
				}
				
				if (vc.CanCommit (changeSet.BaseLocalPath)) {
					if (test) return true;

					if (!VersionControlService.NotifyPrepareCommit (vc, changeSet))
						return false;
					CommitDialog dlg = new CommitDialog (changeSet);
					try {
						if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
							if (VersionControlService.NotifyBeforeCommit (vc, changeSet)) {
								new CommitWorker (vc, changeSet, dlg).Start();
								return true;
							}
						}
						dlg.EndCommit (false);
					} finally {
						dlg.Destroy ();
					}
					VersionControlService.NotifyAfterCommit (vc, changeSet, false);
				}
				return false;
			}
			catch (Exception ex) {
				if (test)
					LoggingService.LogError (ex.ToString ());
				else
					MessageService.ShowException (ex, GettextCatalog.GetString ("Version control command failed."));
				return false;
			}
		}