Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 45772:294aab57a5f3
phabsend: use default one-line summary
This means that the `phabricator.node` and `phabricator.desc` color
configs will no longer be respected, but `log.changeset` and
`log.desc` will be respected instead.
Differential Revision: https://phab.mercurial-scm.org/D9254
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 27 Oct 2020 10:22:36 -0700 |
parents | c7fe0dfb5312 |
children | 89a2afe31e82 |
comparison
equal
deleted
inserted
replaced
45771:f90a5c211251 | 45772:294aab57a5f3 |
---|---|
139 | 139 |
140 colortable = { | 140 colortable = { |
141 b'phabricator.action.created': b'green', | 141 b'phabricator.action.created': b'green', |
142 b'phabricator.action.skipped': b'magenta', | 142 b'phabricator.action.skipped': b'magenta', |
143 b'phabricator.action.updated': b'magenta', | 143 b'phabricator.action.updated': b'magenta', |
144 b'phabricator.desc': b'', | |
145 b'phabricator.drev': b'bold', | 144 b'phabricator.drev': b'bold', |
146 b'phabricator.node': b'', | |
147 b'phabricator.status.abandoned': b'magenta dim', | 145 b'phabricator.status.abandoned': b'magenta dim', |
148 b'phabricator.status.accepted': b'green bold', | 146 b'phabricator.status.accepted': b'green bold', |
149 b'phabricator.status.closed': b'green', | 147 b'phabricator.status.closed': b'green', |
150 b'phabricator.status.needsreview': b'yellow', | 148 b'phabricator.status.needsreview': b'yellow', |
151 b'phabricator.status.needsrevision': b'red', | 149 b'phabricator.status.needsrevision': b'red', |
1218 b'updated': _(b'updated'), | 1216 b'updated': _(b'updated'), |
1219 }[action], | 1217 }[action], |
1220 b'phabricator.action.%s' % action, | 1218 b'phabricator.action.%s' % action, |
1221 ) | 1219 ) |
1222 drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev') | 1220 drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev') |
1223 nodedesc = ui.label(bytes(ctx), b'phabricator.node') | 1221 summary = cmdutil.format_changeset_summary(ui, ctx, b'phabsend') |
1224 desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc') | 1222 ui.write(_(b'%s - %s - %s\n') % (drevdesc, actiondesc, summary)) |
1225 ui.write(_(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc)) | |
1226 | 1223 |
1227 | 1224 |
1228 def _amend_diff_properties(unfi, drevid, newnodes, diff): | 1225 def _amend_diff_properties(unfi, drevid, newnodes, diff): |
1229 """update the local commit list for the ``diff`` associated with ``drevid`` | 1226 """update the local commit list for the ``diff`` associated with ``drevid`` |
1230 | 1227 |
1640 def _confirmbeforesend(repo, revs, oldmap): | 1637 def _confirmbeforesend(repo, revs, oldmap): |
1641 url, token = readurltoken(repo.ui) | 1638 url, token = readurltoken(repo.ui) |
1642 ui = repo.ui | 1639 ui = repo.ui |
1643 for rev in revs: | 1640 for rev in revs: |
1644 ctx = repo[rev] | 1641 ctx = repo[rev] |
1645 desc = ctx.description().splitlines()[0] | |
1646 oldnode, olddiff, drevid = oldmap.get(ctx.node(), (None, None, None)) | 1642 oldnode, olddiff, drevid = oldmap.get(ctx.node(), (None, None, None)) |
1647 if drevid: | 1643 if drevid: |
1648 drevdesc = ui.label(b'D%d' % drevid, b'phabricator.drev') | 1644 drevdesc = ui.label(b'D%d' % drevid, b'phabricator.drev') |
1649 else: | 1645 else: |
1650 drevdesc = ui.label(_(b'NEW'), b'phabricator.drev') | 1646 drevdesc = ui.label(_(b'NEW'), b'phabricator.drev') |
1651 | 1647 |
1652 ui.write( | 1648 ui.write( |
1653 _(b'%s - %s: %s\n') | 1649 _(b'%s - %s\n') |
1654 % ( | 1650 % ( |
1655 drevdesc, | 1651 drevdesc, |
1656 ui.label(bytes(ctx), b'phabricator.node'), | 1652 cmdutil.format_changeset_summary(ui, ctx, b'phabsend'), |
1657 ui.label(desc, b'phabricator.desc'), | |
1658 ) | 1653 ) |
1659 ) | 1654 ) |
1660 | 1655 |
1661 if ui.promptchoice( | 1656 if ui.promptchoice( |
1662 _(b'Send the above changes to %s (Y/n)?$$ &Yes $$ &No') % url | 1657 _(b'Send the above changes to %s (Y/n)?$$ &Yes $$ &No') % url |