void BindMonitor(SvnClientArgs args, IProgressMonitor monitor) { NotifData data = new NotifData(); progressData = new ProgressData(); args.Notify += delegate(object o, SvnNotifyEventArgs e) { Notify(e, data, monitor); }; args.SvnError += delegate(object o, SvnErrorEventArgs a) { monitor.ReportError(a.Exception.Message, a.Exception.RootCause); }; updateMonitor = monitor; }
static void Notify(SvnNotifyEventArgs e, NotifData notifData, IProgressMonitor monitor) { string actiondesc; string file = e.Path; bool skipEol = false; bool notifyChange = false; switch (e.Action) { case SvnNotifyAction.Skip: if (e.ContentState == SvnNotifyState.Missing) { actiondesc = string.Format(GettextCatalog.GetString("Skipped missing target: '{0}'"), file); } else { actiondesc = string.Format(GettextCatalog.GetString("Skipped '{0}'"), file); } break; case SvnNotifyAction.UpdateDelete: actiondesc = string.Format(GettextCatalog.GetString("Deleted '{0}'"), file); break; case SvnNotifyAction.UpdateAdd: if (e.ContentState == SvnNotifyState.Conflicted) { actiondesc = string.Format(GettextCatalog.GetString("Conflict {0}"), file); } else { actiondesc = string.Format(GettextCatalog.GetString("Added {0}"), file); } break; case SvnNotifyAction.Restore: actiondesc = string.Format(GettextCatalog.GetString("Restored '{0}'"), file); break; case SvnNotifyAction.Revert: actiondesc = string.Format(GettextCatalog.GetString("Reverted '{0}'"), file); break; case SvnNotifyAction.RevertFailed: actiondesc = string.Format(GettextCatalog.GetString("Failed to revert '{0}' -- try updating instead."), file); break; case SvnNotifyAction.Resolved: actiondesc = string.Format(GettextCatalog.GetString("Resolved conflict state of '{0}'"), file); break; case SvnNotifyAction.Add: if (e.MimeTypeIsBinary) { actiondesc = string.Format(GettextCatalog.GetString("Add (bin) '{0}'"), file); } else { actiondesc = string.Format(GettextCatalog.GetString("Add '{0}'"), file); } break; case SvnNotifyAction.Delete: actiondesc = string.Format(GettextCatalog.GetString("Delete '{0}'"), file); break; case SvnNotifyAction.UpdateUpdate: actiondesc = string.Format(GettextCatalog.GetString("Update '{0}'"), file); notifyChange = true; break; case SvnNotifyAction.UpdateExternal: actiondesc = string.Format(GettextCatalog.GetString("Fetching external item into '{0}'"), file); break; case SvnNotifyAction.UpdateCompleted: // TODO actiondesc = GettextCatalog.GetString("Finished"); break; case SvnNotifyAction.StatusExternal: actiondesc = string.Format(GettextCatalog.GetString("Performing status on external item at '{0}'"), file); break; case SvnNotifyAction.StatusCompleted: actiondesc = string.Format(GettextCatalog.GetString("Status against revision: '{0}'"), e.Revision); break; case SvnNotifyAction.CommitDeleted: actiondesc = string.Format(GettextCatalog.GetString("Deleting {0}"), file); break; case SvnNotifyAction.CommitModified: actiondesc = string.Format(GettextCatalog.GetString("Sending {0}"), file); notifyChange = true; break; case SvnNotifyAction.CommitAdded: if (e.MimeTypeIsBinary) { actiondesc = string.Format(GettextCatalog.GetString("Adding (bin) '{0}'"), file); } else { actiondesc = string.Format(GettextCatalog.GetString("Adding '{0}'"), file); } break; case SvnNotifyAction.CommitReplaced: actiondesc = string.Format(GettextCatalog.GetString("Replacing {0}"), file); notifyChange = true; break; case SvnNotifyAction.CommitSendData: if (!notifData.SendingData) { notifData.SendingData = true; actiondesc = GettextCatalog.GetString("Transmitting file data"); } else { actiondesc = "."; skipEol = true; } break; case SvnNotifyAction.LockLocked: actiondesc = string.Format(GettextCatalog.GetString("'{0}' locked by user '{1}'."), file, e.Lock.Owner); break; case SvnNotifyAction.LockUnlocked: actiondesc = string.Format(GettextCatalog.GetString("'{0}' unlocked."), file); break; default: actiondesc = e.Action + " " + file; break; } if (monitor != null) { if (skipEol) { monitor.Log.Write(actiondesc); } else { monitor.Log.WriteLine(actiondesc); } } if (notifyChange && File.Exists(file)) { FileService.NotifyFileChanged(file, true); } }
static void Notify (SvnNotifyEventArgs e, NotifData notifData, IProgressMonitor monitor) { string actiondesc; string file = e.Path; bool skipEol = false; bool notifyChange = false; switch (e.Action) { case SvnNotifyAction.Skip: if (e.ContentState == SvnNotifyState.Missing) { actiondesc = string.Format (GettextCatalog.GetString ("Skipped missing target: '{0}'"), file); } else { actiondesc = string.Format (GettextCatalog.GetString ("Skipped '{0}'"), file); } break; case SvnNotifyAction.UpdateDelete: actiondesc = string.Format (GettextCatalog.GetString ("Deleted '{0}'"), file); break; case SvnNotifyAction.UpdateAdd: if (e.ContentState == SvnNotifyState.Conflicted) { actiondesc = string.Format (GettextCatalog.GetString ("Conflict {0}"), file); } else { actiondesc = string.Format (GettextCatalog.GetString ("Added {0}"), file); } break; case SvnNotifyAction.Restore: actiondesc = string.Format (GettextCatalog.GetString ("Restored '{0}'"), file); break; case SvnNotifyAction.Revert: actiondesc = string.Format (GettextCatalog.GetString ("Reverted '{0}'"), file); break; case SvnNotifyAction.RevertFailed: actiondesc = string.Format (GettextCatalog.GetString ("Failed to revert '{0}' -- try updating instead."), file); break; case SvnNotifyAction.Resolved: actiondesc = string.Format (GettextCatalog.GetString ("Resolved conflict state of '{0}'"), file); break; case SvnNotifyAction.Add: if (e.MimeTypeIsBinary) { actiondesc = string.Format (GettextCatalog.GetString ("Add (bin) '{0}'"), file); } else { actiondesc = string.Format (GettextCatalog.GetString ("Add '{0}'"), file); } break; case SvnNotifyAction.Delete: actiondesc = string.Format (GettextCatalog.GetString ("Delete '{0}'"), file); break; case SvnNotifyAction.UpdateUpdate: actiondesc = string.Format (GettextCatalog.GetString ("Update '{0}'"), file); notifyChange = true; break; case SvnNotifyAction.UpdateExternal: actiondesc = string.Format (GettextCatalog.GetString ("Fetching external item into '{0}'"), file); break; case SvnNotifyAction.UpdateCompleted: // TODO actiondesc = GettextCatalog.GetString ("Finished"); break; case SvnNotifyAction.StatusExternal: actiondesc = string.Format (GettextCatalog.GetString ("Performing status on external item at '{0}'"), file); break; case SvnNotifyAction.StatusCompleted: actiondesc = string.Format (GettextCatalog.GetString ("Status against revision: '{0}'"), e.Revision); break; case SvnNotifyAction.CommitDeleted: actiondesc = string.Format (GettextCatalog.GetString ("Deleting {0}"), file); break; case SvnNotifyAction.CommitModified: actiondesc = string.Format (GettextCatalog.GetString ("Sending {0}"), file); notifyChange = true; break; case SvnNotifyAction.CommitAdded: if (e.MimeTypeIsBinary) { actiondesc = string.Format (GettextCatalog.GetString ("Adding (bin) '{0}'"), file); } else { actiondesc = string.Format (GettextCatalog.GetString ("Adding '{0}'"), file); } break; case SvnNotifyAction.CommitReplaced: actiondesc = string.Format (GettextCatalog.GetString ("Replacing {0}"), file); notifyChange = true; break; case SvnNotifyAction.CommitSendData: if (!notifData.SendingData) { notifData.SendingData = true; actiondesc = GettextCatalog.GetString ("Transmitting file data"); } else { actiondesc = "."; skipEol = true; } break; case SvnNotifyAction.LockLocked: actiondesc = string.Format (GettextCatalog.GetString ("'{0}' locked by user '{1}'."), file, e.Lock.Owner); break; case SvnNotifyAction.LockUnlocked: actiondesc = string.Format (GettextCatalog.GetString ("'{0}' unlocked."), file); break; default: actiondesc = e.Action.ToString () + " " + file; break; } if (monitor != null) { if (skipEol) monitor.Log.Write (actiondesc); else monitor.Log.WriteLine (actiondesc); } if (notifyChange && File.Exists (file)) FileService.NotifyFileChanged (file, true); }
void BindMonitor (SvnClientArgs args, IProgressMonitor monitor) { NotifData data = new NotifData (); progressData = new ProgressData (); args.Notify += delegate (object o, SvnNotifyEventArgs e) { Notify (e, data, monitor); }; args.SvnError += delegate (object o, SvnErrorEventArgs a) { monitor.ReportError (a.Exception.Message, a.Exception.RootCause); }; updateMonitor = monitor; }
void BindMonitor (IProgressMonitor monitor) { notifyData = new NotifData (); progressData = new ProgressData (); updateMonitor = monitor; }
void BindMonitor (SvnClientArgs args, IProgressMonitor monitor) { notifyData = new NotifData (); progressData = new ProgressData (); updateMonitor = monitor; }
void BindMonitor (SvnClientArgs args, IProgressMonitor monitor) { NotifData data = new NotifData (); args.Notify += delegate (object o, SvnNotifyEventArgs e) { Notify (e, data, monitor); }; args.Cancel += delegate (object o, SvnCancelEventArgs a) { a.Cancel = monitor.IsCancelRequested; }; args.SvnError += delegate (object o, SvnErrorEventArgs a) { monitor.ReportError (a.Exception.Message, a.Exception.RootCause); }; }