D4405: commitextras: no need to special case extras=[]

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Tue Aug 28 10:44:31 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3a60416c4fd8: commitextras: no need to special case extras=[] (authored by valentin.gatienbaron, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4405?vs=10611&id=10618

REVISION DETAIL
  https://phab.mercurial-scm.org/D4405

AFFECTED FILES
  hgext/commitextras.py

CHANGE DETAILS

diff --git a/hgext/commitextras.py b/hgext/commitextras.py
--- a/hgext/commitextras.py
+++ b/hgext/commitextras.py
@@ -49,25 +49,24 @@
     class repoextra(repo.__class__):
         def commit(self, *innerpats, **inneropts):
             extras = opts.get(r'extra')
-            if extras:
-                for raw in extras:
-                    if '=' not in raw:
-                        msg = _("unable to parse '%s', should follow "
-                                "KEY=VALUE format")
-                        raise error.Abort(msg % raw)
-                    k, v = raw.split('=', 1)
-                    if not k:
-                        msg = _("unable to parse '%s', keys can't be empty")
-                        raise error.Abort(msg % raw)
-                    if re.search('[^\w-]', k):
-                        msg = _("keys can only contain ascii letters, digits,"
-                                " '_' and '-'")
-                        raise error.Abort(msg)
-                    if k in usedinternally:
-                        msg = _("key '%s' is used internally, can't be set "
-                                "manually")
-                        raise error.Abort(msg % k)
-                    inneropts[r'extra'][k] = v
+            for raw in extras:
+                if '=' not in raw:
+                    msg = _("unable to parse '%s', should follow "
+                            "KEY=VALUE format")
+                    raise error.Abort(msg % raw)
+                k, v = raw.split('=', 1)
+                if not k:
+                    msg = _("unable to parse '%s', keys can't be empty")
+                    raise error.Abort(msg % raw)
+                if re.search('[^\w-]', k):
+                    msg = _("keys can only contain ascii letters, digits,"
+                            " '_' and '-'")
+                    raise error.Abort(msg)
+                if k in usedinternally:
+                    msg = _("key '%s' is used internally, can't be set "
+                            "manually")
+                    raise error.Abort(msg % k)
+                inneropts[r'extra'][k] = v
             return super(repoextra, self).commit(*innerpats, **inneropts)
     repo.__class__ = repoextra
     return orig(ui, repo, *pats, **opts)



To: valentin.gatienbaron, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list