##// END OF EJS Templates
branches: add --closed flag for consistency with heads
Matt Mackall -
r8991:7e0b31df default
parent child Browse files
Show More
@@ -436,16 +436,19 b' def branch(ui, repo, label=None, **opts)'
436 else:
436 else:
437 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
437 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
438
438
439 def branches(ui, repo, active=False):
439 def branches(ui, repo, active=False, closed=False):
440 """list repository named branches
440 """list repository named branches
441
441
442 List the repository's named branches, indicating which ones are
442 List the repository's named branches, indicating which ones are
443 inactive. If -a/--active is specified, only show active branches.
443 inactive. If -c/--closed is specified, also list branches which have
444
444 been marked closed (see hg commit --close-branch).
445 A branch is considered active if it contains repository heads.
445
446 If -a/--active is specified, only show active branches. A branch
447 is considered active if it contains repository heads.
446
448
447 Use the command 'hg update' to switch to an existing branch.
449 Use the command 'hg update' to switch to an existing branch.
448 """
450 """
451
449 hexfunc = ui.debugflag and hex or short
452 hexfunc = ui.debugflag and hex or short
450 activebranches = [encoding.tolocal(repo[n].branch())
453 activebranches = [encoding.tolocal(repo[n].branch())
451 for n in repo.heads()]
454 for n in repo.heads()]
@@ -466,6 +469,8 b' def branches(ui, repo, active=False):'
466 if isactive:
469 if isactive:
467 notice = ''
470 notice = ''
468 elif hn not in repo.branchheads(tag, closed=False):
471 elif hn not in repo.branchheads(tag, closed=False):
472 if not closed:
473 continue
469 notice = ' (closed)'
474 notice = ' (closed)'
470 else:
475 else:
471 notice = ' (inactive)'
476 notice = ' (inactive)'
@@ -3205,7 +3210,9 b' table = {'
3205 "branches":
3210 "branches":
3206 (branches,
3211 (branches,
3207 [('a', 'active', False,
3212 [('a', 'active', False,
3208 _('show only branches that have unmerged heads'))],
3213 _('show only branches that have unmerged heads')),
3214 ('c', 'closed', False,
3215 _('show normal and closed heads'))],
3209 _('[-a]')),
3216 _('[-a]')),
3210 "bundle":
3217 "bundle":
3211 (bundle,
3218 (bundle,
@@ -70,6 +70,7 b' hg up -C b'
70 hg commit -d '9 0' --close-branch -m 'close this part branch too'
70 hg commit -d '9 0' --close-branch -m 'close this part branch too'
71 echo '--- b branch should be inactive'
71 echo '--- b branch should be inactive'
72 hg branches
72 hg branches
73 hg branches -c
73 hg branches -a
74 hg branches -a
74 hg heads b
75 hg heads b
75 hg heads --closed b
76 hg heads --closed b
@@ -108,6 +108,10 b' a branch name much longer than the defau'
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 --- b branch should be inactive
109 --- b branch should be inactive
110 a branch name much longer than the default justification used by branches 7:10ff5895aa57
110 a branch name much longer than the default justification used by branches 7:10ff5895aa57
111 c 6:589736a22561 (inactive)
112 a 5:d8cbc61dbaa6 (inactive)
113 default 0:19709c5a4e75 (inactive)
114 a branch name much longer than the default justification used by branches 7:10ff5895aa57
111 b 12:2da6583810df (closed)
115 b 12:2da6583810df (closed)
112 c 6:589736a22561 (inactive)
116 c 6:589736a22561 (inactive)
113 a 5:d8cbc61dbaa6 (inactive)
117 a 5:d8cbc61dbaa6 (inactive)
@@ -184,7 +184,7 b' archive: no-decode, prefix, rev, type, i'
184 backout: merge, parent, rev, include, exclude, message, logfile, date, user
184 backout: merge, parent, rev, include, exclude, message, logfile, date, user
185 bisect: reset, good, bad, skip, command, noupdate
185 bisect: reset, good, bad, skip, command, noupdate
186 branch: force, clean
186 branch: force, clean
187 branches: active
187 branches: active, closed
188 bundle: force, rev, base, all, type, ssh, remotecmd
188 bundle: force, rev, base, all, type, ssh, remotecmd
189 cat: output, rev, decode, include, exclude
189 cat: output, rev, decode, include, exclude
190 copy: after, force, include, exclude, dry-run
190 copy: after, force, include, exclude, dry-run
General Comments 0
You need to be logged in to leave comments. Login now