@@ 1298,7 1298,10 @@ for opt in newbug_opts:
newbug_opts_for_phexport.append(tuple(opt))
@command(b'phexport', [
- (b'm', b'comment', b'', b'Comment to add with updated commit', B'TEXT'),
+ (b'm', b'comment', b'',
+ b'Comment to add with updated commit', B'TEXT'),
+ (b'', b'same', False,
+ b'Reuse the comment, reviewers, etc. for all updated commits'),
(b'e', b'edit', False,
b'Open a text editor to modify fields'),
(b't', b'to', b'',
@@ 1801,8 1804,8 @@ def _bzexport_phabsend(ui, repo, opts, r
revs = repo.anyrevs([rev.encode()], user=True)
revs.sort()
- if len(revs) > 1 and not opts['edit']:
- raise error.Abort("Multiple revisions require --edit flag")
+ if len(revs) > 1 and not opts['edit'] and not opts['same']:
+ raise error.Abort("Multiple revisions require --edit or --same flag")
if opts['new']:
values = edit_form(ui, repo, values, 'new_bug_template')
@@ 1818,22 1821,33 @@ def _bzexport_phabsend(ui, repo, opts, r
return '"%s"' % short
return '"%s"...' % short[0:MAXLEN-3]
+ def restdesc(s):
+ try:
+ idx = s.index("\n")
+ return s[idx+1:]
+ except ValueError:
+ return "<none>"
+
multi_values = [{
'REVISION': rev,
'DESC_FIRSTLINE': shortdesc(stringify(repo[rev].description())),
+ 'ATTACHCOMMENT': restdesc(stringify(repo[rev].description())),
} for rev in revs]
+ # A message given on the command line will only apply to the first patch
+ # unless the --same flag is given.
+ idxes = [0] if not opts.get('same') else range(len(multi_values))
+ if opts.get('comment'):
+ for idx in idxes:
+ multi_values[idx]['ATTACHCOMMENT'] = opts['comment']
+
if opts['edit']:
- # A message given on the command line will only apply to the first patch.
- if values.get('ATTACHCOMMENT', '<none>') != '<none>':
- for i in range(1, len(multi_values)):
- multi_values[i]['ATTACHCOMMENT'] = '<none>' if i else opts['comment']
-
value_sets = multi_edit_form(ui, repo, values, multi_values,
'phab_update_template', b"phab_update.txt")
else:
value_sets = multi_values
- value_sets[0].update(values)
+ for idx in idxes:
+ value_sets[idx].update(values)
value_sets = [
fill_values(values, ui, repo, api_server, finalize=True, patchdata=contents)