本文整理汇总了C#中SvnRevision.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SvnRevision.ToString方法的具体用法?C# SvnRevision.ToString怎么用?C# SvnRevision.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnRevision
的用法示例。
在下文中一共展示了SvnRevision.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPath
private static string GetPath(IAnkhServiceProvider context, SvnRevision revision, SvnItem item, string tempDir)
{
if (revision == SvnRevision.Working)
{
return item.FullPath;
}
string strRevision;
if (revision.RevisionType == SvnRevisionType.Time)
strRevision = revision.Time.ToLocalTime().ToString("yyyyMMdd_hhmmss");
else
strRevision = revision.ToString();
string tempFile = Path.GetFileNameWithoutExtension(item.Name) + "." + strRevision + Path.GetExtension(item.Name);
tempFile = Path.Combine(tempDir, tempFile);
// we need to get it from the repos
context.GetService<IProgressRunner>().RunModal("Retrieving file for diffing", delegate(object o, ProgressWorkerArgs ee)
{
SvnTarget target;
switch(revision.RevisionType)
{
case SvnRevisionType.Head:
case SvnRevisionType.Number:
case SvnRevisionType.Time:
target = new SvnUriTarget(item.Uri);
break;
default:
target = new SvnPathTarget(item.FullPath);
break;
}
SvnWriteArgs args = new SvnWriteArgs();
args.Revision = revision;
args.AddExpectedError(SvnErrorCode.SVN_ERR_CLIENT_UNRELATED_RESOURCES);
using (FileStream stream = File.Create(tempFile))
{
ee.Client.Write(target, stream, args);
}
});
return tempFile;
}
示例2: GetTitle
static string GetTitle(string fileName, SvnRevision revision)
{
string strRev = revision.RevisionType == SvnRevisionType.Time ?
revision.Time.ToLocalTime().ToString("g") : revision.ToString();
return fileName + " - " + strRev;
}
示例3: PathSafeRevision
static string PathSafeRevision(SvnRevision revision)
{
if (revision.RevisionType == SvnRevisionType.Time)
return revision.Time.ToLocalTime().ToString("yyyyMMdd_hhmmss");
return revision.ToString();
}
示例4: Revision_ToString
public void Revision_ToString()
{
SvnRevision revision = SvnRevision.Base;
Assert.That(revision.ToString(), Is.EqualTo("BASE"));
revision = SvnRevision.Committed;
Assert.That(revision.ToString(), Is.EqualTo("COMMITTED"));
revision = SvnRevision.Head;
Assert.That(revision.ToString(), Is.EqualTo("HEAD"));
revision = SvnRevision.Previous;
Assert.That(revision.ToString(), Is.EqualTo("PREVIOUS"));
revision = SvnRevision.None;
Assert.That(revision.ToString(), Is.EqualTo(""));
revision = SvnRevision.Working;
Assert.That(revision.ToString(), Is.EqualTo("WORKING"));
DateTime t = DateTime.UtcNow;
revision = new SvnRevision(t);
Assert.That(revision.ToString(), Is.EqualTo("{" + t.ToString("s", CultureInfo.InvariantCulture) + "}"));
revision = new SvnRevision(42);
Assert.That(revision.ToString(), Is.EqualTo("42"));
}