diff mercurial/commands.py @ 7655:cce37dab7ad6

branch closing: mark closed branches with a 'close' extra Adds a --close-branch option to commit. When --close-branch is present the commit will mark the changeset with close=1 in the changeset extras field. If a regular changeset is added on top of a closed head the branch is no longer considered closed, and thus re-opened.
author John Mulligan <phlogistonjohn@asynchrono.us>
date Wed, 14 Jan 2009 21:47:38 -0500
parents 9a1ea6587557
children 6a24fb994701
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jan 14 21:47:38 2009 -0500
+++ b/mercurial/commands.py	Wed Jan 14 21:47:38 2009 -0500
@@ -613,9 +613,13 @@
 
     See 'hg help dates' for a list of formats valid for -d/--date.
     """
+    extra = {}
+    if opts.get('close_branch'):
+        extra['close'] = 1
     def commitfunc(ui, repo, message, match, opts):
-        return repo.commit(match.files(), message, opts.get('user'), opts.get('date'),
-                           match, force_editor=opts.get('force_editor'))
+        return repo.commit(match.files(), message, opts.get('user'),
+            opts.get('date'), match, force_editor=opts.get('force_editor'),
+            extra=extra)
 
     node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
     if not node:
@@ -3134,6 +3138,8 @@
         (commit,
          [('A', 'addremove', None,
            _('mark new/missing files as added/removed before committing')),
+          ('', 'close-branch', None,
+           _('mark a branch as closed, hiding it from the branch list')),
          ] + walkopts + commitopts + commitopts2,
          _('[OPTION]... [FILE]...')),
     "copy|cp":