[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Suggestion for: "Improve svn log with 'forward' revision range" (Issue 3830)

From: Ruhe Julian <jruhe_at_axway.com>
Date: Fri, 2 Mar 2012 14:04:44 +0000

Hi,

Stefan Sperling asked me to post some details in respect of a suggestion I wanted to make for issue 3830
http://subversion.tigris.org/issues/show_bug.cgi?id=3830

It took me some time to understand that it is _not_ possible for the svn client to display the future of an object in some revision when it no longer resists on the initial path or was replaced by another object on the same path.
Well, here is the pseudo code of my algorithm to determine the forward history & backward history of a svn path_at_peg in logarithmic time (it should terminate quickly in most real world situations):

log[] getFullRemoteLog(urlOfObject, revOfObject)
                url = urlOfObject
                peg = revOfObject
                // start to fetch complete forward & backward log of url_at_peg
                endRev = repsitory.getLastChangedRevision()
                try
                                // first try the regular way

                                // using HEAD instead of HEAD's rev number as endRev produces wrong results in svn 1.6.
                                // see http://subversion.tigris.org/issues/show_bug.cgi?id=3931
                                return svn log url_at_peg -r endRev:1
                catch exception
                                // OK, no problem. Remote file does no longer exist on HEAD. Proceed.

                startRev = peg
                youngestRev = determineYoungestRevision(url, startRev.number(), endRev.number(), false)
                return svn log url_at_peg -r youngestRev:1

rev determineYoungestRevision(url, startRev, endRev, objectFound)
                if startRev == endRev
                                return startRev

                testRev = startRev + (endRev - startRev) / 2
                if objectFound
                                try
                                                svn info url_at_testRev -r startRev
                                                // test revision exists => proceed forward in history
                                                determineYoungestRevision(url, testRev, endRev, true)
                                catch exception
                                                // test revision does not exist => go backward in history
                                                determineYoungestRevision(url, startRev, testRev - 1 , true)

                // right object not yet found
                try
                                log[] = svn log url_at_testRev -r testRev:1
                                // object hit! But is it the right one?
                                for i:log.length // no need to improve as svn requests dominate Running time
                                                if log[i - 1].getRevision() >= startRev && log[i].getRevision() <= startRev
                                                                // right object found! Now find youngest object revision.
                                                                return determineYoungestRevision(url, log[0].getRevision(), endRev, true)
                                // not the right object!
                                return determineYoungestRevision(url, startRev, log[log.length - 1].getRevision() - 2, false)
                catch exception
                                // no object hit!
                                return determineLastYoungestRevision(url, startRev, testRev.getNumber() - 1, false)

Greetings,
Julian
p.s. please cc me. I am not subscribed
Received on 2012-03-02 15:13:11 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.