selectivepull: fix passing heads argument multiple times

Usually `heads` are passed using kwargs but sometimes they are passed using
args (for example, during clone). In this case we set in kwargs and args
and orig call fails. This patch fixes it.

Also change the tests to cover this behaviour.
This commit is contained in:
Stanislau Hlebik 2017-01-30 07:53:28 -08:00
parent a4e7efbbbc
commit 0ea53d2942
2 changed files with 6 additions and 1 deletions

View File

@ -133,6 +133,11 @@ def expull(orig, repo, remote, *args, **kwargs):
bookmarks[bookmark] = remotebookmarks[bookmark]
else:
heads = kwargs.get('heads') or []
# heads may be passed as positional args
if len(args) > 0:
if args[0]:
heads = args[0]
args = args[1:]
for bookmark in bookmarks:
heads.append(remote.lookup(remotebookmarks[bookmark]))
kwargs['bookmarks'] = bookmarks

View File

@ -97,7 +97,7 @@ Specify bookmark to pull
Create second remote
$ cd ..
$ hg clone -q remoterepo secondremoterepo
$ hg clone -q ssh://user@dummy/remoterepo secondremoterepo
$ cd secondremoterepo
$ hg up -q 0238718db2b1
$ hg book master