c# - SharpSVN - How to get the previous revision? -
i trying find efficient way previous revision of file text comparison using sharpsvn.
using (svnclient c = new svnclient()) { c.authentication.defaultcredentials = new networkcredential( configurationmanager.appsettings.get("svnserviceusername") , configurationmanager.appsettings.get("svnservicepassword") , configurationmanager.appsettings.get("svnservicedomain") ); c.authentication.sslservertrusthandlers += new eventhandler<svnsslservertrusteventargs>(authentication_sslservertrusthandlers); collection<svnfileversioneventargs> fileversioncollection = new collection<svnfileversioneventargs>(); svnrevisionrange range = new svnrevisionrange(0, this.hooks.revision); svnfileversionsargs args = new svnfileversionsargs(); args.retrieveproperties = true; args.range = range; foreach (svnchangeitem item in log.changedpaths) { string path = this.repositorypath + item.path; bool gotfileversions = false; try { if (item.nodekind == svnnodekind.file) gotfileversions = c.getfileversions(svntarget.fromstring(path), args, out fileversioncollection);
the code above example of performing request, extremely inefficient. goal able select revision, , previous revision. example, if repository @ r185, want view file @ revision 100, , view same file's previous revision (which wouldn't know is), how can done?
i've looked @ c.getinfo() seems previous revision current commit.
thanks!
try getting versions you're looking for. i'm assuming log
instance of svnloggingeventargs
?
if so, use:
args.range = new svnrevisionrange(log.revision, log.revision - 1);
that way you'll retrieve changes revision, , because log.revision guaranteed revision number of change, if subtract one, have previous version.
Comments
Post a Comment