I am using SVN kit to collect some metrics SVN repository. I am related to this simple problem and I am unable to get it.
I have an SVNrepository object that gives me the path to all the files in the repository and their various modifications. I want to set the previous revision value for each revision, how can I do without checking that file? Or what's the best way to do this instead that my code can be better performance?
It should also be considered on copy / paste and should be used while assigning the previous revision.
// This is where I query the SVN server if (! EntryPath.getType () = SVNLogEntryPath.TYPE_ADDED) {LogEntryPreviousRevFinder handler = new LogEntryPreviousRevFinder (workingFileName.substring (interestingPath.length ()), ThisRevision; // In the last 3 revisions, start investigating previous revised amendments for this file. // If not tried for the last 5 and again 7 If not found, then warn and continue. // This is necessary because a branch at SVN is done at the level of the operating folder and not the file / so we need to go back and find out the amendment compared to the previous revised. For (int i = 3; i & lt; = 7; i + = 2) [{repository.log (new String] {workingFileName}, thisRevision, 0L, true, false, I, handler); If (handler .isSuccess ()) {prevPath = handler.getPreviousPath (); PrevRevision = Handler .get preview (); break; } And {continue; }} That {log.warn ( "Failed to find the last modification to the file:" + workingFileName + "added to this amendment as it considered the continents: Will") (handler.isSuccess ()!); }} Else {// SVNLogEntryPath.TYPE_ADDED files with either been added to this amendment / or copied from an existing file or its name has been changed. If the latter, we will be used to calculate the relative file as needed to identify copy path // metric and that the latter may be important Flux (entryPath.getCopyPath () = null & Amp;! Amp; entryPath.getCopyPath () .tim (.) Length ()> gt;) {prevPath = entryPath.getCopyPath (); PrevRevision = entryPath.getCopyRevision (); } Else {log.debug ("file:" + + workflow name + "added to this revision"); }} ISVNLogEntryHandler implementation:
// ISVNLogEntryHandler last amendment applies to implementation to identify private class LogEntryPreviousRevFinder ISVNLogEntryHandler {private String interestingFile; Private string backpath; Private this amendment; Private long last revision; The success of the private boolean is; Public Login Engineer Previous Riffinder (string interesting file, long revision) {this.interestingFile = interestingFile; this. This amendment = amendment; IsSuccess = false; } @ Override Public Wide Handlog Entry (SVNOG Entry Log Engine) throws SVNE expedition {if (Hashiots) returns; If (this revision returns == loginentry.get revision ()); Set change pathset = logindri.gate changelog (). KeySet (); (; ChangedPaths.hasNext (); Iterator for changedPaths = changedPathsSet.iterator ()). {SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths () find (changedPaths.next ()); String workfilename = entrypath.gatepath (); If (workingFileName.endsWith (interesting file)) {previousRevision = logEntry.getRevision (); Previous path = function filename; IsSuccess = true; }}} Public long-standing preview () {refund the previous revision; } Receive public stringsPrevious () {back past text; } Public Boolean Success () {Return is Success; }} I am surprised that there is a better and more efficient way to do this.
Comments
Post a Comment