本文整理汇总了C#中SvnRevision类的典型用法代码示例。如果您正苦于以下问题:C# SvnRevision类的具体用法?C# SvnRevision怎么用?C# SvnRevision使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SvnRevision类属于命名空间,在下文中一共展示了SvnRevision类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SafeParse
public static SvnRevision SafeParse(string expression)
{
SvnRevision revision = new SvnRevision(SvnRevisionType.Head);
// check revision number
long revNumber;
if (long.TryParse(expression, out revNumber))
{
revision = new SvnRevision(revNumber);
}
else
{
// check revision date
DateTime revDate;
if (DateTime.TryParse(expression, out revDate))
{
revision = new SvnRevision(revDate);
}
else
{
// check for revision type
SvnRevisionType revisionType;
if (SvnRevisionType.TryParse(expression, true, out revisionType))
{
revision = new SvnRevision(revisionType);
}
}
}
return revision;
}
示例2: Revision_SvnRevisionTypes
public void Revision_SvnRevisionTypes()
{
SvnRevision r = new SvnRevision(DateTime.Now);
Assert.That(r.RevisionType, Is.EqualTo(SvnRevisionType.Time));
r = new SvnRevision(42);
Assert.That(r.RevisionType, Is.EqualTo(SvnRevisionType.Number));
r = 42;
Assert.That(r.RevisionType, Is.EqualTo(SvnRevisionType.Number));
Assert.That(SvnRevision.Base.RevisionType, Is.EqualTo(SvnRevisionType.Base));
Assert.That(SvnRevision.Committed.RevisionType, Is.EqualTo(SvnRevisionType.Committed));
Assert.That(SvnRevision.Head.RevisionType, Is.EqualTo(SvnRevisionType.Head));
Assert.That(SvnRevision.Previous.RevisionType, Is.EqualTo(SvnRevisionType.Previous));
Assert.That(SvnRevision.None.RevisionType, Is.EqualTo(SvnRevisionType.None));
Assert.That(SvnRevision.Working.RevisionType, Is.EqualTo(SvnRevisionType.Working));
}
示例3: Log
public override IEnumerable<SvnRevision> Log (Repository repo, FilePath path, SvnRevision revStart, SvnRevision revEnd)
{
if (path == FilePath.Null)
throw new ArgumentNullException ();
LibSvnClient.Rev revisionStart = (LibSvnClient.Rev) revStart;
LibSvnClient.Rev revisionEnd = (LibSvnClient.Rev) revEnd;
List<SvnRevision> ret = new List<SvnRevision> ();
IntPtr localpool = newpool (pool);
IntPtr strptr = IntPtr.Zero;
try {
IntPtr array = apr.array_make (localpool, 0, IntPtr.Size);
IntPtr first = apr.array_push (array);
string pathorurl = NormalizePath (path, localpool);
strptr = Marshal.StringToHGlobalAnsi (pathorurl);
Marshal.WriteIntPtr (first, strptr);
LogCollector collector = new LogCollector (ret);
CheckError (svn.client_log (array, ref revisionStart, ref revisionEnd, 1, 0,
new LibSvnClient.svn_log_message_receiver_t (collector.Func),
IntPtr.Zero, ctx, localpool));
} finally {
if (strptr != IntPtr.Zero)
Marshal.FreeHGlobal (strptr);
apr.pool_destroy (localpool);
}
return ret;
}
示例4: Move
public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, ProgressMonitor monitor)
{
if (srcPath == FilePath.Null || destPath == FilePath.Null || monitor == null)
throw new ArgumentNullException ();
LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
nb = new notify_baton ();
IntPtr commit_info = IntPtr.Zero;
IntPtr localpool = IntPtr.Zero;
try {
localpool = TryStartOperation (monitor);
string nsrcPath = NormalizePath (srcPath, localpool);
string ndestPath = NormalizePath (destPath, localpool);
CheckError (svn.client_move (ref commit_info, nsrcPath, ref revision,
ndestPath, force, ctx, localpool));
} finally {
TryEndOperation (localpool);
}
}
示例5: GetAnnotations
public override Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd)
{
if (file == FilePath.Null)
throw new ArgumentNullException ();
LibSvnClient.Rev revisionStart = (LibSvnClient.Rev) revStart;
LibSvnClient.Rev revisionEnd = (LibSvnClient.Rev) revEnd;
MemoryStream data = new MemoryStream ();
int numAnnotations = 0;
Cat (file, SvnRevision.Base, data);
using (StreamReader reader = new StreamReader (data)) {
reader.BaseStream.Seek (0, SeekOrigin.Begin);
while (reader.ReadLine () != null)
numAnnotations++;
}
Annotation[] annotations = new Annotation [numAnnotations];
AnnotationCollector collector = new AnnotationCollector (annotations, repo);
IntPtr localpool = IntPtr.Zero;
try {
localpool = TryStartOperation (null);
string path = NormalizePath (file.FullPath, localpool);
CheckError (svn.client_blame (path, ref revisionStart, ref revisionEnd, collector.Func, IntPtr.Zero, ctx, localpool));
} finally {
TryEndOperation (localpool);
}
return annotations;
}
示例6: Status
public override IEnumerable<VersionInfo> Status (Repository repo, FilePath path, SvnRevision rev, bool descendDirs, bool changedItemsOnly, bool remoteStatus)
{
if (path == FilePath.Null)
throw new ArgumentNullException ();
LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
ArrayList ret = new ArrayList ();
StatusCollector collector = new StatusCollector (ret);
IntPtr localpool = IntPtr.Zero;
try {
localpool = TryStartOperation (null);
string pathorurl = NormalizePath (path, localpool);
CheckError (svn.client_status (IntPtr.Zero, pathorurl, ref revision,
collector.Func,
IntPtr.Zero, descendDirs,
!changedItemsOnly,
remoteStatus,
false,
false,
ctx, localpool));
} catch (SubversionException e) {
// SVN_ERR_WC_NOT_WORKING_COPY and SVN_ERR_WC_NOT_FILE.
if (e.ErrorCode != 155007 && e.ErrorCode != 155008)
throw;
} finally {
TryEndOperation (localpool);
}
List<VersionInfo> nodes = new List<VersionInfo>();
foreach (LibSvnClient.StatusEnt ent in ret)
nodes.Add (CreateNode (ent, repo));
return nodes;
}
示例7: List
public override IEnumerable<DirectoryEntry> List (FilePath path, bool recurse, SvnRevision rev)
{
return ListUrl (path, recurse, rev);
}
示例8: CreateNode
static VersionInfo CreateNode (LibSvnClient.StatusEnt ent, Repository repo)
{
VersionStatus rs = VersionStatus.Unversioned;
Revision rr = null;
if (ent.RemoteTextStatus != LibSvnClient.svn_wc_status_kind.EMPTY) {
rs = ConvertStatus (LibSvnClient.NodeSchedule.Normal, ent.RemoteTextStatus);
rr = new SvnRevision (repo, ent.LastCommitRevision, ent.LastCommitDate,
ent.LastCommitAuthor, GettextCatalog.GetString ("(unavailable)"), null);
}
VersionStatus status = ConvertStatus (ent.Schedule, ent.TextStatus);
bool readOnly = File.Exists (ent.LocalFilePath) && (File.GetAttributes (ent.LocalFilePath) & FileAttributes.ReadOnly) != 0;
if (ent.RepoLocked) {
status |= VersionStatus.LockRequired;
if (ent.LockOwned)
status |= VersionStatus.LockOwned;
else
status |= VersionStatus.Locked;
} else if (readOnly)
status |= VersionStatus.LockRequired;
VersionInfo ret = new VersionInfo (ent.LocalFilePath, ent.Url, ent.IsDirectory,
status, new SvnRevision (repo, ent.Revision),
rs, rr);
return ret;
}
示例9: CheckoutSvn
private void CheckoutSvn(SvnRevision revision)
{
m_svnClient.Checkout2(m_svnurl, m_svndir, revision, revision, true, false);
}
示例10: Checkout
private int Checkout(string repoUrl, string workingPath, SvnRevision revision, bool recurse, bool ignoreExternals)
{
try
{
SvnCheckOutArgs args = new SvnCheckOutArgs();
args.Revision = revision;
args.IgnoreExternals = ignoreExternals;
args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
SvnUpdateResult result;
client.CheckOut(new Uri(repoUrl), workingPath, args, out result);
return (int) result.Revision;
}
catch (Exception ex)
{
OnError(ex);
}
return int.MinValue;
}
示例11: CreateSvnUriTarget
private static SvnUriTarget CreateSvnUriTarget(string uriString, SvnRevision revision)
{
Uri uri = new Uri(uriString);
SvnUriTarget target = new SvnUriTarget(uri, revision);
return target;
}
示例12: SimpleRevisionType
public SimpleRevisionType(SvnRevision rev, string title)
{
if (rev == null)
throw new ArgumentNullException("rev");
else if (string.IsNullOrEmpty(title))
throw new ArgumentNullException("title");
_rev = rev;
_title = title;
}
示例13: Move
public override void Move (FilePath srcPath, FilePath destPath, SvnRevision rev, bool force, IProgressMonitor monitor)
{
if (srcPath == FilePath.Null || destPath == FilePath.Null || monitor == null)
throw new ArgumentNullException ();
LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
lock (sync) {
if (inProgress)
throw new SubversionException ("Another Subversion operation is already in progress.");
inProgress = true;
}
nb = new notify_baton ();
updatemonitor = monitor;
IntPtr commit_info = IntPtr.Zero;
IntPtr localpool = newpool (pool);
try {
string nsrcPath = NormalizePath (srcPath, localpool);
string ndestPath = NormalizePath (destPath, localpool);
CheckError (svn.client_move (ref commit_info, nsrcPath, ref revision,
ndestPath, (force ? 1 : 0), ctx, localpool));
} finally {
apr.pool_destroy (localpool);
updatemonitor = null;
inProgress = false;
}
}
示例14: Cat
public void Cat (string pathorurl, SvnRevision rev, Stream stream)
{
if (pathorurl == null || stream == null)
throw new ArgumentNullException ();
LibSvnClient.Rev revision = (LibSvnClient.Rev) rev;
IntPtr localpool = newpool (pool);
try {
pathorurl = NormalizePath (pathorurl, localpool);
StreamCollector collector = new StreamCollector (stream);
IntPtr svnstream = svn.stream_create (IntPtr.Zero, localpool);
svn.stream_set_write (svnstream, new LibSvnClient.svn_readwrite_fn_t (collector.Func));
LibSvnClient.Rev peg_revision = LibSvnClient.Rev.Blank;
CheckError (svn.client_cat2 (svnstream, pathorurl, ref peg_revision, ref revision, ctx, localpool));
} finally {
apr.pool_destroy (localpool);
}
}
示例15: GetAnnotations
public override Annotation[] GetAnnotations (Repository repo, FilePath file, SvnRevision revStart, SvnRevision revEnd)
{
if (file == FilePath.Null)
throw new ArgumentNullException ();
LibSvnClient.Rev revisionStart = (LibSvnClient.Rev) revStart;
LibSvnClient.Rev revisionEnd = (LibSvnClient.Rev) revEnd;
int numAnnotations = File.ReadAllLines (((SubversionRepository)repo).GetPathToBaseText(file)).Length;
Annotation[] annotations = new Annotation [numAnnotations];
AnnotationCollector collector = new AnnotationCollector (annotations);
IntPtr localpool = newpool (pool);
try {
string path = NormalizePath (file.FullPath, localpool);
CheckError (svn.client_blame (path, ref revisionStart, ref revisionEnd, new LibSvnClient.svn_client_blame_receiver_t (collector.Func), IntPtr.Zero, ctx, localpool));
} finally {
apr.pool_destroy (localpool);
}
return annotations;
}