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@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@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@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@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@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@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

Reply via email to