hg pull SOURCE now broken

Issue #69 resolved
Martijn Pieters created an issue

As of <<changeset 7932d098cb5f>> hg pull SOURCE is broken; so pulling from an explicit source:

$ hg pull ../some-hg-repo
hg pull: invalid arguments

This is with mercurial 1.2.1.

Comments (4)

  1. Martijn Pieters reporter

    Here is some debug output:

    (Pdb) pp func
    <function pull at 0x6467f0>
    (Pdb) s
    TypeError: "pull() got multiple values for keyword argument 'svn'"
    > /opt/local/lib/python2.5/site-packages/mercurial/util.py(718)check()
    -> return func(*args, **kwargs)
    (Pdb) pp args
    (<function check at 0x701930>,
     <mercurial.ui.ui object at 0x66d750>,
     <hgext.parentrevspec.parentrevspecrepo object at 0x65f390>,
    (Pdb) pp kwargs
    {'force': None,
     'rebase': None,
     'remotecmd': '',
     'rev': [],
     'ssh': '',
     'svn': None,
     'svn_stupid': None,
     'update': None}

    It looks like the source get's passed in as a positional argument (I see orig, ui, repo and a source string in args), and I also see no source keyword argument. Indeed, mercurial.commands.pull takes source as the 3rd argument:

    def pull(ui, repo, source="default", **opts):

    It appears that the only reason source is defined as a keyword, is to specify a default value. But because the hgsubversion wrapper not only specifies it as a keyword, but also has shifted it's position, an explicit source doesn't get matched against the correct parameter:

    def pull(orig, ui, repo, svn=None, svn_stupid=False, source="default", create_new_dest=False,
             *args, **opts):

    The solution should be easy enough: move the source keyword to the front of the keyword arguments:

    def pull(orig, ui, repo, source="default", svn=None, svn_stupid=False, create_new_dest=False,
             *args, **opts):

    That change certainly appears to fix this for me. However, I am relatively new to the mercurial codebase, so I'll leave it to more experienced devs to make this change or propose another.

  2. Log in to comment