Mercurial > hg
comparison hgext/commitextras.py @ 34975:901a18b03e00
py3: handle keyword arguments in hgext/commitextras.py
Differential Revision: https://phab.mercurial-scm.org/D1300
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 23 Oct 2017 00:01:45 +0530 |
parents | 806351695c6a |
children | 75c76cee1b1b |
comparison
equal
deleted
inserted
replaced
34974:26ed66ab1e72 | 34975:901a18b03e00 |
---|---|
44 | 44 |
45 def _commit(orig, ui, repo, *pats, **opts): | 45 def _commit(orig, ui, repo, *pats, **opts): |
46 origcommit = repo.commit | 46 origcommit = repo.commit |
47 try: | 47 try: |
48 def _wrappedcommit(*innerpats, **inneropts): | 48 def _wrappedcommit(*innerpats, **inneropts): |
49 extras = opts.get('extra') | 49 extras = opts.get(r'extra') |
50 if extras: | 50 if extras: |
51 for raw in extras: | 51 for raw in extras: |
52 if '=' not in raw: | 52 if '=' not in raw: |
53 msg = _("unable to parse '%s', should follow " | 53 msg = _("unable to parse '%s', should follow " |
54 "KEY=VALUE format") | 54 "KEY=VALUE format") |
63 raise error.Abort(msg) | 63 raise error.Abort(msg) |
64 if k in usedinternally: | 64 if k in usedinternally: |
65 msg = _("key '%s' is used internally, can't be set " | 65 msg = _("key '%s' is used internally, can't be set " |
66 "manually") | 66 "manually") |
67 raise error.Abort(msg % k) | 67 raise error.Abort(msg % k) |
68 inneropts['extra'][k] = v | 68 inneropts[r'extra'][k] = v |
69 return origcommit(*innerpats, **inneropts) | 69 return origcommit(*innerpats, **inneropts) |
70 | 70 |
71 # This __dict__ logic is needed because the normal | 71 # This __dict__ logic is needed because the normal |
72 # extension.wrapfunction doesn't seem to work. | 72 # extension.wrapfunction doesn't seem to work. |
73 repo.__dict__['commit'] = _wrappedcommit | 73 repo.__dict__['commit'] = _wrappedcommit |