Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 49771:f0e9dda408b3
commit: add --draft option to use draft phase
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 29 Nov 2022 13:07:16 -0800 |
parents | f65656572e25 |
children | e0c0545e2e55 |
comparison
equal
deleted
inserted
replaced
49770:9da992241302 | 49771:f0e9dda408b3 |
---|---|
2006 _(b'mark new/missing files as added/removed before committing'), | 2006 _(b'mark new/missing files as added/removed before committing'), |
2007 ), | 2007 ), |
2008 (b'', b'close-branch', None, _(b'mark a branch head as closed')), | 2008 (b'', b'close-branch', None, _(b'mark a branch head as closed')), |
2009 (b'', b'amend', None, _(b'amend the parent of the working directory')), | 2009 (b'', b'amend', None, _(b'amend the parent of the working directory')), |
2010 (b's', b'secret', None, _(b'use the secret phase for committing')), | 2010 (b's', b'secret', None, _(b'use the secret phase for committing')), |
2011 (b'', b'draft', None, _(b'use the draft phase for committing')), | |
2011 (b'e', b'edit', None, _(b'invoke editor on commit messages')), | 2012 (b'e', b'edit', None, _(b'invoke editor on commit messages')), |
2012 ( | 2013 ( |
2013 b'', | 2014 b'', |
2014 b'force-close-branch', | 2015 b'force-close-branch', |
2015 None, | 2016 None, |
2080 | 2081 |
2081 - amend the current commit and set the date to now:: | 2082 - amend the current commit and set the date to now:: |
2082 | 2083 |
2083 hg commit --amend --date now | 2084 hg commit --amend --date now |
2084 """ | 2085 """ |
2086 cmdutil.check_at_most_one_arg(opts, 'draft', 'secret') | |
2085 cmdutil.check_incompatible_arguments(opts, 'subrepos', ['amend']) | 2087 cmdutil.check_incompatible_arguments(opts, 'subrepos', ['amend']) |
2086 with repo.wlock(), repo.lock(): | 2088 with repo.wlock(), repo.lock(): |
2087 return _docommit(ui, repo, *pats, **opts) | 2089 return _docommit(ui, repo, *pats, **opts) |
2088 | 2090 |
2089 | 2091 |
2172 | 2174 |
2173 def commitfunc(ui, repo, message, match, opts): | 2175 def commitfunc(ui, repo, message, match, opts): |
2174 overrides = {} | 2176 overrides = {} |
2175 if opts.get(b'secret'): | 2177 if opts.get(b'secret'): |
2176 overrides[(b'phases', b'new-commit')] = b'secret' | 2178 overrides[(b'phases', b'new-commit')] = b'secret' |
2179 elif opts.get(b'draft'): | |
2180 overrides[(b'phases', b'new-commit')] = b'draft' | |
2177 | 2181 |
2178 baseui = repo.baseui | 2182 baseui = repo.baseui |
2179 with baseui.configoverride(overrides, b'commit'): | 2183 with baseui.configoverride(overrides, b'commit'): |
2180 with ui.configoverride(overrides, b'commit'): | 2184 with ui.configoverride(overrides, b'commit'): |
2181 editform = cmdutil.mergeeditform( | 2185 editform = cmdutil.mergeeditform( |