Show More
@@ -9,7 +9,7 b'' | |||||
9 | This extension provides a ``phabsend`` command which sends a stack of |
|
9 | This extension provides a ``phabsend`` command which sends a stack of | |
10 | changesets to Phabricator without amending commit messages, and a ``phabread`` |
|
10 | changesets to Phabricator without amending commit messages, and a ``phabread`` | |
11 | command which prints a stack of revisions in a format suitable |
|
11 | command which prints a stack of revisions in a format suitable | |
12 | for :hg:`import`. |
|
12 | for :hg:`import`, and a ``phabupdate`` command to update statuses in batch. | |
13 |
|
13 | |||
14 | By default, Phabricator requires ``Test Plan`` which might prevent some |
|
14 | By default, Phabricator requires ``Test Plan`` which might prevent some | |
15 | changeset from being sent. The requirement could be disabled by changing |
|
15 | changeset from being sent. The requirement could be disabled by changing | |
@@ -798,3 +798,32 b' def phabread(ui, repo, spec, **opts):' | |||||
798 | spec = ':(%s)' % spec |
|
798 | spec = ':(%s)' % spec | |
799 | drevs = querydrev(repo, spec) |
|
799 | drevs = querydrev(repo, spec) | |
800 | readpatch(repo, drevs, ui.write) |
|
800 | readpatch(repo, drevs, ui.write) | |
|
801 | ||||
|
802 | @command('phabupdate', | |||
|
803 | [('', 'accept', False, _('accept revisions')), | |||
|
804 | ('', 'reject', False, _('reject revisions')), | |||
|
805 | ('', 'abandon', False, _('abandon revisions')), | |||
|
806 | ('', 'reclaim', False, _('reclaim revisions')), | |||
|
807 | ('m', 'comment', '', _('comment on the last revision')), | |||
|
808 | ], _('DREVSPEC [OPTIONS]')) | |||
|
809 | def phabupdate(ui, repo, spec, **opts): | |||
|
810 | """update Differential Revision in batch | |||
|
811 | ||||
|
812 | DREVSPEC selects revisions. See :hg:`help phabread` for its usage. | |||
|
813 | """ | |||
|
814 | flags = [n for n in 'accept reject abandon reclaim'.split() if opts.get(n)] | |||
|
815 | if len(flags) > 1: | |||
|
816 | raise error.Abort(_('%s cannot be used together') % ', '.join(flags)) | |||
|
817 | ||||
|
818 | actions = [] | |||
|
819 | for f in flags: | |||
|
820 | actions.append({'type': f, 'value': 'true'}) | |||
|
821 | ||||
|
822 | drevs = querydrev(repo, spec) | |||
|
823 | for i, drev in enumerate(drevs): | |||
|
824 | if i + 1 == len(drevs) and opts.get('comment'): | |||
|
825 | actions.append({'type': 'comment', 'value': opts['comment']}) | |||
|
826 | if actions: | |||
|
827 | params = {'objectIdentifier': drev[r'phid'], | |||
|
828 | 'transactions': actions} | |||
|
829 | callconduit(repo, 'differential.revision.edit', params) |
General Comments 0
You need to be logged in to leave comments.
Login now