[PATCH v2] rebase: make sure merge state is cleaned up for no-op rebases

Augie Fackler raf at durin42.com
Wed May 17 15:38:53 EDT 2017


On Tue, May 16, 2017 at 12:20:07PM -0700, Jeremy Fitzhardinge wrote:
> # HG changeset patch
> # User Jeremy Fitzhardinge <jsgf at fb.com>
> # Date 1494962309 25200
> #      Tue May 16 12:18:29 2017 -0700
> # Node ID 45e596670f05aba81f7caef7c778812028c7bc5a
> # Parent  cb26d4cdd0f71423edde7451daf49f6f30bb385b
> rebase: make sure merge state is cleaned up for no-op rebases
>
> If a rebase ends up doing a no-op commit, make sure the merge state is still cleaned up.
>
> Fix for issue5494.

Nit: this should be just (issue5494) on the summary line.

>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -418,6 +418,11 @@
>                                             editor=editor,
>                                             keepbranches=self.keepbranchesf,
>                                             date=self.date)
> +                    if newnode is None:
> +                        # If it ended up being a no-op commit, then the normal
> +                        # merge state clean-up path doesn't happen, so do it here.
> +                        # Fix issue5494
> +                        mergemod.mergestate.clean(repo)
>                  else:
>                      # Skip commit if we are collapsing
>                      repo.dirstate.beginparentchange()
> diff --git a/tests/test-rebase-emptycleanup.t b/tests/test-rebase-emptycleanup.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-rebase-emptycleanup.t

I'm -0 on the new test (it's likely one of the existing
test-rebase-*.t files could host this check?), but I've got a comment
below.

> @@ -0,0 +1,34 @@
> +  $ cat >> $HGRCPATH <<EOF

[...]

> +  $ hg resolve --list
> +  $ ls .hg/merge
> +  ls: .hg/merge: No such file or directory

On centos7, I get this:
-  ls: .hg/merge: No such file or directory
-  [1]
+  ls: cannot access .hg/merge: No such file or directory
+  [2]

So that's pretty great. Maybe use [ -e .hg/merge ] instead and just
use the exit code?

> +  [1]
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list