From 0ea53d29424b2f7297c2f8c108b90b48b534c3d8 Mon Sep 17 00:00:00 2001 From: Stanislau Hlebik Date: Mon, 30 Jan 2017 07:53:28 -0800 Subject: [PATCH] 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. --- remotenames.py | 5 +++++ tests/test-selective-pull.t | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/remotenames.py b/remotenames.py index d3b20e1db8..e1ae85ab42 100644 --- a/remotenames.py +++ b/remotenames.py @@ -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 diff --git a/tests/test-selective-pull.t b/tests/test-selective-pull.t index 8654e52c86..9c64eca736 100644 --- a/tests/test-selective-pull.t +++ b/tests/test-selective-pull.t @@ -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