26 # leave the attribute unspecified. |
26 # leave the attribute unspecified. |
27 testedwith = 'ships-with-hg-core' |
27 testedwith = 'ships-with-hg-core' |
28 |
28 |
29 commitopts = cmdutil.commitopts |
29 commitopts = cmdutil.commitopts |
30 commitopts2 = cmdutil.commitopts2 |
30 commitopts2 = cmdutil.commitopts2 |
31 commitopts3 = [('r', 'rev', [], |
31 commitopts3 = [('r', 'rev', [], _('revision to check'), _('REV'))] |
32 _('revision to check'), _('REV'))] |
|
33 |
32 |
34 @command('close-head|close-heads', commitopts + commitopts2 + commitopts3, |
33 |
|
34 @command( |
|
35 'close-head|close-heads', |
|
36 commitopts + commitopts2 + commitopts3, |
35 _('[OPTION]... [REV]...'), |
37 _('[OPTION]... [REV]...'), |
36 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT, |
38 helpcategory=command.CATEGORY_CHANGE_MANAGEMENT, |
37 inferrepo=True) |
39 inferrepo=True, |
|
40 ) |
38 def close_branch(ui, repo, *revs, **opts): |
41 def close_branch(ui, repo, *revs, **opts): |
39 """close the given head revisions |
42 """close the given head revisions |
40 |
43 |
41 This is equivalent to checking out each revision in a clean tree and running |
44 This is equivalent to checking out each revision in a clean tree and running |
42 ``hg commit --close-branch``, except that it doesn't change the working |
45 ``hg commit --close-branch``, except that it doesn't change the working |
43 directory. |
46 directory. |
44 |
47 |
45 The commit message must be specified with -l or -m. |
48 The commit message must be specified with -l or -m. |
46 """ |
49 """ |
|
50 |
47 def docommit(rev): |
51 def docommit(rev): |
48 cctx = context.memctx(repo, parents=[rev, None], text=message, |
52 cctx = context.memctx( |
49 files=[], filectxfn=None, user=opts.get('user'), |
53 repo, |
50 date=opts.get('date'), extra=extra) |
54 parents=[rev, None], |
|
55 text=message, |
|
56 files=[], |
|
57 filectxfn=None, |
|
58 user=opts.get('user'), |
|
59 date=opts.get('date'), |
|
60 extra=extra, |
|
61 ) |
51 tr = repo.transaction('commit') |
62 tr = repo.transaction('commit') |
52 ret = repo.commitctx(cctx, True) |
63 ret = repo.commitctx(cctx, True) |
53 bookmarks.update(repo, [rev, None], ret) |
64 bookmarks.update(repo, [rev, None], ret) |
54 cctx.markcommitted(ret) |
65 cctx.markcommitted(ret) |
55 tr.close() |
66 tr.close() |