contrib/phabricator.py
changeset 33996 088598153aa2
parent 33995 edeb8f28c031
child 34080 941c33cfde81
--- a/contrib/phabricator.py	Thu Aug 24 17:31:33 2017 -0700
+++ b/contrib/phabricator.py	Thu Aug 24 17:44:08 2017 -0700
@@ -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(bytes(ctx), 'phabricator.node'),
+                                       ui.label(desc, 'phabricator.desc')))
 
     if ui.promptchoice(_('Send the above changes to %s (yn)?'
                          '$$ &Yes $$ &No') % url):