本文整理汇总了C#中SvnClient.CleanUp方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.CleanUp方法的具体用法?C# SvnClient.CleanUp怎么用?C# SvnClient.CleanUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.CleanUp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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)
{
return client.CleanUp(RepositoryPath);
}
示例2: 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;
}
示例3: 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;
}
示例4: Main
static int Main(string[] args)
{
try
{
Console.WriteLine("Svn2: {0}", Assembly.GetExecutingAssembly().GetName().Version);
if (args.Length < 1)
{
Usage();
return -2;
}
string command = args[0];
if (command == "/?" || command == "-?" || command == "--help")
{
Usage();
return -2;
}
string path = (args.Length == 2)
? Path.GetFullPath(args[1])
: Path.GetFullPath(Environment.CurrentDirectory);
SvnClient client = new SvnClient();
switch (command)
{
case "sync":
{
SvnStatusArgs statusArgs = new SvnStatusArgs();
statusArgs.Depth = SvnDepth.Infinity;
statusArgs.ThrowOnError = true;
client.Status(path, statusArgs, new EventHandler<SvnStatusEventArgs>(delegate(object sender, SvnStatusEventArgs e)
{
switch (e.LocalContentStatus)
{
case SvnStatus.NotVersioned:
Console.WriteLine(" {0} {1}", StatusToChar(e.LocalContentStatus), e.FullPath);
if (File.Exists(e.FullPath))
{
FileSystem.DeleteFile(e.FullPath, UIOption.OnlyErrorDialogs,
RecycleOption.SendToRecycleBin);
}
else if (Directory.Exists(e.FullPath))
{
FileSystem.DeleteDirectory(e.FullPath, UIOption.OnlyErrorDialogs,
RecycleOption.SendToRecycleBin);
}
break;
}
}));
}
break;
case "cleanup":
{
Console.WriteLine("Cleaning up {0}", path);
SvnCleanUpArgs cleanupArgs = new SvnCleanUpArgs();
cleanupArgs.ThrowOnError = true;
cleanupArgs.Notify += new EventHandler<SvnNotifyEventArgs>(delegate(object sender, SvnNotifyEventArgs e)
{
Console.WriteLine(" L {0}", e.FullPath);
});
client.CleanUp(path, cleanupArgs);
}
break;
case "revert":
{
Console.WriteLine("Reverting {0}", path);
SvnRevertArgs revertArgs = new SvnRevertArgs();
revertArgs.Depth = SvnDepth.Infinity;
revertArgs.ThrowOnError = true;
revertArgs.Notify += new EventHandler<SvnNotifyEventArgs>(delegate(object sender, SvnNotifyEventArgs e)
{
Console.WriteLine(" R {0}", e.FullPath);
});
client.Revert(path, revertArgs);
}
break;
case "status":
{
SvnStatusArgs statusArgs = new SvnStatusArgs();
statusArgs.Depth = SvnDepth.Infinity;
statusArgs.ThrowOnError = true;
client.Status(path, statusArgs, new EventHandler<SvnStatusEventArgs>(delegate(object sender, SvnStatusEventArgs e)
{
Console.WriteLine(" {0} {1}", StatusToChar(e.LocalContentStatus), e.FullPath);
}));
}
break;
default:
throw new Exception(string.Format("Unsupported '{0}' command", command));
}
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
#if DEBUG
Console.Error.WriteLine(ex.StackTrace);
//.........这里部分代码省略.........
示例5: SvnCleanup
public static bool SvnCleanup(string path)
{
SvnClient client = new SvnClient();
return client.CleanUp(path);
}