[PATCH] phabricator: preserve the phase when amending in the Differential fields

Matt Harbison mharbison72 at gmail.com
Sat Jun 16 02:55:20 UTC 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1528994104 14400
#      Thu Jun 14 12:35:04 2018 -0400
# Node ID b9b8a6cd6b71dacc3e901295d0dae11aa0b04d22
# Parent  c924e7dbcd0ff8bf2f7ab9e5bde5f6679d70a894
phabricator: preserve the phase when amending in the Differential fields

I have no idea if it's better to change scmutil.cleanupnodes() so that it has
the option to either apply a specific phase (e.g. for various --secret switches)
or carry over the phase of the old node.  The benefit would be that the caller
doesn't have to remember to do this.  The con is maybe inefficiency?  I wrote
this up as issue5918.  I'm leaving that open since Yuya flagged it as an API
bug.

Since most other callers already do this, it's the simplest fix.  (It's not
obvious that `split`, `fix` and `rebase` are doing this, but there is test
coverage for `fix` and `rebase`, and experimenting with `split` shows it does
the right thing.)

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -579,7 +579,11 @@ def phabsend(ui, repo, *revs, **opts):
                     new = context.metadataonlyctx(
                         repo, old, parents=parents, text=newdesc,
                         user=old.user(), date=old.date(), extra=old.extra())
-                    newnode = new.commit()
+
+                    overrides = {('phases', 'new-commit'): old.phase()}
+                    with ui.configoverride(overrides, 'phabsend'):
+                        newnode = new.commit()
+
                     mapping[old.node()] = [newnode]
                     # Update diff property
                     writediffproperties(unfi[newnode], diffmap[old.node()])


More information about the Mercurial-devel mailing list