本文整理汇总了C#中SvnClient.Commit方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.Commit方法的具体用法?C# SvnClient.Commit怎么用?C# SvnClient.Commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.Commit方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckInChanges
public void CheckInChanges(string solutionDirectoryPath, Project oldProject, Project newProject)
{
using(SvnClient svnClient = new SvnClient())
{
SvnCommitArgs svnCommitArgs = new SvnCommitArgs { LogMessage = string.Format("Renamed project {0} into {1}", oldProject.ProjectName, newProject.ProjectName) };
// TODO NKO: Do something with the result
SvnCommitResult result;
svnClient.Commit(solutionDirectoryPath, svnCommitArgs, out result);
}
}
示例2: ExecuteCommand
/// <summary>
/// Actual method to be executed for the implementing task
/// </summary>
/// <param name="client">The instance of the SVN client</param>
/// <returns></returns>
public override bool ExecuteCommand(SvnClient client)
{
SvnCommitArgs args = new SvnCommitArgs();
args.LogMessage = Message;
args.KeepLocks = KeepLocks;
args.KeepChangeLists = KeepChangeLists;
SvnCommitResult result;
bool success = client.Commit(RepositoryPath, args, out result);
return success;
}
示例3: Commit
static public void Commit(string fromLocalPath)
{
using (SvnClient svnClient = new SvnClient())
{
try
{
//svnClient.Authentication.ForceCredentials(_svnUserName, _svnPwd);
SvnCommitArgs args = new SvnCommitArgs();
args.LogMessage = Properties.Settings.Default.SVN_Commit_Msg;
svnClient.Commit(fromLocalPath, args);
}
catch (Exception ex)
{
LogMessage(ex.Message);
}
}
}
示例4: ExecuteSVNTask
protected override void ExecuteSVNTask(SvnClient client)
{
if (Dir == null)
{
Dir = new DirectoryInfo(Project.BaseDirectory);
}
if (!Dir.Exists)
{
throw new BuildException(string.Format(Resources.MissingDirectory, Dir.FullName), Location);
}
string sourcesFolder = string.Concat(Dir.FullName, @"\Sources");
if (Directory.Exists(sourcesFolder))
{
Log(Level.Info, Resources.SVNAdding, Dir.FullName);
SvnAddArgs addArgs = new SvnAddArgs();
addArgs.Depth = SvnDepth.Infinity;
addArgs.Force = true;
client.Add(sourcesFolder, addArgs);
}
else
{
Log(Level.Info, Resources.SVNSourcesFolderNotFound, sourcesFolder);
}
Log(Level.Info, Resources.SVNCommitCommitting, Dir.FullName, Message);
SvnCommitArgs args = new SvnCommitArgs();
args.LogMessage = Message;
args.ThrowOnError = true;
SvnCommitResult result;
client.Commit(Dir.FullName, args, out result);
if (result != null)
{
Log(Level.Info, Resources.SVNCommitResult, Dir.FullName, result.Revision, result.Author);
}
}
示例5: Checkout
public static void Checkout(string repoDir, string wcDir)
{
if (Directory.Exists(wcDir))
{
Directory.Delete(wcDir, true);
}
using (var svn = new SvnClient())
{
var repoUri = new Uri("file:///" + repoDir.Replace('\\', '/'));
svn.CheckOut(new SvnUriTarget(repoUri), wcDir);
foreach (var fse in Directory.EnumerateFileSystemEntries(wcDir))
{
if (Path.GetFileName(fse).ToLowerInvariant() == ".svn")
continue;
svn.Add(fse, SvnDepth.Infinity);
}
svn.Commit(wcDir, new SvnCommitArgs { LogMessage = "PreCreate revision" });
}
}
示例6: 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);
}
}
}
示例7: Commit_WithAlternateUser
public void Commit_WithAlternateUser()
{
SvnSandBox sbox = new SvnSandBox(this);
sbox.Create(SandBoxRepository.Empty);
string user = Guid.NewGuid().ToString();
string dir = sbox.Wc;
using (SvnClient client = new SvnClient())
{
client.Authentication.Clear();
client.Configuration.LogMessageRequired = false;
client.Authentication.UserNameHandlers +=
delegate(object sender, SvnUserNameEventArgs e)
{
e.UserName = user;
};
client.SetProperty(dir, "a", "b");
SvnCommitResult cr;
client.Commit(dir, out cr);
Collection<SvnLogEventArgs> la;
client.GetLog(dir, out la);
Assert.That(la.Count, Is.EqualTo(2));
Assert.That(la[0].Revision, Is.EqualTo(cr.Revision));
Assert.That(la[0].Author, Is.EqualTo(user));
Assert.That(la[0].LogMessage, Is.EqualTo(""));
}
}
示例8: Commit
private async void Commit(string path) {
var svnClient = new SvnClient();
AppendLog("Committing to SVN...");
await Task.Run(() => { svnClient.Commit(path); });
AppendLog("Complete!");
}
示例9: 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;
}
示例10: Commit
/// <summary>
/// Commit nisan.xml to svn repo based on working copy path and authentication.
/// </summary>
/// <remarks>
/// See https://sharpsvn.open.collab.net/ using ver 1.6.
/// </remarks>
public bool Commit()
{
// save to file first
SaveToFile("nisan.xml");
System.Diagnostics.Debug.WriteLine("svn commit nisan.xml -m \"Updating nisan order by NisanWPF.\"");
//string url = "https://jawiweb.googlecode.com/svn/trunk/Samples";
SvnCommitArgs args = new SvnCommitArgs();
args.LogMessage = "Updating nisan order by NisanWPF.";
using (SvnClient client = new SvnClient())
return client.Commit("nisan.xml", args);//url, args);
}
示例11: SvnCommit
public static bool SvnCommit(string path)
{
SvnClient client = new SvnClient();
return client.Commit(path);
}