Show More
@@ -1073,9 +1073,10 def branch(ui, repo, label=None, **opts) | |||
|
1073 | 1073 | |
|
1074 | 1074 | @command('branches', |
|
1075 | 1075 | [('a', 'active', False, _('show only branches that have unmerged heads')), |
|
1076 |
('c', 'closed', False, _('show normal and closed branches')) |
|
|
1076 | ('c', 'closed', False, _('show normal and closed branches')), | |
|
1077 | ] + formatteropts, | |
|
1077 | 1078 | _('[-ac]')) |
|
1078 | def branches(ui, repo, active=False, closed=False): | |
|
1079 | def branches(ui, repo, active=False, closed=False, **opts): | |
|
1079 | 1080 | """list repository named branches |
|
1080 | 1081 | |
|
1081 | 1082 | List the repository's named branches, indicating which ones are |
@@ -1090,7 +1091,8 def branches(ui, repo, active=False, clo | |||
|
1090 | 1091 | Returns 0. |
|
1091 | 1092 | """ |
|
1092 | 1093 | |
|
1093 | hexfunc = ui.debugflag and hex or short | |
|
1094 | fm = ui.formatter('branches', opts) | |
|
1095 | hexfunc = fm.hexfunc | |
|
1094 | 1096 | |
|
1095 | 1097 | allheads = set(repo.heads()) |
|
1096 | 1098 | branches = [] |
@@ -1116,16 +1118,20 def branches(ui, repo, active=False, clo | |||
|
1116 | 1118 | notice = _(' (inactive)') |
|
1117 | 1119 | if tag == repo.dirstate.branch(): |
|
1118 | 1120 | label = 'branches.current' |
|
1121 | ||
|
1122 | fm.startitem() | |
|
1123 | fm.write('branch', '%s', tag, label=label) | |
|
1119 | 1124 | rev = ctx.rev() |
|
1120 | 1125 | padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0) |
|
1121 | 1126 | fmt = ' ' * padsize + '%d:%s' |
|
1122 | rev = ui.label(fmt % (rev, hexfunc(ctx.node())), | |
|
1123 | 'log.changeset changeset.%s' % ctx.phasestr()) | |
|
1124 | labeledtag = ui.label(tag, label) | |
|
1125 | if ui.quiet: | |
|
1126 | ui.write("%s\n" % labeledtag) | |
|
1127 | else: | |
|
1128 | ui.write("%s %s%s\n" % (labeledtag, rev, notice)) | |
|
1127 | if not ui.quiet: | |
|
1128 | fm.plain(' ') | |
|
1129 | fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()), | |
|
1130 | label='log.changeset changeset.%s' % ctx.phasestr()) | |
|
1131 | if not ui.quiet: | |
|
1132 | fm.plain(notice) | |
|
1133 | fm.plain('\n') | |
|
1134 | fm.end() | |
|
1129 | 1135 | |
|
1130 | 1136 | @command('bundle', |
|
1131 | 1137 | [('f', 'force', None, _('run even when the destination is unrelated')), |
@@ -470,4 +470,35 custom closed branch color: | |||
|
470 | 470 | \x1b[0;35ma\x1b[0m \x1b[0;36m 5:d8cbc61dbaa6\x1b[0m (inactive) (esc) |
|
471 | 471 | \x1b[0;35mdefault\x1b[0m \x1b[0;36m 0:19709c5a4e75\x1b[0m (inactive) (esc) |
|
472 | 472 | |
|
473 | template output: | |
|
474 | ||
|
475 | $ hg branches -Tjson --closed | |
|
476 | [ | |
|
477 | { | |
|
478 | "branch": "b", | |
|
479 | "node": "e23b5505d1ad24aab6f84fd8c7cb8cd8e5e93be0", | |
|
480 | "rev": 13 | |
|
481 | }, | |
|
482 | { | |
|
483 | "branch": "a branch name much longer than the default justification used by branches", | |
|
484 | "node": "10ff5895aa5793bd378da574af8cec8ea408d831", | |
|
485 | "rev": 7 | |
|
486 | }, | |
|
487 | { | |
|
488 | "branch": "c", | |
|
489 | "node": "f894c25619d3f1484639d81be950e0a07bc6f1f6", | |
|
490 | "rev": 14 | |
|
491 | }, | |
|
492 | { | |
|
493 | "branch": "a", | |
|
494 | "node": "d8cbc61dbaa6dc817175d1e301eecb863f280832", | |
|
495 | "rev": 5 | |
|
496 | }, | |
|
497 | { | |
|
498 | "branch": "default", | |
|
499 | "node": "19709c5a4e75bf938f8e349aff97438539bb729e", | |
|
500 | "rev": 0 | |
|
501 | } | |
|
502 | ] | |
|
503 | ||
|
473 | 504 |
$ |
@@ -221,7 +221,7 Show all commands + options | |||
|
221 | 221 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
222 | 222 | bookmarks: force, rev, delete, rename, inactive |
|
223 | 223 | branch: force, clean |
|
224 | branches: active, closed | |
|
224 | branches: active, closed, template | |
|
225 | 225 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
|
226 | 226 | cat: output, rev, decode, include, exclude |
|
227 | 227 | config: untrusted, edit, local, global |
General Comments 0
You need to be logged in to leave comments.
Login now