本文整理汇总了C#中SvnClient.GetStatus方法的典型用法代码示例。如果您正苦于以下问题:C# SvnClient.GetStatus方法的具体用法?C# SvnClient.GetStatus怎么用?C# SvnClient.GetStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SvnClient
的用法示例。
在下文中一共展示了SvnClient.GetStatus方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckLocalRemoteStatus
public void CheckLocalRemoteStatus()
{
SvnSandBox sbox = new SvnSandBox(this);
sbox.Create(SandBoxRepository.Default);
string WcPath = sbox.Wc;
string dir = WcPath;
SvnStatusArgs sa = new SvnStatusArgs();
sa.RetrieveRemoteStatus = true;
Collection<SvnStatusEventArgs> r;
using (SvnClient c = new SvnClient())
{
c.GetStatus(dir, sa, out r);
}
}
示例2: search
public void search(string query) {
var queries = query.split(false, true, ' ').ToArray();
this.root = myapp.files.Resolve("~/").ToLower();
if(!this.root.EndsWith("/")) {
root = root + "/";
}
query = query.Replace(".", "\\.").ToLower();
var result = search(root, queries).OrderBy(x => x).ToArray();
PropertyBag["result"] = result;
#if SVNINTEGRATION
IDictionary<string , SvnStatusEventArgs> svn = new Dictionary<string, SvnStatusEventArgs>();
using (var c = new SvnClient()) {
foreach (var r in result) {
var ss = new Collection<SvnStatusEventArgs>();
c.GetStatus((root+r).normalizePath(), out ss);
svn[r] = ss[0];
}
}
PropertyBag["svn"] = svn;
#endif
}
示例3: GetRevision
private static long GetRevision(String path)
{
if (String.IsNullOrEmpty(path))
return 0;
if (!IsWorkingCopy(path))
return 0;
long remoteRevision = 0;
long localRevision = 0;
try
{
using (SvnClient client = new SvnClient())
{
SvnStatusArgs statusargs = new SvnStatusArgs();
statusargs.Depth = SvnDepth.Empty; // Adjust this to check direct files, or (recursive) directories etc
statusargs.RetrieveAllEntries = true;
statusargs.RetrieveRemoteStatus = true;
Collection<SvnStatusEventArgs> statuses;
client.GetStatus(path, statusargs, out statuses);
remoteRevision = statuses[0].Revision;
}
}
catch (Exception)
{
Logger.Write("Error while retrieving information from remote repo", LogLevel.Warning);
}
using (SvnWorkingCopyClient client = new SvnWorkingCopyClient())
{
SvnWorkingCopyVersion version;
if (client.GetVersion(path, out version))
{
if (version.End >= 0)
localRevision = version.End;
}
}
if (remoteRevision > localRevision)
{
Logger.Write("Working copy seems to be out of date", LogLevel.Warning);
}
return localRevision;
}
示例4: TestRepositoryStatus
/// <summary>
/// Tests an update where we contact the repository
/// </summary>
/*[TestMethod]
public void TestRepositoryStatus()
{
// modify the file in another working copy and commit
string wc2 = this.FindDirName(Path.Combine(this.WcPath, "wc2"));
try
{
Zip.ExtractZipResource(wc2, this.GetType(), WC_FILE);
this.RenameAdminDirs(wc2);
using (StreamWriter w = new StreamWriter(
Path.Combine(wc2, "Form.cs"), true))
w.Write("Hell worl");
this.RunCommand("svn", "ci -m \"\" " + wc2);
// find the status in our own wc
int youngest;
string form = Path.Combine(this.WcPath, "Form.cs");
this.Client.Status(out youngest,
form, Revision.Head, new StatusCallback(this.StatusFunc),
false, false, true, true);
Assert.AreEqual(e.RepositoryTextStatus,
SvnStatus.Modified, "Wrong status");
}
finally
{
PathUtils.RecursiveDelete(wc2);
}
}*/
SvnStatusEventArgs SingleStatus(SvnClient client, string path)
{
SvnStatusArgs sa = new SvnStatusArgs();
sa.Depth = SvnDepth.Empty;
sa.RetrieveAllEntries = true;
Collection<SvnStatusEventArgs> rslt;
client.GetStatus(path, sa, out rslt);
if (rslt.Count != 1)
return null;
SvnStatusEventArgs r = rslt[0];
if (!r.Versioned
&& !r.Conflicted
&& r.LocalNodeStatus == SvnStatus.None
&& r.LocalTextStatus == SvnStatus.None
&& r.LocalPropertyStatus == SvnStatus.None)
{
return null;
}
return r;
}
示例5: CheckWcStatus
void CheckWcStatus(SvnClient svn)
{
Collection<SvnStatusEventArgs> statuses;
if (!svn.GetStatus(_wc, out statuses))
throw new ApplicationException("SvnClient.GetStatus returns false");
if (statuses.Count > 0)
throw new ApplicationException("SVN working copy has files/directories in non-normal state.\nMake reverts/remove unversioned files and try again with stage import.\n" + _wc);
}
示例6: GatherSvnInformation
private void GatherSvnInformation( SvnInformation svn )
{
using ( var client = new SvnClient() )
{
var arg = new SvnStatusArgs()
{
Revision = new SvnRevision( SvnRevisionType.Working ),
Depth = SvnDepth.Empty
};
client.Info( WorkingCopy, ( sender, e ) =>
{
svn.Now = DateTime.Now;
if ( String.IsNullOrEmpty( svn.Url ) )
svn.Url = e.Uri.AbsoluteUri;
svn.CommitRevision = e.Revision;
} );
Collection<SvnStatusEventArgs> statuses;
arg.Depth = SvnDepth.Infinity;
arg.RetrieveAllEntries = true;
client.GetStatus( WorkingCopy, arg, out statuses );
foreach ( var item in statuses )
{
if ( string.IsNullOrEmpty( svn.RootUrl ) )
svn.RootUrl = item.RepositoryRoot.AbsoluteUri;
svn.MinRevision = item.Revision > 0 && ( item.Revision < svn.MinRevision || svn.MinRevision == 0 ) ? item.Revision : svn.MinRevision;
svn.MaxRevision = item.Revision > 0 && ( item.Revision > svn.MaxRevision || svn.MaxRevision == 0 ) ? item.Revision : svn.MaxRevision;
svn.IsSvnItem = false;
switch ( item.LocalNodeStatus )
{
case SvnStatus.None:
case SvnStatus.NotVersioned:
case SvnStatus.Ignored:
break;
case SvnStatus.External:
case SvnStatus.Incomplete:
case SvnStatus.Normal:
svn.IsSvnItem = true;
break;
default:
svn.IsSvnItem = true;
svn.HasModifications = true;
break;
}
switch ( item.LocalPropertyStatus )
{
case SvnStatus.None:
case SvnStatus.NotVersioned:
case SvnStatus.Ignored:
break;
case SvnStatus.External:
case SvnStatus.Incomplete:
case SvnStatus.Normal:
svn.IsSvnItem = true;
break;
default:
svn.IsSvnItem = true;
svn.HasModifications = true;
break;
}
}
svn.MixedRevisions = svn.MinRevision != svn.MaxRevision;
svn.RevisionRange = String.Format( "{0}:{1}", svn.MinRevision, svn.MaxRevision );
}
}
示例7: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
lbInfo.Content = "一切正常";
String curDir = Directory.GetCurrentDirectory();
String curExe = System.Reflection.Assembly.GetExecutingAssembly().Location;
SvnClient = new SvnClient();
SvnTarget svnTargetCurDir = SvnTarget.FromString(curDir);
SvnTarget snvTargetCurExe = SvnTarget.FromString(curExe);
// 未使用 - 获取目录下的文件状态
Collection<SvnStatusEventArgs> svnStatusEventArgsCollection;
SvnClient.GetStatus(Directory.GetCurrentDirectory(), out svnStatusEventArgsCollection);
// 未使用 - 空的
Collection<SvnPropertyListEventArgs> svnPropertyListEventArgsCollection;
SvnClient.GetPropertyList(Directory.GetCurrentDirectory(), out svnPropertyListEventArgsCollection);
// 未使用 - 获取一个文件的状态
Collection<SvnFileVersionEventArgs> svnFileVersionEventArgsCollection;
try
{
SvnClient.GetFileVersions(snvTargetCurExe, out svnFileVersionEventArgsCollection);
}
catch(SvnWorkingCopyPathNotFoundException ex)
{
// 如果查询的文件未加入Repo,会抛此异常
}
// 未使用 - 一个好像没什么用的信息列表,目录是第一个项,没有版本号
Collection<SvnListEventArgs> svnListEventArgsCollection;
SvnClient.GetList(svnTargetCurDir, out svnListEventArgsCollection);
// 未使用 - 工作目录全路径
String workingCopyRoot = SvnClient.GetWorkingCopyRoot(Directory.GetCurrentDirectory());
// 未使用 - 整个仓库的最新版本
long revision = 0;
SvnClient.Youngest(Directory.GetCurrentDirectory(), out revision);
// 此目录的相关变更 和 GUI中的ShowLog一样 是此目录的相关变更
Collection<SvnLogEventArgs> logList;
try
{
SvnClient.GetLog(Directory.GetCurrentDirectory(), out logList);
}
catch(SvnInvalidNodeKindException ex)
{
lbInfo.Content = "当前目录不是SVN目录,停用更新检查功能";
btnUpdateAndLaunch.Visibility = Visibility.Hidden;
return;
}
// 获取本地目录信息,当前版本和修改版本都是本地的
SvnInfoEventArgs svnInfoEventArgs;
SvnClient.GetInfo(svnTargetCurDir, out svnInfoEventArgs);
long curRevision = svnInfoEventArgs.Revision; // 当前的SVN版本
long changeRevision = logList[0].Revision; // 当前目录的最新远程变更版本
lbVersionChange.Content = changeRevision;
lbVersionCur.Content = svnInfoEventArgs.Revision;
if (curRevision < changeRevision)
{
btnUpdateAndLaunch.Visibility = Visibility.Visible;
lbInfo.Content = "发现新版本";
}
else
{
btnUpdateAndLaunch.Visibility = Visibility.Hidden;
lbInfo.Content = "已经是最新版";
}
// --------------------------------------------------------
// SvnWorkingCopyClient
// --------------------------------------------------------
SvnWorkingCopyClient svnWorkingCopyClient = new SvnWorkingCopyClient();
// 未使用 只有一个值IsText 没看出有什么用处
SvnWorkingCopyState svnWorkingCopyState;
svnWorkingCopyClient.GetState(Directory.GetCurrentDirectory(), out svnWorkingCopyState);
// 未使用 返回仅本地存在的所有修改版本
SvnWorkingCopyVersion svnWorkingCopyVersion;
svnWorkingCopyClient.GetVersion(curDir, out svnWorkingCopyVersion);
// --------------------------------------------------------
// SvnTools
// --------------------------------------------------------
// 未使用 传入正确的目录却返回false????
bool isCurDirInWorkingCopy = SvnTools.IsManagedPath(curDir);
}
示例8: AddAll
/*
* This adds, modifies, and removes index entries to match the working tree.
*/
public bool AddAll()
{
/*
var startInfo = GetStartInfo("add -A");
// add fails if there are no files (directories don't count)
return ExecuteUnless(startInfo, "did not match any files");
*/
var overallStatus = true;
using (var client = new SvnClient())
{
SvnUI.Bind(client, parentWindow);
var statusList = (Collection<SvnStatusEventArgs>)null;
var svnStatusArgs = new SvnStatusArgs { Depth = SvnDepth.Infinity, IgnoreExternals = false, KeepDepth = false, RetrieveIgnoredEntries = false };
if (client.GetStatus(useSvnStandardDirStructure ? trunkPath : workingCopyPath, svnStatusArgs, out statusList))
{
overallStatus = statusList.Select(svnStatusEventArg =>
{
switch (svnStatusEventArg.LocalNodeStatus)
{
case SvnStatus.Missing:
logger.WriteLine("Commit: Deleting file {0} due to status = {1}", svnStatusEventArg.FullPath, svnStatusEventArg.LocalNodeStatus);
return client.Delete(svnStatusEventArg.FullPath, new SvnDeleteArgs { KeepLocal = false, Force = false });
case SvnStatus.NotVersioned:
logger.WriteLine("Commit: Adding file {0} due to status = {1}", svnStatusEventArg.FullPath, svnStatusEventArg.LocalNodeStatus);
return client.Add(svnStatusEventArg.FullPath, new SvnAddArgs { AddParents = false, Depth = SvnDepth.Infinity, Force = false });
default:
return true;
}
})
.Aggregate(true, (state, val) => state &= val);
}
else
overallStatus = false;
}
return overallStatus;
}
示例9: 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();
}
}
}