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


C# SvnClient.RepositoryOperation方法代码示例

本文整理汇总了C#中SvnClient.RepositoryOperation方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.RepositoryOperation方法的具体用法?C# SvnClient.RepositoryOperation怎么用?C# SvnClient.RepositoryOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SvnClient的用法示例。


在下文中一共展示了SvnClient.RepositoryOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RepositoryOperation_ViaSvnClient

        public void RepositoryOperation_ViaSvnClient()
        {
            SvnSandBox sbox = new SvnSandBox(this);

            Uri uri = sbox.CreateRepository(SandBoxRepository.Empty);

            using (SvnClient svn = new SvnClient())
            {
                SvnCommitResult cr;

                Assert.That(svn.RepositoryOperation(uri,
                    delegate(SvnMultiCommandClient mucc)
                    {
                        //mucc.
                    }, out cr));

                Assert.That(cr, Is.Null);

                svn.Configuration.LogMessageRequired = false;

                Assert.That(svn.RepositoryOperation(uri,
                    delegate(SvnMultiCommandClient mucc)
                    {
                        mucc.SetProperty("", "A", "B");

                    }, out cr));

                Assert.That(cr, Is.Not.Null);
                Assert.That(cr.Revision, Is.EqualTo(1));
            }
        }
开发者ID:riiiqpl,项目名称:sharpsvn,代码行数:31,代码来源:RepositoryOperationTests.cs

示例2: VssLabel

        public void VssLabel(string name, string taggerName, string taggerEmail, string comment, DateTime localTime, string taggedPath)
        {
            using (var client = new SvnClient())
            {
                SvnUI.Bind(client, parentWindow);

                var codeBasePath = useSvnStandardDirStructure ? this.trunkPath : workingCopyPath;
                var relativePath = taggedPath.StartsWith(codeBasePath) ? taggedPath.Substring(codeBasePath.Length) : null;
                if (relativePath == null || client.GetUriFromWorkingCopy(taggedPath) == null)
                    throw new ArgumentException(string.Format("invalid path {0}", taggedPath));

                var fullLabelPath = Path.Combine(labelPath, name + relativePath);

                Uri repositoryRootUri = client.GetUriFromWorkingCopy(workingCopyPath);

                var codeBaseUri = client.GetUriFromWorkingCopy(codeBasePath);
                var labelBaseUri = client.GetUriFromWorkingCopy(labelPath);

                var relativeSourceUri = new Uri(taggedPath.Substring(workingCopyPath.Length), UriKind.Relative);
                relativeSourceUri = repositoryRootUri.MakeRelativeUri(new Uri(repositoryRootUri, relativeSourceUri));

                var relativeLabelUri = new Uri(fullLabelPath.Substring(workingCopyPath.Length), UriKind.Relative);
                relativeLabelUri = repositoryRootUri.MakeRelativeUri(new Uri(repositoryRootUri, relativeLabelUri));

                var sourceUri = client.GetUriFromWorkingCopy(taggedPath);
                var labelUri = new Uri(labelBaseUri, name + "/" + sourceUri.ToString().Substring(codeBaseUri.ToString().Length));

                var fullLabelPathExists = client.GetUriFromWorkingCopy(fullLabelPath) != null;

                // check intermediate parents
                var intermediateParentNames = labelUri.ToString().Substring(labelBaseUri.ToString().Length).Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries).Reverse().Skip(1).Reverse();
                var intermediateParentRelativeUriToCreate = new List<string>();
                {
                    var intermediatePath = labelPath;
                    var intermediateUriPath = repositoryRootUri.MakeRelativeUri(labelBaseUri).ToString();
                    foreach (var parent in intermediateParentNames)
                    {
                        intermediatePath = Path.Combine(intermediatePath, parent);
                        intermediateUriPath += parent + "/";
                        if (client.GetUriFromWorkingCopy(intermediatePath) == null)
                            intermediateParentRelativeUriToCreate.Add(intermediateUriPath.Substring(0, intermediateUriPath.Length - 1));
                    }
                }

                // perform svn copy or svn delete + svn copy if necessary
                var result = true;
                var svnCommitResult = (SvnCommitResult)null;

                client.RepositoryOperation(repositoryRootUri, new SvnRepositoryOperationArgs { LogMessage = comment }, delegate (SvnMultiCommandClient muccClient)
                {
                    // if label path already exists, delete first
                    if (fullLabelPathExists)
                        result &= muccClient.Delete(Uri.UnescapeDataString(relativeLabelUri.ToString()));

                    // create intermediate parents if necessary
                    foreach (var parentRelativeUri in intermediateParentRelativeUriToCreate)
                        result &= muccClient.CreateDirectory(Uri.UnescapeDataString(parentRelativeUri));

                    result &= muccClient.Copy(Uri.UnescapeDataString(relativeSourceUri.ToString()), Uri.UnescapeDataString(relativeLabelUri.ToString()));

                }, out svnCommitResult);

                if (result)
                {
                    result &= client.SetRevisionProperty(svnCommitResult.RepositoryRoot, new SvnRevision(svnCommitResult.Revision), SvnPropertyNames.SvnAuthor, taggerName);
                    result &= client.SetRevisionProperty(svnCommitResult.RepositoryRoot, new SvnRevision(svnCommitResult.Revision), SvnPropertyNames.SvnDate, SvnPropertyNames.FormatDate(localTime));
                }

                result &= client.Update(workingCopyPath, new SvnUpdateArgs { AddsAsModifications = false, AllowObstructions = false, Depth = SvnDepth.Infinity, IgnoreExternals = true, KeepDepth = true, Revision = SvnRevision.Head, UpdateParents = false });

            }
        }
开发者ID:mathewng,项目名称:vss2svn,代码行数:72,代码来源:SvnWrapper.cs


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