rebase: accept multiple --base arguments (BC)
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 13 Mar 2020 16:57:38 -0700
changeset 44556 f63598aa1c4b
parent 44555 05654ea5137c
child 44557 254c5f71e2df
rebase: accept multiple --base arguments (BC) Same reasoning as for the previous patch. Rebase has worked well with `--base 'A + B'` since 51e7c83e05ee (rebase: calculate ancestors for --base separately (issue5420), 2016-11-28). Differential Revision: https://phab.mercurial-scm.org/D8293
hgext/rebase.py
relnotes/next
tests/test-rebase-dest.t
--- a/hgext/rebase.py	Fri Mar 13 16:39:32 2020 -0700
+++ b/hgext/rebase.py	Fri Mar 13 16:57:38 2020 -0700
@@ -822,7 +822,7 @@
         (
             b'b',
             b'base',
-            b'',
+            [],
             _(b'rebase everything from branching point of specified changeset'),
             _(b'REV'),
         ),
@@ -871,7 +871,7 @@
     + cmdutil.dryrunopts
     + cmdutil.formatteropts
     + cmdutil.confirmopts,
-    _(b'[[-s REV]... | -b REV | [-r REV]...] [-d REV] [OPTION]...'),
+    _(b'[[-s REV]... | [-b REV]... | [-r REV]...] [-d REV] [OPTION]...'),
     helpcategory=command.CATEGORY_CHANGE_MANAGEMENT,
 )
 def rebase(ui, repo, **opts):
@@ -1187,7 +1187,7 @@
                 inmemory,
                 opts.get(b'dest', None),
                 opts.get(b'source', []),
-                opts.get(b'base', None),
+                opts.get(b'base', []),
                 opts.get(b'rev', []),
                 destspace=destspace,
             )
@@ -1250,7 +1250,7 @@
         # `+  (%ld)` to work around `wdir()::` being empty
         rebaseset = repo.revs(b'(%ld):: + (%ld)', src, src)
     else:
-        base = scmutil.revrange(repo, [basef or b'.'])
+        base = scmutil.revrange(repo, basef or [b'.'])
         if not base:
             ui.status(
                 _(b'empty "base" revision set - ' b"can't compute rebase set\n")
--- a/relnotes/next	Fri Mar 13 16:39:32 2020 -0700
+++ b/relnotes/next	Fri Mar 13 16:57:38 2020 -0700
@@ -58,12 +58,12 @@
    can use the new `conflictparents()` revset for finding the other
    parent during a conflict.
 
- * `hg rebase` now accepts repeated `--source` arguments. For example,
-   `hg rebase --source 'A + B'` is equivalent to `hg rebase --source A
-   --source B`. This is a backwards-incompatible change because it
-   will break overriding an alias `myrebase = rebase --source A` by
-   `hg myrebase --source B` (it will now rebase `(A + B)::` instead of
-   `B::`).
+ * `hg rebase` now accepts repeated `--source` and `--base`
+   arguments. For example, `hg rebase --source 'A + B'` is equivalent
+   to `hg rebase --source A --source B`. This is a
+   backwards-incompatible change because it will break overriding an
+   alias `myrebase = rebase --source A` by `hg myrebase --source B`
+   (it will now rebase `(A + B)::` instead of `B::`).
 
  * `hg recover` does not verify the validity of the whole repository
    anymore. You can pass `--verify` or call `hg verify` if necessary.
--- a/tests/test-rebase-dest.t	Fri Mar 13 16:39:32 2020 -0700
+++ b/tests/test-rebase-dest.t	Fri Mar 13 16:57:38 2020 -0700
@@ -156,7 +156,7 @@
 
 Multiple destinations cannot be used with --base:
 
-  $ rebasewithdag -b B+E -d 'SRC^^' --collapse <<'EOS'
+  $ rebasewithdag -b B -b E -d 'SRC^^' --collapse <<'EOS'
   > B E
   > | |
   > A D