Patchwork D514: phabsend: show associated Differential Revisions with --confirm

login
register
mail settings
Submitter phabricator
Date Aug. 25, 2017, 4:02 a.m.
Message ID <a766b38c1f9cac41dd19cce44684c0b3@localhost.localdomain>
Download mbox | patch
Permalink /patch/23318/
State Not Applicable
Headers show

Comments

phabricator - Aug. 25, 2017, 4:02 a.m.
quark updated this revision to Diff 1275.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D514?vs=1271&id=1275

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -378,10 +378,13 @@ 
     if opts.get('amend'):
         cmdutil.checkunfinished(repo)
 
+    # {newnode: (oldnode, olddiff, olddrev}
+    oldmap = getoldnodedrevmap(repo, [repo[r].node() for r in revs])
+
     confirm = ui.configbool('phabsend', 'confirm')
     confirm |= bool(opts.get('confirm'))
     if confirm:
-        confirmed = _confirmbeforesend(repo, revs)
+        confirmed = _confirmbeforesend(repo, revs, oldmap)
         if not confirmed:
             raise error.Abort(_('phabsend cancelled'))
 
@@ -391,9 +394,6 @@ 
         phids = userphids(repo, reviewers)
         actions.append({'type': 'reviewers.add', 'value': phids})
 
-    # {newnode: (oldnode, olddiff, olddrev}
-    oldmap = getoldnodedrevmap(repo, [repo[r].node() for r in revs])
-
     drevids = [] # [int]
     diffmap = {} # {newnode: diff}
 
@@ -474,14 +474,21 @@ 
 _metanamemap = util.sortdict([(r'user', 'User'), (r'date', 'Date'),
                               (r'node', 'Node ID'), (r'parent', 'Parent ')])
 
-def _confirmbeforesend(repo, revs):
+def _confirmbeforesend(repo, revs, oldmap):
     url, token = readurltoken(repo)
     ui = repo.ui
     for rev in revs:
         ctx = repo[rev]
         desc = ctx.description().splitlines()[0]
-        ui.write(('%d: ' % rev), label='phabsend.revnumber')
-        ui.write(('%s\n' % desc), label='phabsend.desc')
+        oldnode, olddiff, drevid = oldmap.get(ctx.node(), (None, None, None))
+        if drevid:
+            drevdesc = ui.label('D%s' % drevid, 'phabricator.drev')
+        else:
+            drevdesc = ui.label(_('NEW'), 'phabricator.drev')
+
+        ui.write(_('%s - %s: %s\n') % (drevdesc,
+                                       ui.label(str(ctx), 'phabricator.node'),
+                                       ui.label(desc, 'phabricator.desc')))
 
     if ui.promptchoice(_('Send the above changes to %s (yn)?'
                          '$$ &Yes $$ &No') % url):