本文整理汇总了C#中SvnClient.Status方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.Status方法的具体用法?C# SvnClient.Status怎么用?C# SvnClient.Status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.Status方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: DoFetchRecentChanges
private void DoFetchRecentChanges(SvnClient client,
SvnStatusArgs sa,
List<string> roots,
List<SvnStatusEventArgs> resultList,
Dictionary<string, string> found)
{
foreach (string path in roots)
{
// TODO: Find some way to get this information safely in the status cache
// (Might not be possible because of delays in network check)
client.Status(path, sa,
delegate(object s, SvnStatusEventArgs stat)
{
if (IgnoreStatus(stat))
return; // Not a synchronization item
else if (found.ContainsKey(stat.FullPath))
return; // Already reported
stat.Detach();
resultList.Add(stat);
found.Add(stat.FullPath, "");
});
}
}
示例3: bw_DoWork
void bw_DoWork(object sender, DoWorkEventArgs e)
{
BackgroundWorker bw = sender as BackgroundWorker;
string localPath = this.bgWorkerInfo.LocalPath;
List<string> fileList = new List<string>();
using (SvnClient client = new SvnClient())
{
client.Status(localPath,
delegate(object svnsender, SvnStatusEventArgs svargs)
{
if (svargs.LocalContentStatus == SvnStatus.Modified ||
svargs.LocalContentStatus == SvnStatus.Added ||
svargs.LocalContentStatus == SvnStatus.Deleted ||
svargs.LocalContentStatus == SvnStatus.Merged)
bw.ReportProgress(0, svargs.FullPath);
fileList.Add(svargs.FullPath);
if (bw.CancellationPending)
{
e.Cancel = true;
return; // if user cancelled in btween!
}
});
}
}
示例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: getModifiedFiles
/// <summary>
/// Get the list files changed in the archive
/// </summary>
/// <param name="localPath">Archive path</param>
/// <returns></returns>
public List<string> getModifiedFiles(string localPath)
{
List<string> fileList = new List<string>();
using (SvnClient client = new SvnClient())
{
client.Status(localPath,
delegate(object sender, SvnStatusEventArgs e)
{
if (e.LocalContentStatus == SvnStatus.Modified ||
e.LocalContentStatus == SvnStatus.Added ||
e.LocalContentStatus == SvnStatus.Deleted ||
e.LocalContentStatus == SvnStatus.Merged)
fileList.Add(e.FullPath);
});
}
return fileList;
}