本文整理汇总了C#中SvnRevision类的典型用法代码示例。如果您正苦于以下问题:C# SvnRevision类的具体用法?C# SvnRevision怎么用?C# SvnRevision使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SvnRevision类属于命名空间,在下文中一共展示了SvnRevision类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:trentcioran,项目名称:SvnMSBuildTasks,代码行数:30,代码来源:RevisionParser.cs
示例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));
}
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:18,代码来源:RevisionTests.cs
示例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;
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:31,代码来源:SvnClient.cs
示例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);
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:20,代码来源:SvnClient.cs
示例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;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:32,代码来源:SvnClient.cs
示例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;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:34,代码来源:SvnClient.cs
示例7: List
public override IEnumerable<DirectoryEntry> List (FilePath path, bool recurse, SvnRevision rev)
{
return ListUrl (path, recurse, rev);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:4,代码来源:SvnClient.cs
示例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;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:29,代码来源:SvnClient.cs
示例9: CheckoutSvn
private void CheckoutSvn(SvnRevision revision)
{
m_svnClient.Checkout2(m_svnurl, m_svndir, revision, revision, true, false);
}
开发者ID:N3X15,项目名称:VoxelSim,代码行数:4,代码来源:SvnBackupModule.cs
示例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;
}
开发者ID:mgfreshour,项目名称:VersionOne-SVN-Integration-Mod,代码行数:18,代码来源:SvnConnector.cs
示例11: CreateSvnUriTarget
private static SvnUriTarget CreateSvnUriTarget(string uriString, SvnRevision revision)
{
Uri uri = new Uri(uriString);
SvnUriTarget target = new SvnUriTarget(uri, revision);
return target;
}
开发者ID:mgfreshour,项目名称:VersionOne-SVN-Integration-Mod,代码行数:6,代码来源:SvnConnector.cs
示例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;
}
开发者ID:necora,项目名称:ank_git,代码行数:10,代码来源:VersionResolverService.cs
示例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;
}
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:28,代码来源:SvnClient.cs
示例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);
}
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:19,代码来源:SvnClient.cs
示例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;
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:24,代码来源:SvnClient.cs
示例16: PerformCheckout
private static void PerformCheckout(ProgressWorkerArgs e, SvnUriTarget projectTop, SvnRevision revision, string localDir)
{
SvnCheckOutArgs a = new SvnCheckOutArgs();
a.Revision = revision;
e.Client.CheckOut(projectTop, localDir, a);
}
开发者ID:necora,项目名称:ank_git,代码行数:7,代码来源:OpenFromSubversion.cs
示例17: PropertyEditorDialog
public PropertyEditorDialog(Uri target, SvnRevision revision, bool revisionProps)
: this(revisionProps ? string.Format(PropertyEditStrings.RevisionXPropertiesFromY, revision, target) : target.ToString())
{
_currentNodeKind = SvnNodeKind.None;
_revisionProps = revisionProps;
}
开发者ID:necora,项目名称:ank_git,代码行数:6,代码来源:PropertyEditorDialog.cs
示例18: GetProperties
private PropertiesCollection GetProperties(string target, SvnRevision asOfRevision, bool recurse)
{
try
{
PropertiesCollection result = new PropertiesCollection();
Collection<SvnPropertyListEventArgs> output;
SvnPropertyListArgs args = new SvnPropertyListArgs();
args.Revision = asOfRevision;
args.Depth = recurse ? SvnDepth.Infinity : SvnDepth.Children;
client.GetPropertyList(new Uri(target), args, out output);
foreach (SvnPropertyListEventArgs eventArgs in output) {
Dictionary<string, string> properties = new Dictionary<string, string>(eventArgs.Properties.Count);
foreach (SvnPropertyValue value in eventArgs.Properties) {
properties.Add(value.Key, value.StringValue);
}
result.Add(eventArgs.Path, properties);
}
return result;
}
catch(Exception ex)
{
OnError(ex);
}
return null;
}
开发者ID:mgfreshour,项目名称:VersionOne-SVN-Integration-Mod,代码行数:29,代码来源:SvnConnector.cs
示例19: CollectorFunc
IntPtr CollectorFunc (IntPtr baton, IntPtr apr_hash_changed_paths, svn_revnum_t revision, IntPtr author, IntPtr date, IntPtr message, IntPtr pool)
{
long time;
svn.time_from_cstring (out time, Marshal.PtrToStringAnsi (date), pool);
string smessage = "";
if (message != IntPtr.Zero)
smessage = Marshal.PtrToStringAnsi (message);
if (smessage != null)
smessage = smessage.Trim ();
List<RevisionPath> items = new List<RevisionPath>();
IntPtr item = apr.hash_first (pool, apr_hash_changed_paths);
while (item != IntPtr.Zero) {
IntPtr nameptr, val;
int namelen;
apr.hash_this (item, out nameptr, out namelen, out val);
string name = Marshal.PtrToStringAnsi (nameptr);
LibSvnClient.svn_log_changed_path_t ch = (LibSvnClient.svn_log_changed_path_t) Marshal.PtrToStructure (val, typeof(LibSvnClient.svn_log_changed_path_t));
item = apr.hash_next (item);
RevisionAction ac;
switch (ch.action) {
case 'A': ac = RevisionAction.Add; break;
case 'D': ac = RevisionAction.Delete; break;
case 'R': ac = RevisionAction.Replace; break;
default: ac = RevisionAction.Modify; break; // should be an 'M'
}
IntPtr result = IntPtr.Zero;
SvnClient.CheckError (svn.client_root_url_from_path (ref result, repo.RootPath, ctx, pool));
if (result == IntPtr.Zero) // Should never happen
items.Add (new RevisionPath (name, ac, ""));
else
items.Add (new RevisionPath (Marshal.PtrToStringAnsi (result) + "/" + name, ac, ""));
}
SvnRevision ent = new SvnRevision (null, (int) revision, Epoch.AddTicks (time * 10), Marshal.PtrToStringAnsi (author), smessage, items.ToArray ());
logs.Add (ent);
return IntPtr.Zero;
}
开发者ID:sheff146,项目名称:monodevelop,代码行数:46,代码来源:SvnClient.cs
示例20: GetRevisionProperties
private RevisionPropertyCollection GetRevisionProperties(string url, SvnRevision revision)
{
try
{
SvnPropertyCollection propertyCollection;
client.GetRevisionPropertyList(CreateSvnUriTarget(url, revision), out propertyCollection);
RevisionPropertyCollection revisionPropertyCollection = new RevisionPropertyCollection((int)revision.Revision);
foreach (SvnPropertyValue value in propertyCollection) {
revisionPropertyCollection.Add(value.Key, value.StringValue);
}
return revisionPropertyCollection;
}
catch(Exception ex)
{
OnError(ex);
}
return null;
}
开发者ID:mgfreshour,项目名称:VersionOne-SVN-Integration-Mod,代码行数:19,代码来源:SvnConnector.cs
注:本文中的SvnRevision类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论