Patchwork phabricator: preserve the phase when amending in the Differential fields

login
register
mail settings
Submitter Matt Harbison
Date June 16, 2018, 2:55 a.m.
Message ID <b9b8a6cd6b71dacc3e90.1529117720@Envy>
Download mbox | patch
Permalink /patch/32186/
State Accepted
Headers show

Comments

Matt Harbison - June 16, 2018, 2:55 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.)
Yuya Nishihara - June 16, 2018, 1:10 p.m.
On Fri, 15 Jun 2018 22:55:20 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@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

Queued, thanks.

Patch

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()])