当前位置: 首页>>代码示例>>C#>>正文


C# SvnRevision.ToString方法代码示例

本文整理汇总了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;
        }
开发者ID:necora,项目名称:ank_git,代码行数:42,代码来源:LocalDiffCommandBase.cs

示例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;
        }
开发者ID:necora,项目名称:ank_git,代码行数:7,代码来源:AnkhDiff.cs

示例3: PathSafeRevision

 static string PathSafeRevision(SvnRevision revision)
 {
     if (revision.RevisionType == SvnRevisionType.Time)
         return revision.Time.ToLocalTime().ToString("yyyyMMdd_hhmmss");
     return revision.ToString();
 }
开发者ID:necora,项目名称:ank_git,代码行数:6,代码来源:AnkhDiff.cs

示例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"));
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:27,代码来源:RevisionTests.cs


注:本文中的SvnRevision.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。