本文整理汇总了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));
}
}
示例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 });
}
}