本文整理汇总了C#中SvnClient.Update方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.Update方法的具体用法?C# SvnClient.Update怎么用?C# SvnClient.Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.Update方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SyncLocalFolderWithO2XRulesDatabase
public static void SyncLocalFolderWithO2XRulesDatabase()
{
try
{
"in SyncLocalFolderWithO2XRulesDatabase".debug();
//var targetLocalDir = XRules_Config.PathTo_XRulesDatabase_fromO2;
var targetLocalDir = PublicDI.config.LocalScriptsFolder;
var o2XRulesSvn = PublicDI.config.SvnO2DatabaseRulesFolder;
"starting Sync with XRules Database to {0}".info(targetLocalDir);
using (SvnClient client = new SvnClient())
{
if (targetLocalDir.dirExists().isFalse() || targetLocalDir.pathCombine(".svn").dirExists().isFalse())
{
"First Sync, so doing an SVN Checkout to: {0}".info(targetLocalDir);
Files.deleteFolder(targetLocalDir, true);
client.CheckOut(new Uri(o2XRulesSvn), targetLocalDir);
}
else
{
"Local XRules folder exists, so doing an SVN Update".info();
client.Update(targetLocalDir);
}
"SVN Sync completed".debug();
}
}
catch (Exception ex)
{
ex.log("in SvnApi.SyncLocalFolderWithO2XRulesDatabase");
}
}
示例2: 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);
}
Log(Level.Info, Resources.SVNUpdateUpdating, Dir.FullName);
SvnUpdateArgs args = new SvnUpdateArgs();
args.ThrowOnError = true;
args.Depth = SvnDepth.Infinity;
args.Revision = SvnRevision.Head;
SvnUpdateResult result;
bool conflictedFiles = false;
client.Conflict += delegate(object sender, SvnConflictEventArgs conflictArgs)
{
conflictedFiles = true;
Log(Level.Warning, string.Concat(@"Conflicted: ", conflictArgs.Path));
};
client.Notify += delegate(object sender, SvnNotifyEventArgs notifyArgs)
{
Log(Level.Info, string.Concat(notifyArgs.Action, ": ", notifyArgs.Path));
};
client.Update(Dir.FullName, args, out result);
if (conflictedFiles)
{
throw new BuildException(string.Format(Resources.SVNConflict, Dir.FullName));
}
if (result != null)
{
Log(Level.Info, Resources.SVNUpdateResult, Dir.FullName, result.Revision);
}
}
示例3: 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)
{
SvnUpdateArgs args = new SvnUpdateArgs();
args.Depth = Recursive ? SvnDepth.Infinity : SvnDepth.Children;
SvnUpdateResult updateResult;
bool success = client.Update(RepositoryPath, args, out updateResult);
if (updateResult.HasResultMap)
{
foreach (string key in updateResult.ResultMap.Keys)
{
SvnUpdateResult result = updateResult.ResultMap[key];
Log.LogMessage(MessageImportance.Normal, "[{0} - {1}]", key, result.Revision);
}
}
return success;
}
示例4: UpdateWorkingCopy
public void UpdateWorkingCopy(string solutionDirectoryPath)
{
using(SvnClient svnClient = new SvnClient())
{
// TODO NKO: Do something with the result
SvnUpdateResult result;
svnClient.Update(solutionDirectoryPath, out result);
}
}
示例5: Update
public override string Update(IPackageTree packageTree, FileSystemInfo destination)
{
SvnUpdateResult result = null;
using (var client = new SvnClient())
{
try
{
var svnOptions = new SvnUpdateArgs();
if (UseRevision.HasValue)
svnOptions.Revision = new SvnRevision(UseRevision.Value);
client.Update(destination.FullName, svnOptions, out result);
}
catch (SvnRepositoryIOException sre)
{
HandleExceptions(sre);
}
catch (SvnObstructedUpdateException sue)
{
HandleExceptions(sue);
}
}
return result.Revision.ToString();
}
示例6: Update
public static string Update(string url, Log log, string directory)
{
if (string.IsNullOrWhiteSpace(url))
{
Utility.Log(LogStatus.Skipped, "Updater", string.Format("No Url specified - {0}", url), log);
}
else
{
try
{
var dir = Path.Combine(directory, url.GetHashCode().ToString("X"));
using (var client = new SvnClient())
{
var cleanUp = false;
client.Conflict +=
delegate(object sender, SvnConflictEventArgs eventArgs)
{
eventArgs.Choice = SvnAccept.TheirsFull;
};
client.Status(
dir, new SvnStatusArgs { ThrowOnError = false },
delegate(object sender, SvnStatusEventArgs args)
{
if (args.Wedged)
{
cleanUp = true;
}
});
if (cleanUp)
{
client.CleanUp(dir);
}
try
{
if (Directory.Exists(dir))
{
SvnInfoEventArgs remoteVersion;
var b1 = client.GetInfo(new Uri(url), out remoteVersion);
SvnInfoEventArgs localVersion;
var b2 = client.GetInfo(dir, out localVersion);
if (b1 && b2 && remoteVersion.Revision == localVersion.Revision)
{
Utility.Log(
LogStatus.Ok, "Updater", string.Format("Update not needed - {0}", url), log);
return dir;
}
}
}
catch (Exception ex)
{
Utility.Log(LogStatus.Error, "Updater", string.Format("{0} - {1}", ex, url), log);
}
client.CheckOut(new Uri(url), dir);
client.Update(dir);
Utility.Log(LogStatus.Ok, "Updater", string.Format("Updated - {0}", url), log);
}
return dir;
}
catch (SvnException ex)
{
Utility.Log(LogStatus.Error, "Updater", string.Format("{0} - {1}", ex.RootCause, url), log);
}
catch (Exception ex)
{
Utility.Log(LogStatus.Error, "Updater", string.Format("{0} - {1}", ex.Message, url), log);
}
}
return string.Empty;
}
示例7: UpdateButtonClick
private void UpdateButtonClick(object sender, EventArgs e)
{
UpdateButton.Enabled = false;
UpdateButton.Text = Resources.updateButtonUpdating;
// Check if user has selected any addons in the list. if not update all
if (listAddonsList.SelectedItems.Count != 0)
{
foreach (ListViewItem item in listAddonsList.SelectedItems)
{
var addonDir = _installDir + "\\" + item.Text;
if (Directory.Exists(addonDir + "\\.svn"))
{
try
{
var svnClient = new SvnClient();
svnClient.Update(addonDir);
}
catch (SvnWorkingCopyLockException)
{
var svnClient = new SvnClient();
svnClient.CleanUp(addonDir);
svnClient.Update(addonDir);
throw;
}
}
else if (Directory.Exists(addonDir + "\\.git") && Environment.ExpandEnvironmentVariables("path").IndexOf("git") != 0)
{
var processInfo = new ProcessStartInfo("git") {WorkingDirectory = addonDir, Arguments = "fetch"};
var process = Process.Start(processInfo);
process.WaitForExit();
process.StartInfo.Arguments = "merge origin/master";
process.Start();
}
}
}
else
{
// Update all repositories in a nice threaded way
Parallel.ForEach(Directory.GetDirectories(_installDir), dir =>
{
// Check if the addon is updated by SVN
if (Directory.Exists(dir + "\\.svn"))
{
try
{
var svnClient = new SvnClient();
svnClient.Update(dir);
}
catch (SvnWorkingCopyLockException)
{
var svnClient = new SvnClient();
svnClient.CleanUp(dir);
svnClient.Update(dir);
throw;
}
}
// Check if there are any git addons and if the user has git installed and if both are true then "update" the addons
else if (Directory.Exists(dir + "\\.git") && Environment.ExpandEnvironmentVariables("path").IndexOf("git") != 0)
{
var processInfo = new ProcessStartInfo("git") {WorkingDirectory = dir, Arguments = "fetch"};
var process = Process.Start(processInfo);
process.WaitForExit();
process.StartInfo.Arguments = "merge origin/master";
process.Start();
}
});
MessageBox.Show(Resources.updateCompleteMessage, Resources.updateCompleteHeader);
}
UpdateButton.Text = Resources.updateButDefaultText;
UpdateButton.Enabled = true;
}
示例8: 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 });
}
}
示例9: SVNUpdate
private bool SVNUpdate(string path)
{
SvnClient client = new SvnClient();
if (client.Update(path))
{
this.WriteLog("获取SVN最新版本文件成功");
return true;
}
this.WriteErrLog("获取SVN最新版本文件失败");
return false;
}
示例10: Update
public bool Update(string path)
{
using (var client = new SvnClient())
{
SvnUI.Bind(client, parentWindow);
return client.Update(path, new SvnUpdateArgs { AddsAsModifications = false, AllowObstructions = false, Depth = SvnDepth.Infinity, IgnoreExternals = true, KeepDepth = true, Revision = SvnRevision.Head, UpdateParents = false });
}
return false;
}
示例11: 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 });
}
}
示例12: 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;
}
示例13: doSvnUpdate
/// <summary>
/// While the server isn't up to date
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void doSvnUpdate(object sender, DoWorkEventArgs e)
{
client = new SvnClient();
client.Notify += onSvnNotify;
client.Authentication.Clear();
client.Authentication.DefaultCredentials = null;
System.Console.Out.WriteLine(client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory()));
Uri rep = client.GetUriFromWorkingCopy(System.IO.Directory.GetCurrentDirectory());
Uri rel = new Uri("http://subversion.assembla.com/svn/skyrimonlineupdate/");
if (rep == null || rep != rel)
{
SvnDelete.findSvnDirectories(System.IO.Directory.GetCurrentDirectory());
exploreDirectory(rel);
download.Maximum = iCount;
updating = true;
SvnCheckOutArgs args = new SvnCheckOutArgs();
args.AllowObstructions = true;
if (client.CheckOut(rel, System.IO.Directory.GetCurrentDirectory(), args, out mResult))
{
updated = true;
}
}
else
{
downloadprogress.Text = "Building update list, please be patient...";
updating = true;
SvnStatusArgs sa = new SvnStatusArgs();
sa.RetrieveRemoteStatus = true;
Collection<SvnStatusEventArgs> r;
client.GetStatus(System.IO.Directory.GetCurrentDirectory(), sa, out r);
foreach (SvnStatusEventArgs i in r)
{
client.Revert(i.FullPath);
if (i.IsRemoteUpdated)
iCount++;
}
download.Maximum = iCount;
SvnUpdateArgs args = new SvnUpdateArgs();
args.AllowObstructions = true;
if (client.Update(System.IO.Directory.GetCurrentDirectory(), args))
{
updated = true;
}
else
{
Application.Exit();
}
}
}
示例14: SvnUpdate
public static bool SvnUpdate(string path)
{
SvnClient client = new SvnClient();
return client.Update(path);
}