本文整理汇总了C#中SvnClient.SetRevisionProperty方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.SetRevisionProperty方法的具体用法?C# SvnClient.SetRevisionProperty怎么用?C# SvnClient.SetRevisionProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.SetRevisionProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommitRevision
public void CommitRevision(string author, string comment, DateTime time)
{
using (var svn = new SvnClient())
{
// commit
var commitArgs = new SvnCommitArgs { LogMessage = "author: " + author + "\n" + comment };
SvnCommitResult cr;
svn.Commit(_wc, commitArgs, out cr);
if (cr == null)
{
Console.WriteLine(" Nothing to commit. Seems this revision was already added or contains only unimportant chnages ?");
return;
}
try
{
var revision = new SvnRevision(cr.Revision);
svn.SetRevisionProperty(_svnUri, revision, "svn:author", author);
svn.SetRevisionProperty(_svnUri, revision, "svn:log", comment);
svn.SetRevisionProperty(_svnUri, revision, "svn:date", time.ToString("o"));
}
catch (Exception ex)
{
_log.WriteLine("Change props error: {0}", ex);
}
}
}
示例2: Tag
public void Tag(string name, string taggerName, string taggerEmail, string comment, DateTime localTime, string taggedPath)
{
/*
TempFile commentFile;
var args = "tag";
AddComment(comment, ref args, out commentFile);
// tag names are not quoted because they cannot contain whitespace or quotes
args += " -- " + name;
using (commentFile)
{
var startInfo = GetStartInfo(args);
startInfo.EnvironmentVariables["GIT_COMMITTER_NAME"] = taggerName;
startInfo.EnvironmentVariables["GIT_COMMITTER_EMAIL"] = taggerEmail;
startInfo.EnvironmentVariables["GIT_COMMITTER_DATE"] = GetUtcTimeString(localTime);
ExecuteUnless(startInfo, null);
}
*/
using (var client = new SvnClient())
{
SvnUI.Bind(client, parentWindow);
var svnCopyArgs = new SvnCopyArgs { LogMessage = comment, CreateParents = true, AlwaysCopyAsChild = false };
var workingCopyUri = client.GetUriFromWorkingCopy(workingCopyPath);
var tagsUri = client.GetUriFromWorkingCopy(tagPath);
var sourceUri = useSvnStandardDirStructure ? client.GetUriFromWorkingCopy(trunkPath) : workingCopyUri;
var tagUri = new Uri(useSvnStandardDirStructure ? tagsUri : workingCopyUri, name);
var svnCommitResult = (SvnCommitResult)null;
var result = client.RemoteCopy(sourceUri, tagUri, svnCopyArgs, 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 });
}
}
示例3: 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 });
}
}
示例4: Commit
public bool Commit(string authorName, string authorEmail, string comment, DateTime localTime)
{
/*
TempFile commentFile;
var args = "commit";
AddComment(comment, ref args, out commentFile);
using (commentFile)
{
var startInfo = GetStartInfo(args);
startInfo.EnvironmentVariables["GIT_AUTHOR_NAME"] = authorName;
startInfo.EnvironmentVariables["GIT_AUTHOR_EMAIL"] = authorEmail;
startInfo.EnvironmentVariables["GIT_AUTHOR_DATE"] = GetUtcTimeString(localTime);
// also setting the committer is supposedly useful for converting to Mercurial
startInfo.EnvironmentVariables["GIT_COMMITTER_NAME"] = authorName;
startInfo.EnvironmentVariables["GIT_COMMITTER_EMAIL"] = authorEmail;
startInfo.EnvironmentVariables["GIT_COMMITTER_DATE"] = GetUtcTimeString(localTime);
// ignore empty commits, since they are non-trivial to detect
// (e.g. when renaming a directory)
return ExecuteUnless(startInfo, "nothing to commit");
}
*/
if (string.IsNullOrEmpty(authorName))
{
return false;
}
using (var client = new SvnClient())
{
SvnUI.Bind(client, parentWindow);
var svnCommitArgs = new SvnCommitArgs { LogMessage = comment };
var svnCommitResult = (SvnCommitResult)null;
var result = client.Commit(useSvnStandardDirStructure ? trunkPath : workingCopyPath, svnCommitArgs, out svnCommitResult);
// commit without files results in result=true and svnCommitResult=null
if (svnCommitResult != null)
{
if (result)
{
var workingCopyUri = client.GetUriFromWorkingCopy(useSvnStandardDirStructure ? trunkPath : workingCopyPath);
result &= client.SetRevisionProperty(svnCommitResult.RepositoryRoot, new SvnRevision(svnCommitResult.Revision), SvnPropertyNames.SvnAuthor, authorName);
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 });
}
else
{
MessageBox.Show(string.Format("{0} Error Code: {1}{2}", svnCommitResult.PostCommitError, "", Environment.NewLine), "SVN Commit Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
return result;
}
return false;
}