public override async Task <Annotation []> GetAnnotationsAsync(FilePath repositoryPath, Revision since, CancellationToken cancellationToken) { SvnRevision sinceRev = since != null ? (SvnRevision)since : null; List <Annotation> annotations = new List <Annotation> (Svn.GetAnnotations(this, repositoryPath, SvnRevision.First, sinceRev ?? SvnRevision.Base)); Annotation nextRev = new Annotation(null, GettextCatalog.GetString("<uncommitted>"), DateTime.MinValue, null, GettextCatalog.GetString("working copy")); var baseDocument = Mono.TextEditor.TextDocument.CreateImmutableDocument(await GetBaseTextAsync(repositoryPath, cancellationToken).ConfigureAwait(false)); var workingDocument = Mono.TextEditor.TextDocument.CreateImmutableDocument(File.ReadAllText(repositoryPath)); // "SubversionException: blame of the WORKING revision is not supported" if (sinceRev == null) { foreach (var hunk in baseDocument.Diff(workingDocument, includeEol: false)) { annotations.RemoveRange(hunk.RemoveStart - 1, hunk.Removed); for (int i = 0; i < hunk.Inserted; ++i) { if (hunk.InsertStart + i >= annotations.Count) { annotations.Add(nextRev); } else { annotations.Insert(hunk.InsertStart - 1, nextRev); } } } } return(annotations.ToArray()); }
public Revision[] GetHistory(Repository repo, FilePath sourcefile, Revision since) { SvnRevision startrev = SvnRevision.Working; SvnRevision sincerev = SvnRevision.First; if (since != null) { sincerev = (SvnRevision)since; } return(Log(repo, sourcefile, startrev, sincerev).ToArray()); }
static VersionInfo CreateVersionInfo(Repository repo, SvnStatusEventArgs ent) { VersionStatus rs = VersionStatus.Unversioned; Revision rr = null; // TODO: Fix remote status for Win32 Svn. if (ent.IsRemoteUpdated) { rs = ConvertStatus(SvnSchedule.Normal, ent.RemoteContentStatus); rr = new SvnRevision(repo, (int)ent.RemoteUpdateRevision, ent.RemoteUpdateCommitTime, ent.RemoteUpdateCommitAuthor, "(unavailable)", null); } VersionStatus status = ConvertStatus(SvnSchedule.Normal, ent.LocalContentStatus); bool readOnly = File.Exists(ent.FullPath) && (File.GetAttributes(ent.FullPath) & FileAttributes.ReadOnly) != 0; if (ent.WorkingCopyInfo != null) { if (ent.RemoteLock != null || ent.LocalLock != null) { status |= VersionStatus.LockRequired; if (ent.LocalLock != null || (ent.RemoteLock != null && ent.RemoteLock.Token != null)) { status |= VersionStatus.LockOwned; } else { status |= VersionStatus.Locked; } } else if (readOnly) { status |= VersionStatus.LockRequired; } } string repoPath = ent.Uri != null?ent.Uri.ToString() : null; SvnRevision newRev = null; if (ent.WorkingCopyInfo != null) { newRev = new SvnRevision(repo, (int)ent.Revision); } return(new VersionInfo(ent.FullPath, repoPath, ent.NodeKind == SvnNodeKind.Directory, status, newRev, rs, rr)); }
public override Task <Revision> GetPreviousAsync(CancellationToken cancellationToken) { Revision result; if (Kind != 1 && Rev == 0) { result = Previous; } else { result = new SvnRevision(Repository, Rev - 1); } return(Task.FromResult(result)); }
public override Annotation[] GetAnnotations(Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd) { if (file == FilePath.Null) { throw new ArgumentNullException(); } var target = new SvnPathTarget(file, SharpSvn.SvnRevision.Base); int numAnnotations = 0; using (var data = new MemoryStream()) { lock (client) client.Write(target, data); using (var reader = new StreamReader(data)) { reader.BaseStream.Seek(0, SeekOrigin.Begin); while (reader.ReadLine() != null) { numAnnotations++; } } } System.Collections.ObjectModel.Collection <SvnBlameEventArgs> list; var args = new SvnBlameArgs { Start = GetRevision(revStart), End = GetRevision(revEnd), }; bool success; lock (client) { success = client.GetBlame(target, args, out list); } if (success) { var annotations = new Annotation [numAnnotations]; foreach (var annotation in list) { if (annotation.LineNumber < annotations.Length) { annotations [(int)annotation.LineNumber] = new Annotation(annotation.Revision.ToString(), annotation.Author, annotation.Time); } } return(annotations); } return(new Annotation[0]); }
public override string GetUnifiedDiff(FilePath path1, SvnRevision revision1, FilePath path2, SvnRevision revision2, bool recursive) { SvnPathTarget t1 = new SvnPathTarget(path1, GetRevision(revision1)); SvnPathTarget t2 = new SvnPathTarget(path2, GetRevision(revision2)); SvnDiffArgs args = new SvnDiffArgs(); args.Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children; MemoryStream ms = new MemoryStream(); client.Diff(t1, t2, args, ms); ms.Position = 0; using (StreamReader sr = new StreamReader(ms)) { return(sr.ReadToEnd()); } }
public override IEnumerable <SvnRevision> Log(Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd) { List <SvnRevision> list = new List <SvnRevision> (); SvnLogArgs args = new SvnLogArgs(); args.Range = new SvnRevisionRange(GetRevision(revisionStart), GetRevision(revisionEnd)); client.Log(path, args, delegate(object o, SvnLogEventArgs a) { List <RevisionPath> paths = new List <RevisionPath> (); foreach (SvnChangeItem item in a.ChangedPaths) { paths.Add(new RevisionPath(item.Path, ConvertRevisionAction(item.Action), "")); } SvnRevision r = new SvnRevision(repo, (int)a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray()); list.Add(r); }); return(list); }
public Revision[] GetHistory(Repository repo, FilePath sourcefile, Revision since) { List <Revision> revs = new List <Revision>(); SvnRevision startrev = SvnRevision.Working; SvnRevision sincerev = SvnRevision.First; if (since != null) { sincerev = (SvnRevision)since; } foreach (SvnRevision rev in Log(repo, sourcefile, startrev, sincerev)) { revs.Add(rev); } return(revs.ToArray()); }
/// <summary> /// Get annotations for a versioned file. /// </summary> /// <returns> /// A <see cref="System.String"/> annotation for each line in file. /// </returns> public virtual Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd) { return new Annotation[0]; }
/// <summary> /// Get annotations for a versioned file. /// </summary> /// <returns> /// A <see cref="System.String"/> annotation for each line in file. /// </returns> public virtual List<string> GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd) { return new List<string> (); }
public abstract IEnumerable<DirectoryEntry> List (FilePath path, bool recurse, SvnRevision rev);
public abstract void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor);
protected override Task <RevisionPath []> OnGetRevisionChangesAsync(Revision revision, CancellationToken cancellationToken = default) { SvnRevision rev = (SvnRevision)revision; return(Task.FromResult(rev.ChangedFiles ?? new RevisionPath [0])); }
public virtual IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision) { return Status (repo, path, revision, false, false, false); }
public abstract IEnumerable <DirectoryEntry> ListUrl(string url, bool recurse, SvnRevision rev);
public override IEnumerable <SvnRevision> Log(Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd) { var list = new List <SvnRevision> (); var args = new SvnLogArgs { Range = new SvnRevisionRange(GetRevision(revisionStart), GetRevision(revisionEnd)), }; lock (client) client.Log(path, args, (o, a) => list.Add(new SvnRevision(repo, (int)a.Revision, a.Time, a.Author, a.LogMessage, a.ChangedPaths == null ? new RevisionPath[0] : a.ChangedPaths.Select(item => new RevisionPath(item.Path, ConvertRevisionAction(item.Action), "")).ToArray()))); return(list); }
public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus) { List<VersionInfo> list = new List<VersionInfo> (); SvnStatusArgs args = new SvnStatusArgs (); args.Revision = GetRevision (revision); args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children; args.RetrieveAllEntries = !changedItemsOnly; args.RetrieveRemoteStatus = remoteStatus; lock (client) { try { client.Status (path, args, delegate (object o, SvnStatusEventArgs a) { list.Add (CreateVersionInfo (repo, a)); }); } catch (SvnInvalidNodeKindException e) { if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_WORKING_COPY) list.Add (VersionInfo.CreateUnversioned (e.File, true)); else if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_FILE) list.Add (VersionInfo.CreateUnversioned (e.File, false)); else throw; } } return list; }
public abstract IEnumerable <VersionInfo> Status(Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus);
public virtual IEnumerable <VersionInfo> Status(Repository repo, FilePath path, SvnRevision revision) { return(Status(repo, path, revision, false, false, false)); }
public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus) { var list = new List<VersionInfo> (); var args = new SvnStatusArgs { Revision = GetRevision (revision), Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children, RetrieveAllEntries = !changedItemsOnly, RetrieveRemoteStatus = remoteStatus, }; lock (client) { try { client.Status (path, args, (o, a) => list.Add (CreateVersionInfo (repo, a))); } catch (SvnInvalidNodeKindException e) { if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_WORKING_COPY) list.Add (VersionInfo.CreateUnversioned (e.File, true)); else if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_FILE) list.Add (VersionInfo.CreateUnversioned (e.File, false)); else throw; } catch (SvnWorkingCopyPathNotFoundException e) { var fp = new FilePath (e.File); list.Add (VersionInfo.CreateUnversioned (fp, fp.IsDirectory)); } } return list; }
public override IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd) { var list = new List<SvnRevision> (); var args = new SvnLogArgs { Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd)), }; lock (client) client.Log (path, args, (o, a) => list.Add (new SvnRevision (repo, (int)a.Revision, a.Time, a.Author, a.LogMessage, a.ChangedPaths == null ? new RevisionPath[0] : a.ChangedPaths.Select (item => new RevisionPath (item.Path, ConvertRevisionAction (item.Action), "")).ToArray ()))); return list; }
public override IEnumerable <DirectoryEntry> ListUrl(string url, bool recurse, SvnRevision rev) { return(List(new SvnUriTarget(url, GetRevision(rev)), recurse)); }
public abstract string GetUnifiedDiff(FilePath path1, SvnRevision revision1, FilePath path2, SvnRevision revision2, bool recursive);
public override IEnumerable <DirectoryEntry> List(FilePath path, bool recurse, SvnRevision rev) { return(List(new SvnPathTarget(path, GetRevision(rev)), recurse)); }
public override IEnumerable <VersionInfo> Status(Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus) { List <VersionInfo> list = new List <VersionInfo> (); SvnStatusArgs args = new SvnStatusArgs(); args.Revision = GetRevision(revision); args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children; args.RetrieveAllEntries = !changedItemsOnly; args.RetrieveRemoteStatus = remoteStatus; lock (client) client.Status(path, args, delegate(object o, SvnStatusEventArgs a) { list.Add(CreateVersionInfo(repo, a)); }); return(list); }
public override IEnumerable <VersionInfo> Status(Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus) { if (path == FilePath.Null) { throw new ArgumentNullException(); } var list = new List <VersionInfo> (); var args = new SvnStatusArgs { Revision = GetRevision(revision), Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children, RetrieveAllEntries = !changedItemsOnly, RetrieveRemoteStatus = remoteStatus, }; lock (client) { try { client.Status(path, args, (o, a) => list.Add(CreateVersionInfo(repo, a))); } catch (SvnInvalidNodeKindException e) { if (!string.IsNullOrEmpty(e.File)) { if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_WORKING_COPY) { list.Add(VersionInfo.CreateUnversioned(e.File, true)); } else if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_FILE) { list.Add(VersionInfo.CreateUnversioned(e.File, false)); } else { throw; } } } catch (SvnWorkingCopyPathNotFoundException e) { list.Add(VersionInfo.CreateUnversioned(e.File, Directory.Exists(e.File))); } } return(list); }
public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor) { var args = new SvnMoveArgs { Force = force, }; BindMonitor (monitor); lock (client) client.Move (srcPath, destPath, args); }
protected override RevisionPath[] OnGetRevisionChanges(Revision revision) { SvnRevision rev = (SvnRevision)revision; return(rev.ChangedFiles ?? new RevisionPath [0]); }
public override IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev) { return List (new SvnUriTarget (url, GetRevision (rev)), recurse); }
public abstract IEnumerable <DirectoryEntry> List(FilePath path, bool recurse, SvnRevision rev);
public override IEnumerable<DirectoryEntry> List (FilePath path, bool recurse, SvnRevision rev) { return List (new SvnPathTarget (path, GetRevision (rev)), recurse); }
public abstract void Move(FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor);
public override IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd) { List<SvnRevision> list = new List<SvnRevision> (); SvnLogArgs args = new SvnLogArgs (); args.Range = new SvnRevisionRange (GetRevision (revisionStart), GetRevision (revisionEnd)); lock (client) client.Log (path, args, delegate (object o, SvnLogEventArgs a) { List<RevisionPath> paths = new List<RevisionPath> (); foreach (SvnChangeItem item in a.ChangedPaths) { paths.Add (new RevisionPath (item.Path, ConvertRevisionAction (item.Action), "")); } SvnRevision r = new SvnRevision (repo, (int) a.Revision, a.Time, a.Author, a.LogMessage, paths.ToArray ()); list.Add (r); }); return list; }
/// <summary> /// Get annotations for a versioned file. /// </summary> /// <returns> /// A <see cref="System.String"/> annotation for each line in file. /// </returns> public virtual Annotation[] GetAnnotations(Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd) { return(new Annotation[0]); }
public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor) { SvnMoveArgs args = new SvnMoveArgs (); BindMonitor (args, monitor); args.Force = force; lock (client) client.Move (srcPath, destPath, args); }
public abstract IEnumerable <SvnRevision> Log(Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd);
public override string GetUnifiedDiff (FilePath path1, SvnRevision revision1, FilePath path2, SvnRevision revision2, bool recursive) { SvnPathTarget t1 = new SvnPathTarget (path1, GetRevision (revision1)); SvnPathTarget t2 = new SvnPathTarget (path2, GetRevision (revision2)); SvnDiffArgs args = new SvnDiffArgs (); args.Depth = recursive ? SvnDepth.Infinity : SvnDepth.Children; MemoryStream ms = new MemoryStream (); lock (client) client.Diff (t1, t2, args, ms); ms.Position = 0; using (StreamReader sr = new StreamReader (ms)) { return sr.ReadToEnd (); } }
public abstract IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus);
public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus) { List<VersionInfo> list = new List<VersionInfo> (); SvnStatusArgs args = new SvnStatusArgs (); args.Revision = GetRevision (revision); args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children; args.RetrieveAllEntries = !changedItemsOnly; args.RetrieveRemoteStatus = remoteStatus; lock (client) client.Status (path, args, delegate (object o, SvnStatusEventArgs a) { list.Add (CreateVersionInfo (repo, a)); }); return list; }
public abstract IEnumerable<DirectoryEntry> ListUrl (string url, bool recurse, SvnRevision rev);
static VersionInfo CreateVersionInfo (Repository repo, SvnStatusEventArgs ent) { VersionStatus rs = VersionStatus.Unversioned; Revision rr = null; // TODO: Fix remote status for Win32 Svn. if (ent.IsRemoteUpdated) { rs = ConvertStatus (SvnSchedule.Normal, ent.RemoteContentStatus); rr = new SvnRevision (repo, (int) ent.RemoteUpdateRevision, ent.RemoteUpdateCommitTime, ent.RemoteUpdateCommitAuthor, "(unavailable)", null); } SvnSchedule sched = ent.WorkingCopyInfo != null ? ent.WorkingCopyInfo.Schedule : SvnSchedule.Normal; VersionStatus status = ConvertStatus (sched, ent.LocalContentStatus); bool readOnly = File.Exists (ent.FullPath) && (File.GetAttributes (ent.FullPath) & FileAttributes.ReadOnly) != 0; if (ent.WorkingCopyInfo != null) { if (ent.RemoteLock != null || ent.WorkingCopyInfo.LockToken != null) { status |= VersionStatus.LockRequired; if (ent.WorkingCopyInfo.LockToken != null || (ent.RemoteLock != null && ent.RemoteLock.Token != null)) status |= VersionStatus.LockOwned; else status |= VersionStatus.Locked; } else if (readOnly) status |= VersionStatus.LockRequired; } string repoPath = ent.Uri != null ? ent.Uri.ToString () : null; SvnRevision newRev = null; if (ent.WorkingCopyInfo != null) newRev = new SvnRevision (repo, (int) ent.WorkingCopyInfo.Revision); VersionInfo ret = new VersionInfo (ent.FullPath, repoPath, ent.NodeKind == SvnNodeKind.Directory, status, newRev, rs, rr); return ret; }
public abstract string GetUnifiedDiff (FilePath path1, SvnRevision revision1, FilePath path2, SvnRevision revision2, bool recursive);
public override Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd) { if (file == FilePath.Null) throw new ArgumentNullException (); SvnPathTarget target = new SvnPathTarget (file, SharpSvn.SvnRevision.Base); MemoryStream data = new MemoryStream (); int numAnnotations = 0; client.Write (target, data); using (StreamReader reader = new StreamReader (data)) { reader.BaseStream.Seek (0, SeekOrigin.Begin); while (reader.ReadLine () != null) numAnnotations++; } System.Collections.ObjectModel.Collection<SvnBlameEventArgs> list; SvnBlameArgs args = new SvnBlameArgs (); args.Start = GetRevision (revStart); args.End = GetRevision (revEnd); if (client.GetBlame (target, args, out list)) { Annotation[] annotations = new Annotation [numAnnotations]; foreach (var annotation in list) { if (annotation.LineNumber < annotations.Length) annotations [(int)annotation.LineNumber] = new Annotation (annotation.Revision.ToString (), annotation.Author, annotation.Time); } return annotations; } return new Annotation[0]; }
public abstract IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revisionStart, SvnRevision revisionEnd);
public override IEnumerable <VersionInfo> Status(Repository repo, FilePath path, SvnRevision revision, bool descendDirs, bool changedItemsOnly, bool remoteStatus) { var list = new List <VersionInfo> (); var args = new SvnStatusArgs(); args.Revision = GetRevision(revision); args.Depth = descendDirs ? SvnDepth.Infinity : SvnDepth.Children; args.RetrieveAllEntries = !changedItemsOnly; args.RetrieveRemoteStatus = remoteStatus; lock (client) { try { client.Status(path, args, (o, a) => list.Add(CreateVersionInfo(repo, a))); } catch (SvnInvalidNodeKindException e) { if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_WORKING_COPY) { list.Add(VersionInfo.CreateUnversioned(e.File, true)); } else if (e.SvnErrorCode == SvnErrorCode.SVN_ERR_WC_NOT_FILE) { list.Add(VersionInfo.CreateUnversioned(e.File, false)); } else { throw; } } } return(list); }