Patchwork commit: enable --secret option

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date June 18, 2013, 6:21 p.m.
Message ID <56ee926aeeaded0aedab.1371579717@Iris>
Download mbox | patch
Permalink /patch/1734/
State Superseded, archived
Headers show

Comments

Jordi Gutiérrez Hermoso - June 18, 2013, 6:21 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1371578523 14400
#      Tue Jun 18 14:02:03 2013 -0400
# Node ID 56ee926aeeaded0aedaba4d2097ed6f312568356
# Parent  401b3ad26e66f6b69937e1aa808da07065c408a6
commit: enable --secret option

At the moment, creating secret commits is slightly cumbersome. They
can either be created by changing the default commit phase to secret
or by doing `hg phase --secret --force`. Both of these make secret
commits appear to be like some kind of advanced feature.

Secret commits, however, should be a convenient feature for people who
want to work on a private branch without affecting anyone else. There
should therefore be a prominent and convenient method for creating
secret commits.

Since the default phase is draft and there is no need to use --force
to go from a secret phase to any other phase, this patch
intentionally does not add --draft and --public options.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1286,6 +1286,7 @@ 
     ('', 'close-branch', None,
      _('mark a branch as closed, hiding it from the branch list')),
     ('', 'amend', None, _('amend the parent of the working dir')),
+    ('s', 'secret', None, _('commit secret changeset')),
     ] + walkopts + commitopts + commitopts2 + subrepoopts,
     _('[OPTION]... [FILE]...'))
 def commit(ui, repo, *pats, **opts):
@@ -1338,6 +1339,9 @@ 
     bheads = repo.branchheads(branch)
 
     extra = {}
+    if opts.get('secret'):
+        ui.setconfig('phases', 'new-commit', 'secret')
+
     if opts.get('close_branch'):
         extra['close'] = 1