[Updated] D8732: rebase: correctly check for empty commit in in-memory mode

Phabricator phabricator at mercurial-scm.org
Tue Jul 14 04:53:38 UTC 2020


Closed by commit rHG0ecb3b11fcad: rebase: correctly check for empty commit in in-memory mode (authored by Manuel Jacob <me at manueljacob.de>).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8732?vs=21865&id=21883

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8732/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8732

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -949,14 +949,11 @@
   |/
   o  0: d20a80d4def3 'base'
   
-FIXME: It's broken for inmemory merges.
   $ hg rebase -s 2 -d 3
   rebasing 2:0194f1db184a "b"
   note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
   rebasing 4:59c8292117b1 "merge" (tip)
-  note: not rebasing 4:59c8292117b1 "merge" (tip), its destination already has all its changes (true !)
   saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
-#if false
   $ hg tglog
   o    3: 506e2454484b 'merge'
   |\
@@ -966,4 +963,3 @@
   |/
   o  0: d20a80d4def3 'base'
   
-#endif
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1427,12 +1427,6 @@
 def commitmemorynode(repo, wctx, editor, extra, user, date, commitmsg):
     '''Commit the memory changes with parents p1 and p2.
     Return node of committed revision.'''
-    # FIXME: make empty commit check consistent with ``repo.commit``
-    if wctx.nofilechanges() and not repo.ui.configbool(
-        b'ui', b'allowemptycommit'
-    ):
-        return None
-
     # By convention, ``extra['branch']`` (set by extrafn) clobbers
     # ``branch`` (used when passing ``--keepbranches``).
     branch = None
@@ -1447,6 +1441,8 @@
         branch=branch,
         editor=editor,
     )
+    if memctx.isempty() and not repo.ui.configbool(b'ui', b'allowemptycommit'):
+        return None
     commitres = repo.commitctx(memctx)
     wctx.clean()  # Might be reused
     return commitres



To: mjacob, martinvonz, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200714/71593f0c/attachment-0002.html>


More information about the Mercurial-patches mailing list