本文整理汇总了C#中SvnClient.CheckOut方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.CheckOut方法的具体用法?C# SvnClient.CheckOut怎么用?C# SvnClient.CheckOut使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.CheckOut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckOut
/// <summary>
/// 执行检出操作
/// </summary>
/// <param name="repositoryPath">svn服务器路径</param>
/// <param name="workDirectory">工程本地工作路径</param>
/// <param name="svnPath">本地svn路径</param>
/// <param name="checkResult">检出操作的结果</param>
/// <returns>返回检出操作的日志</returns>
public string CheckOut(string repositoryPath,string workDirectory,out string checkResult,string xmlConfigPath)
{
string err;
string time;
XmlDao xmlDao = new XmlDao();
XmlNodeList xmlNodeList=xmlDao.XmlQuery("config/preferences/SvnPath", xmlConfigPath);
string svnPath=xmlNodeList[0].InnerText;
using (SvnClient client = new SvnClient())
{
Tools tools = new Tools();
string checkOutLog = "";
try
{
client.CheckOut(new Uri(repositoryPath), workDirectory);
string args = "checkout " + repositoryPath + " " + workDirectory;
checkOutLog = tools.BuildProject(svnPath, args, null, out err, out time);
checkResult = "successful";
return checkOutLog;
}
catch (Exception ex)
{
checkResult = " failed";
checkOutLog = ex.Message;
return checkOutLog;
}
}
}
示例2: CheckOut
public override string CheckOut(IPackageTree packageTree, FileSystemInfo destination)
{
SvnUpdateResult result = null;
using (var client = new SvnClient())
{
try
{
var svnOptions = new SvnCheckOutArgs();
if (UseRevision.HasValue)
svnOptions.Revision = new SvnRevision(UseRevision.Value);
client.CheckOut(new SvnUriTarget(new Uri(Url)), destination.FullName, svnOptions, out result);
}
catch (SvnRepositoryIOException sre)
{
HandleExceptions(sre);
}
catch (SvnObstructedUpdateException sue)
{
HandleExceptions(sue);
}
}
return result.Revision.ToString();
}
示例3: 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");
}
}
示例4: Resolve_RepeatedEventHookUp_SOC_411
public void Resolve_RepeatedEventHookUp_SOC_411()
{
SvnSandBox sbox = new SvnSandBox(this);
Uri projectRoot = new Uri("https://ctf.open.collab.net/svn/repos/sharpsvn/trunk/scripts");
using (var svnClient = new SvnClient())
{
for (int i = 0; i < 3; i++)
{
string workingcopy = sbox.GetTempDir();
Directory.CreateDirectory(workingcopy);
svnClient.Authentication.UserNamePasswordHandlers += DoNowt;
try
{
SvnUpdateResult svnUpdateResult;
SvnCheckOutArgs ca = new SvnCheckOutArgs() { Depth = SvnDepth.Files };
Assert.IsTrue(svnClient.CheckOut(projectRoot, workingcopy, ca, out svnUpdateResult));
Assert.IsNotNull(svnUpdateResult);
Assert.IsTrue(svnUpdateResult.HasRevision);
}
finally
{
svnClient.Authentication.UserNamePasswordHandlers -= DoNowt;
}
}
}
}
示例5: Main
static void Main(string[] args)
{
using (SvnClient client = new SvnClient())
{
SvnUpdateResult result;
// Checkout the code to the specified directory
client.CheckOut(new Uri("https://svn01.bauerverlag.de/svn/dev_net/dev/Beispiele/"), @"C:\test\SharpSvnCheckoutTest", out result);
}
}
示例6: backgroundWorker1_DoWork
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
WorkerArguments arguments = (WorkerArguments)e.Argument;
using (SvnClient client = new SvnClient())
{
SvnUI.Bind(client, this);
SvnUriTarget svnUri = new SvnUriTarget(arguments.uri);
SvnUpdateResult result;
client.CheckOut(svnUri, arguments.checkoutFolder, arguments.checkoutArgs, out result);
e.Result = result;
}
}
示例7: Checkout
static public void Checkout(Uri fromUri, string localPath, SvnDepth depth)
{
using (SvnClient svnClient = new SvnClient())
{
try
{
SvnCheckOutArgs args = new SvnCheckOutArgs();
args.Depth = depth;
svnClient.CheckOut(fromUri, localPath, args);
}
catch (Exception ex)
{
LogMessage(ex.Message);
}
}
}
示例8: ExecuteSVNTask
protected override void ExecuteSVNTask(SvnClient client)
{
if (Dir.Exists && !IsEmpty(Dir))
{
throw new BuildException(string.Format(Resources.SVNCheckoutEmptyDirectory, Dir.FullName), Location);
}
Log(Level.Info, Resources.SVNCheckingOut, Url, Dir.FullName);
SvnCheckOutArgs args = new SvnCheckOutArgs();
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.CheckOut(SvnUriTarget.FromUri(Url), Dir.FullName, args, out result);
if (conflictedFiles)
{
throw new BuildException(string.Format(Resources.SVNConflict, Dir.FullName));
}
if (result != null)
{
Log(Level.Info, Resources.SVNCheckedOut, Dir.FullName, result.Revision);
}
}
示例9: 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)
{
SvnUriTarget uriTarget = new SvnUriTarget(RepositoryUrl);
SvnCheckOutArgs checkOutArgs = new SvnCheckOutArgs();
checkOutArgs.Depth = GetDepth();
checkOutArgs.IgnoreExternals = IgnoreExternals;
checkOutArgs.Revision = RevisionParser.SafeParse(Revision);
SvnUpdateResult result;
bool success = client.CheckOut(uriTarget, RepositoryPath, checkOutArgs, out result);
if (result.HasRevision)
{
CheckedRevision = result.Revision;
Log.LogMessage(MessageImportance.Normal, "Checked revision: {0}", CheckedRevision);
}
if (result.HasResultMap)
{
ReadResults(result);
}
return success;
}
示例10: 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;
}
示例11: 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();
}
}
}
示例12: Log_LogFromFile
public void Log_LogFromFile()
{
SvnSandBox sbox = new SvnSandBox(this);
Uri repos = sbox.CreateRepository(SandBoxRepository.MergeScenario);
string dir = sbox.Wc;
using (SvnClient client = new SvnClient())
{
client.CheckOut(new Uri(repos, "trunk/"), dir);
int n = 0;
client.Log(Path.Combine(dir, "index.html"),
delegate(object sender, SvnLogEventArgs e)
{
switch (n++)
{
case 0:
Assert.That(e.LogMessage, Is.EqualTo("Merge branch b - product roadmap and update about page"));
break;
case 1:
Assert.That(e.LogMessage, Is.EqualTo("Merge branch a. Added medium product"));
break;
case 2:
Assert.That(e.LogMessage, Is.EqualTo("Create initial product structure"));
break;
}
});
Assert.That(n, Is.EqualTo(3));
}
}
示例13: 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" });
}
}
示例14: Checkout
private async void Checkout(string url) {
var branchName = url.Split('/').Last();
var checkoutPath = GetDansBranchPath(branchName);
var svnClient = new SvnClient();
AppendLog("Checking out from SVN...");
// This is an async operator, it makes sure Checkout() runs in background without freezing the whole application
await Task.Run(() => { svnClient.CheckOut(new SvnUriTarget(url), checkoutPath); });
AppendLog("Complete!");
}
示例15: AddButtonClick
private void AddButtonClick(object sender, EventArgs e)
{
// Get the url to the repository
string answer;
if (Environment.ExpandEnvironmentVariables("path").IndexOf("git") != 0)
{
answer = Microsoft.VisualBasic.Interaction.InputBox(Resources.addRepoMessageGitEnabled, Resources.addRepoHeader, Resources.addRepoDefaultValue);
}
else
{
answer = Microsoft.VisualBasic.Interaction.InputBox(Resources.addRepoMessageGitDisabled, Resources.addRepoHeader, Resources.addRepoDefaultValue);
}
if (answer == string.Empty)
{
return;
}
if (answer == "url")
{
MessageBox.Show(@"You must give the url", @"No url given");
return;
}
// Check if it is a git repository
if (answer.LastIndexOf("git") != 0)
{
var dir = Microsoft.VisualBasic.Interaction.InputBox(Resources.repoFolderMessage, Resources.repoFolderHeader);
Process.Start("git", string.Format("clone {0} {1}", answer, _installDir + "\\" + dir)).WaitForExit();
}
// ...else checkout a SVN repository
else
{
var url = new Uri(answer);
using (var svnClient = new SvnClient())
{
var dir = Microsoft.VisualBasic.Interaction.InputBox(Resources.repoFolderMessage, Resources.repoFolderHeader);
svnClient.CheckOut(url, _installDir + "\\" + dir);
}
}
UpdateStuff();
}