phabricator: preserve the phase when amending in the Differential fields
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 14 Jun 2018 12:35:04 -0400
changeset 38342 bb7e3c6ef592
parent 38341 7b12a2d2eedc
child 38343 756a7682837f
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.)
contrib/phabricator.py
--- a/contrib/phabricator.py	Sat Jun 16 19:31:07 2018 +0900
+++ b/contrib/phabricator.py	Thu Jun 14 12:35:04 2018 -0400
@@ -579,7 +579,11 @@
                     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()])