Re: contribution: git-move-heads.py

Michael Haggerty <[email protected]>
Newsgroups gmane.comp.version-control.subversion.cvs2svn.user
Message-ID <[email protected]>
Steve Folly wrote:
> Attached is a script for cvs2git that combines moving tags and head
> references. Give the options --tags and/or --heads depending on which
> refs you want to move.

Thanks for the new version of the script.  Sorry for the delay in
responding.

While glancing through the new version, I noticed a few things that seem
strange to me:

1. At the top of process_refs(), it looks like you want to clear the
global variables tree_cache and parent_cache.  But when a variable name
is written to within a function, it is treated as a (new) local
variable.  If you want to rebind the global variables, then you have to
use a "global" statement to specify that the names within process_refs()
refer to the global variables:

def process_refs(ref_type):
    global tree_cache, parent_cache
    tree_cache = {}
    parent_cache = {}
    # ...

Or you could simply clear the dictionaries without rebinding the global
references:

def process_refs(ref_type):
    tree_cache.clear()
    parent_cache.clear()
    # ...

2. The move_ref() function wants a "ref_type" as its last argument, but
in try_to_move_ref() it is called as follows:

    move_ref(ref, commit, p, ref)

Should the last argument be "ref_type"?

3. Please don't use Python's conditional expression syntax "x if b else
y" as we are still trying to retain compatibility with Python 2.4.

Yours,
Michael

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1670&dsMessageId=2459292

To unsubscribe from this discussion, e-mail: [[email protected]].
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.