static void Resolve(CommandEventArgs e, SvnAccept accept) { HybridCollection <string> paths = new HybridCollection <string>(StringComparer.OrdinalIgnoreCase); foreach (SvnItem item in e.Selection.GetSelectedSvnItems(true)) { if (!item.IsConflicted) { continue; } if (!paths.Contains(item.FullPath)) { paths.Add(item.FullPath); } } IAnkhOpenDocumentTracker documentTracker = e.GetService <IAnkhOpenDocumentTracker>(); documentTracker.SaveDocuments(paths); // Make sure all files are saved before updating/merging! using (DocumentLock lck = documentTracker.LockDocuments(paths, DocumentLockType.NoReload)) using (lck.MonitorChangesForReload()) using (SvnClient client = e.GetService <ISvnClientPool>().GetNoUIClient()) { SvnResolveArgs a = new SvnResolveArgs(); a.Depth = SvnDepth.Empty; foreach (string p in paths) { client.Resolve(p, accept, a); } } }
public override void Resolve(FilePath path, bool recurse, IProgressMonitor monitor) { SvnResolveArgs args = new SvnResolveArgs(); BindMonitor(args, monitor); args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children; client.Resolve(path, SvnAccept.MineFull, args); }
public void Resolve_ResolveDirectory() { SvnSandBox sbox = new SvnSandBox(this); Uri ReposUrl = sbox.CreateRepository(SandBoxRepository.AnkhSvnCases); UnzipToFolder(Path.Combine(ProjectBase, "Zips/conflictwc.zip"), sbox.Wc); RawRelocate(sbox.Wc, new Uri("file:///tmp/repos/"), ReposUrl); Client.Upgrade(sbox.Wc); RenameAdminDirs(sbox.Wc); SvnResolveArgs a = new SvnResolveArgs(); a.Depth = SvnDepth.Infinity; this.Client.Resolve(sbox.Wc, SvnAccept.Merged, a); Assert.That(this.GetSvnStatus(sbox.Wc), Is.EqualTo(SvnStatus.None), " Resolve didn't work! Directory still conflicted"); Assert.That(this.GetSvnStatus(Path.Combine(sbox.Wc, "Form.cs")), Is.EqualTo(SvnStatus.Modified), "Resolve didn't work! File still conflicted"); }
private void ReleaseExternalWrites() { Dictionary<string, DocumentLock> modified; lock (_externallyChanged) { if (_externallyChanged.Count == 0) return; modified = new Dictionary<string, DocumentLock>(_externallyChanged, StringComparer.OrdinalIgnoreCase); _externallyChanged.Clear(); } try { foreach (KeyValuePair<string, DocumentLock> file in modified) { ScheduleSvnStatus(file.Key); SvnItem item = Cache[file.Key]; if (item.IsConflicted) { AnkhMessageBox mb = new AnkhMessageBox(Context); DialogResult dr = mb.Show(string.Format(Resources.YourMergeToolSavedXWouldYouLikeItMarkedAsResolved, file.Key), Resources.MergeCompleted, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); switch (dr) { case DialogResult.Yes: using (SvnClient c = Context.GetService<ISvnClientPool>().GetNoUIClient()) { SvnResolveArgs ra = new SvnResolveArgs(); ra.ThrowOnError = false; c.Resolve(file.Key, SvnAccept.Merged, ra); } goto case DialogResult.No; case DialogResult.No: if (!item.IsModified) { // Reload? } break; default: // Let VS handle the file return; // No reload } } if (!item.IsDocumentDirty) { if (file.Value != null) file.Value.Reload(file.Key); } } } catch (Exception ex) { IAnkhErrorHandler eh = GetService<IAnkhErrorHandler>(); if (eh != null && eh.IsEnabled(ex)) eh.OnError(ex); else throw; } finally { foreach (DocumentLock dl in modified.Values) { if (dl != null) dl.Dispose(); } } }
private void ReleaseExternalWrites() { Dictionary <string, DocumentLock> modified; lock (_externallyChanged) { if (_externallyChanged.Count == 0) { return; } modified = new Dictionary <string, DocumentLock>(_externallyChanged, StringComparer.OrdinalIgnoreCase); _externallyChanged.Clear(); } try { ScheduleSvnStatus(modified.Keys); foreach (KeyValuePair <string, DocumentLock> file in modified) { SvnItem item = SvnCache[file.Key]; if (item.IsConflicted) { AnkhMessageBox mb = new AnkhMessageBox(Context); DialogResult dr = mb.Show(string.Format(Resources.YourMergeToolSavedXWouldYouLikeItMarkedAsResolved, file.Key), Resources.MergeCompleted, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information); switch (dr) { case DialogResult.Yes: using (SvnClient c = Context.GetService <ISvnClientPool>().GetNoUIClient()) { SvnResolveArgs ra = new SvnResolveArgs(); ra.ThrowOnError = false; c.Resolve(file.Key, SvnAccept.Merged, ra); } goto case DialogResult.No; case DialogResult.No: if (!item.IsModified) { // Reload? } break; default: // Let VS handle the file return; // No reload } } if (!item.IsDocumentDirty) { if (file.Value != null) { file.Value.Reload(file.Key); } } } } catch (Exception ex) { IAnkhErrorHandler eh = GetService <IAnkhErrorHandler>(); if (eh != null && eh.IsEnabled(ex)) { eh.OnError(ex); } else { throw; } } finally { foreach (DocumentLock dl in modified.Values) { if (dl != null) { dl.Dispose(); } } } }
public override void Resolve (FilePath path, bool recurse, IProgressMonitor monitor) { SvnResolveArgs args = new SvnResolveArgs (); BindMonitor (args, monitor); args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children; lock (client) client.Resolve (path, SvnAccept.MineFull, args); }
static void Resolve(CommandEventArgs e, SvnAccept accept) { HybridCollection<string> paths = new HybridCollection<string>(StringComparer.OrdinalIgnoreCase); foreach (SvnItem item in e.Selection.GetSelectedSvnItems(true)) { if (!item.IsConflicted) continue; if (!paths.Contains(item.FullPath)) paths.Add(item.FullPath); } IAnkhOpenDocumentTracker documentTracker = e.GetService<IAnkhOpenDocumentTracker>(); documentTracker.SaveDocuments(paths); // Make sure all files are saved before updating/merging! using (DocumentLock lck = documentTracker.LockDocuments(paths, DocumentLockType.NoReload)) using (lck.MonitorChangesForReload()) using (SvnClient client = e.GetService<ISvnClientPool>().GetNoUIClient()) { SvnResolveArgs a = new SvnResolveArgs(); a.Depth = SvnDepth.Empty; foreach (string p in paths) { client.Resolve(p, accept, a); } } }