Show More
@@ -12,6 +12,7 b' from __future__ import absolute_import' | |||||
12 | from mercurial.i18n import _ |
|
12 | from mercurial.i18n import _ | |
13 | from mercurial import ( |
|
13 | from mercurial import ( | |
14 | commands, |
|
14 | commands, | |
|
15 | error, | |||
15 | extensions, |
|
16 | extensions, | |
16 | registrar, |
|
17 | registrar, | |
17 | ) |
|
18 | ) | |
@@ -20,6 +21,19 b' cmdtable = {}' | |||||
20 | command = registrar.command(cmdtable) |
|
21 | command = registrar.command(cmdtable) | |
21 | testedwith = 'ships-with-hg-core' |
|
22 | testedwith = 'ships-with-hg-core' | |
22 |
|
23 | |||
|
24 | usedinternally = { | |||
|
25 | 'amend_source', | |||
|
26 | 'branch', | |||
|
27 | 'close', | |||
|
28 | 'histedit_source', | |||
|
29 | 'topic', | |||
|
30 | 'rebase_source', | |||
|
31 | 'intermediate-source', | |||
|
32 | '__touch-noise__', | |||
|
33 | 'source', | |||
|
34 | 'transplant_source', | |||
|
35 | } | |||
|
36 | ||||
23 | def extsetup(ui): |
|
37 | def extsetup(ui): | |
24 | entry = extensions.wrapcommand(commands.table, 'commit', _commit) |
|
38 | entry = extensions.wrapcommand(commands.table, 'commit', _commit) | |
25 | options = entry[1] |
|
39 | options = entry[1] | |
@@ -33,7 +47,15 b' def _commit(orig, ui, repo, *pats, **opt' | |||||
33 | extras = opts.get('extra') |
|
47 | extras = opts.get('extra') | |
34 | if extras: |
|
48 | if extras: | |
35 | for raw in extras: |
|
49 | for raw in extras: | |
|
50 | if '=' not in raw: | |||
|
51 | msg = _("unable to parse '%s', should follow " | |||
|
52 | "KEY=VALUE format") | |||
|
53 | raise error.Abort(msg % raw) | |||
36 | k, v = raw.split('=', 1) |
|
54 | k, v = raw.split('=', 1) | |
|
55 | if k in usedinternally: | |||
|
56 | msg = _("key '%s' is used internally, can't be set " | |||
|
57 | "manually") | |||
|
58 | raise error.Abort(msg % k) | |||
37 | inneropts['extra'][k] = v |
|
59 | inneropts['extra'][k] = v | |
38 | return origcommit(*innerpats, **inneropts) |
|
60 | return origcommit(*innerpats, **inneropts) | |
39 |
|
61 |
@@ -124,6 +124,24 b' An empty date was interpreted as epoch o' | |||||
124 | $ hg tip --template '{date|isodate}\n' | grep '1970' |
|
124 | $ hg tip --template '{date|isodate}\n' | grep '1970' | |
125 | [1] |
|
125 | [1] | |
126 |
|
126 | |||
|
127 | Using the advanced --extra flag | |||
|
128 | ||||
|
129 | $ echo "[extensions]" >> $HGRCPATH | |||
|
130 | $ echo "commitextras=" >> $HGRCPATH | |||
|
131 | $ hg status | |||
|
132 | ? baz | |||
|
133 | ? quux | |||
|
134 | $ hg add baz | |||
|
135 | $ hg commit -m "adding extras" --extra sourcehash=foo --extra oldhash=bar | |||
|
136 | $ hg log -r . -T '{extras % "{extra}\n"}' | |||
|
137 | branch=default | |||
|
138 | oldhash=bar | |||
|
139 | sourcehash=foo | |||
|
140 | $ hg add quux | |||
|
141 | $ hg commit -m "adding internal used extras" --extra amend_source=hash | |||
|
142 | abort: key 'amend_source' is used internally, can't be set manually | |||
|
143 | [255] | |||
|
144 | ||||
127 | Make sure we do not obscure unknown requires file entries (issue2649) |
|
145 | Make sure we do not obscure unknown requires file entries (issue2649) | |
128 |
|
146 | |||
129 | $ echo foo >> foo |
|
147 | $ echo foo >> foo |
General Comments 0
You need to be logged in to leave comments.
Login now