private static SvnRevisionRange CreateSvnRevisionRangeBy(RevisionRange revisionRange) { SvnRevisionId fromChangeset = revisionRange.FromChangeset; SvnRevisionId toChangeSet = revisionRange.ToChangeset; return(new SvnRevisionRange(fromChangeset.Value, toChangeSet.Value)); }
private MemoryStream GetSVNFileStream(SvnRevisionId changeset, string path) { var memoryStream = new MemoryStream(); SvnTarget target; //If you use Uri you should encode '#' as %23, as Uri's define the # as Fragment separator. //And in this case the fragment is not send to the server. path = path.Replace("#", "%23"); if (SvnTarget.TryParse(GetPath(path).AbsolutePath, out target)) { if (FileWasDeleted(path, changeset)) { return(new MemoryStream()); } var uriTarget = new SvnUriTarget(_root + path, changeset.Value); var svnWriteArgs = new SvnWriteArgs { Revision = changeset.Value }; Client.Write(uriTarget, memoryStream, svnWriteArgs); return(memoryStream); } return(new MemoryStream()); }
bool ICompareRevisionSecondArg.Belong(RevisionRange revisionRange) { SvnRevisionId fromChangeset = revisionRange.FromChangeset; SvnRevisionId toChangeset = revisionRange.ToChangeset; return(fromChangeset.Value <= _firstArg.Value && _firstArg.Value <= toChangeset.Value); }
private static RevisionRange[] GetFromTo(SvnRevisionId @from, SvnRevisionId lastRevision, int pageSize) { var result = new List <RevisionRange>(); while (from.Value <= lastRevision.Value) { var fromRevisionId = from; RevisionRange revisionRange; var fromRevision = fromRevisionId; if ((fromRevisionId.Value + pageSize) < lastRevision.Value) { revisionRange = new RevisionRange(fromRevision, new RevisionId { Value = (fromRevisionId.Value + pageSize - 1).ToString() }); } else { revisionRange = new RevisionRange(fromRevision, lastRevision); } result.Add(revisionRange); from = new SvnRevisionId(fromRevisionId.Value + pageSize); } return(result.ToArray()); }
public override RevisionRange[] GetAfterTillHead(RevisionId @from, int pageSize) { SvnRevisionId svnRevisionId = from; svnRevisionId = svnRevisionId.Value + 1; return(GetFromTillHead(svnRevisionId, pageSize)); }
public void ShouldRetrieve() { var settings = GetLocalRepositorySettings(); settings.Uri = new Uri("http://svn.apache.org/repos/asf/spamassassin/trunk").ToString(); var vcs = new Subversion(settings, ObjectFactory.GetInstance<ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance<IActivityLogger>(), ObjectFactory.GetInstance<IDiffProcessor>()); var svnRevisionId = new SvnRevisionId(1000000); var endRevision = vcs.GetFromTillHead(svnRevisionId, 50); var result = vcs.GetRevisions(endRevision.Last()); result.Should(Be.Not.Empty); }
public void ShouldRetrieve() { var settings = GetLocalRepositorySettings(); settings.Uri = new Uri("http://svn.apache.org/repos/asf/spamassassin/trunk").ToString(); var vcs = new Subversion(settings, ObjectFactory.GetInstance <ICheckConnectionErrorResolver>(), ObjectFactory.GetInstance <IActivityLogger>(), ObjectFactory.GetInstance <IDiffProcessor>()); var svnRevisionId = new SvnRevisionId(1000000); var endRevision = vcs.GetFromTillHead(svnRevisionId, 50); var result = vcs.GetRevisions(endRevision.Last()); result.Should(Be.Not.Empty); }
public override DiffResult GetDiff(RevisionId changeset, string path) { var revisionId = new SvnRevisionId(changeset); var previousRevisionId = ((revisionId).Value - 1).ToString(); try { return(GetDiff(changeset, path, previousRevisionId)); } catch (SvnFileSystemException ex) { throw new VersionControlException(String.Format("Subversion exception: {0}", ex.Message)); } }
private bool FileWasDeleted(string path, SvnRevisionId changeset) { var revisionId = new RevisionId { Value = changeset.Value.ToString() }; var arg = new SvnLogArgs(CreateSvnRevisionRangeBy(new RevisionRange(revisionId, revisionId))) { BaseUri = new Uri(_root), ThrowOnError = true }; var revisions = GetSvnRevisions(arg); var item = revisions[0].ChangedPaths.FirstOrDefault(itemCollection => itemCollection.Path == path); return(item != null && item.Action == SvnChangeAction.Delete); }
public override RevisionInfo[] GetRevisions(RevisionRange revisionRange) { try { SvnRevisionId fromChangeset = revisionRange.FromChangeset; SvnRevisionId toChangeset = revisionRange.ToChangeset; _logger.DebugFormat("Getting revision infos [{0}:{1}]", fromChangeset, toChangeset); var arg = new SvnLogArgs(new SvnRevisionRange(fromChangeset.Value, toChangeset.Value)) { ThrowOnError = true }; return(SubversionUtils.ArrayOfSvnRevisionToArrayOfRevisionInfo(GetSvnRevisions(arg), this).ToArray()); } catch (SvnException e) { throw new VersionControlException(String.Format("Subversion exception: {0}", e.Message), e); } }
private MemoryStream GetSVNFileStream(SvnRevisionId changeset, string path) { var memoryStream = new MemoryStream(); SvnTarget target; //If you use Uri you should encode '#' as %23, as Uri's define the # as Fragment separator. //And in this case the fragment is not send to the server. path = path.Replace("#", "%23"); if (SvnTarget.TryParse(GetPath(path).AbsolutePath, out target)) { if (FileWasDeleted(path, changeset)) { return new MemoryStream(); } var uriTarget = new SvnUriTarget(_root + path, changeset.Value); var svnWriteArgs = new SvnWriteArgs {Revision = changeset.Value}; Client.Write(uriTarget, memoryStream, svnWriteArgs); return memoryStream; } return new MemoryStream(); }
bool ICompareRevisionSecondArg.Behind(RevisionRange revisionRange) { SvnRevisionId toChangeSet = revisionRange.ToChangeset; return(_firstArg.Value > toChangeSet.Value); }
bool ICompareRevisionSecondArg.GreaterThan(RevisionId revisionId) { SvnRevisionId svnRevisionId = revisionId; return(_firstArg.Value > svnRevisionId.Value); }
bool ICompareRevisionSecondArg.LessThan(RevisionId revisionId) { SvnRevisionId svnRevisionId = revisionId; return(_firstArg.Value < svnRevisionId.Value); }
public override DiffResult GetDiff(RevisionId changeset, string path) { var revisionId = new SvnRevisionId(changeset); var previousRevisionId = ((revisionId).Value - 1).ToString(); try { return GetDiff(changeset, path, previousRevisionId); } catch (SvnFileSystemException ex) { throw new VersionControlException(String.Format("Subversion exception: {0}", ex.Message)); } }
private static RevisionRange[] GetFromTo(SvnRevisionId @from, SvnRevisionId lastRevision, int pageSize) { var result = new List<RevisionRange>(); while (from.Value <= lastRevision.Value) { var fromRevisionId = from; RevisionRange revisionRange; var fromRevision = fromRevisionId; if ((fromRevisionId.Value + pageSize) < lastRevision.Value) { revisionRange = new RevisionRange(fromRevision, new RevisionId {Value = (fromRevisionId.Value + pageSize - 1).ToString()}); } else { revisionRange = new RevisionRange(fromRevision, lastRevision); } result.Add(revisionRange); from = new SvnRevisionId(fromRevisionId.Value + pageSize); } return result.ToArray(); }
bool ICompareRevisionSecondArg.Before(RevisionRange revisionRange) { SvnRevisionId fromChangeSet = revisionRange.FromChangeset; return(_firstArg.Value < fromChangeSet.Value); }
public override RevisionRange[] GetFromAndBefore(RevisionId @from, RevisionId to, int pageSize) { SvnRevisionId lastRevision = ((SvnRevisionId)to).Value - 1; return(GetFromTo(@from, lastRevision, pageSize)); }
public ICompareRevisionSecondArg Does(RevisionId firstArg) { _firstArg = firstArg; return this; }
private bool FileWasDeleted(string path, SvnRevisionId changeset) { var revisionId = new RevisionId {Value = changeset.Value.ToString()}; var arg = new SvnLogArgs(CreateSvnRevisionRangeBy(new RevisionRange(revisionId, revisionId))) {BaseUri = new Uri(_root), ThrowOnError = true}; var revisions = GetSvnRevisions(arg, String.Empty); var item = revisions[0].ChangedPaths.FirstOrDefault(itemCollection => itemCollection.Path == path); return item != null && item.Action == SvnChangeAction.Delete; }
public ICompareRevisionSecondArg Does(RevisionId firstArg) { _firstArg = firstArg; return(this); }