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

Re: [Svnmerge] Re: [PATCH] svnmerge.py: Refactor analyze_revs

From: Giovanni Bajo <rasky_at_develer.com>
Date: 2006-03-03 02:41:08 CET

>David James <djames@collab.net> wrote:

>> [[[
>> Refactor analyze_revs, creating a separate function called
>> "find_changes" for finding which revisions and merges affect a given
>> URL.
>>
>> * contrib/client-side/svnmerge.py
>> (find_changes): New function.
>> (analyze_revs): Use find_changes function.
>> ]]]

+1 on the general idea and thanks for the cleanup. Some comments:

>> +def find_changes(url, begin, end, show_merges=False):

find_merges, more than show_merges. It doesn't really show anything.

>> + revs = []
>> + merges = {}

Move these immediatly above the loop that fills them.

>> + rev = None

Unneded.

>> + previous_merge_props = {}

The start value should probably be None, as you don't know the state of the
property before the first change that modifies it in the [begin, end] range.

>> + for line in launchsvn("log %s" % log_opts):

Many thanks for using this form, as launchsvn() will change to return a pipe
ASAP.

>> + if merge_props != previous_merge_props:
>> + merges[rev] = merge_props

Forgot to update previous_merge_props.

>>+ old_props = {}
>>+ for rev in merge_revs:
>>+ new_props = merges[rev]
>> old_revisions = old_props.get(target_dir)
>> new_revisions = new_props.get(target_dir)
>>
>> if new_revisions != old_revisions:
>> reflected_revs.append("%s" % rev)
>>
>>+ old_props = new_props

I might be wrong, but isns't old_revisions enough?

old_revs = None
for r in merge_revs:
    new_revs = merges[r].get(target_dir)
    if new_revs != old_revs:
       reflected_revs.append(str(r))
   old_revs = new_revs

Giovanni Bajo

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 3 02:41:43 2006

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.