--- a/mercurial/commands.py Tue Jun 30 23:25:53 2009 -0500
+++ b/mercurial/commands.py Wed Jul 01 00:31:59 2009 -0500
@@ -436,16 +436,19 @@
else:
ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
-def branches(ui, repo, active=False):
+def branches(ui, repo, active=False, closed=False):
"""list repository named branches
List the repository's named branches, indicating which ones are
- inactive. If -a/--active is specified, only show active branches.
-
- A branch is considered active if it contains repository heads.
+ inactive. If -c/--closed is specified, also list branches which have
+ been marked closed (see hg commit --close-branch).
+
+ If -a/--active is specified, only show active branches. A branch
+ is considered active if it contains repository heads.
Use the command 'hg update' to switch to an existing branch.
"""
+
hexfunc = ui.debugflag and hex or short
activebranches = [encoding.tolocal(repo[n].branch())
for n in repo.heads()]
@@ -466,6 +469,8 @@
if isactive:
notice = ''
elif hn not in repo.branchheads(tag, closed=False):
+ if not closed:
+ continue
notice = ' (closed)'
else:
notice = ' (inactive)'
@@ -3205,7 +3210,9 @@
"branches":
(branches,
[('a', 'active', False,
- _('show only branches that have unmerged heads'))],
+ _('show only branches that have unmerged heads')),
+ ('c', 'closed', False,
+ _('show normal and closed heads'))],
_('[-a]')),
"bundle":
(bundle,
--- a/tests/test-branches Tue Jun 30 23:25:53 2009 -0500
+++ b/tests/test-branches Wed Jul 01 00:31:59 2009 -0500
@@ -70,6 +70,7 @@
hg commit -d '9 0' --close-branch -m 'close this part branch too'
echo '--- b branch should be inactive'
hg branches
+hg branches -c
hg branches -a
hg heads b
hg heads --closed b
--- a/tests/test-branches.out Tue Jun 30 23:25:53 2009 -0500
+++ b/tests/test-branches.out Wed Jul 01 00:31:59 2009 -0500
@@ -108,6 +108,10 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- b branch should be inactive
a branch name much longer than the default justification used by branches 7:10ff5895aa57
+c 6:589736a22561 (inactive)
+a 5:d8cbc61dbaa6 (inactive)
+default 0:19709c5a4e75 (inactive)
+a branch name much longer than the default justification used by branches 7:10ff5895aa57
b 12:2da6583810df (closed)
c 6:589736a22561 (inactive)
a 5:d8cbc61dbaa6 (inactive)
--- a/tests/test-debugcomplete.out Tue Jun 30 23:25:53 2009 -0500
+++ b/tests/test-debugcomplete.out Wed Jul 01 00:31:59 2009 -0500
@@ -184,7 +184,7 @@
backout: merge, parent, rev, include, exclude, message, logfile, date, user
bisect: reset, good, bad, skip, command, noupdate
branch: force, clean
-branches: active
+branches: active, closed
bundle: force, rev, base, all, type, ssh, remotecmd
cat: output, rev, decode, include, exclude
copy: after, force, include, exclude, dry-run