Mercurial > public > mercurial-scm > hg-stable
diff mercurial/commands.py @ 8695:9a89253a32e6
heads: show closed heads only when --closed is passed
Add a --closed (-c) option to 'hg heads' to show all heads and change the
default behavior to refrain from showing fully closed branches.
Enhance 'hg heads <branch>' so that:
* default: displays normal & inactive heads, not closed heads
* --closed: displays normal, inactive & closed heads
* --active: displays only normal heads
* both --closed and --active: displays normal & closed heads only
author | John Mulligan <phlogistonjohn@asynchrono.us> |
---|---|
date | Wed, 03 Jun 2009 13:59:38 +0200 |
parents | 32537b12e091 |
children | 27a103df29b7 |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Jun 03 13:42:55 2009 +0200 +++ b/mercurial/commands.py Wed Jun 03 13:59:38 2009 +0200 @@ -1317,11 +1317,14 @@ start = repo.lookup(opts['rev']) else: start = None - closed = not opts.get('active') + closed = opts.get('closed') + hideinactive, _heads = opts.get('active'), None if not branchrevs: # Assume we're looking repo-wide heads if no revs were specified. heads = repo.heads(start, closed=closed) else: + if hideinactive: + _heads = repo.heads(start, closed=closed) heads = [] visitedset = set() for branchrev in branchrevs: @@ -1338,6 +1341,8 @@ else: ui.warn(_("no changes on branch %s are reachable from %s\n") % (branch, opts.get('rev'))) + if hideinactive: + bheads = [bhead for bhead in bheads if bhead in _heads] heads.extend(bheads) if not heads: return 1 @@ -3237,6 +3242,8 @@ [('r', 'rev', '', _('show only heads which are descendants of REV')), ('a', 'active', False, _('show only the active heads from open branches')), + ('c', 'closed', False, + _('show normal and closed heads')), ] + templateopts, _('[-r REV] [REV]...')), "help": (help_, [], _('[TOPIC]')),