[PATCH 1 of 4] discovery: rename 'error' to 'errormsg'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Oct 8 19:56:12 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1444109397 25200
#      Mon Oct 05 22:29:57 2015 -0700
# Node ID 5d09ff6fb1868d1d379b80d9e06765c4af87d2ef
# Parent  e046fdb26b5b28e72231782fed842a003627c057
discovery: rename 'error' to 'errormsg'

The variable 'error' conflict with the module name that we would like to import
and use in a coming changeset.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -282,11 +282,11 @@ def checkheads(repo, remote, outgoing, r
                 bookmarkedheads.add(repo[bm].node())
 
     # 3. Check for new heads.
     # If there are more heads after the push than before, a suitable
     # error message, depending on unsynced status, is displayed.
-    error = None
+    errormsg = None
     # If there is no obsstore, allfuturecommon won't be used, so no
     # need to compute it.
     if repo.obsstore:
         allmissing = set(outgoing.missing)
         cctx = repo.set('%ld', outgoing.common)
@@ -352,31 +352,31 @@ def checkheads(repo, remote, outgoing, r
                 repo.ui.status(_("remote has heads on branch '%s' that are "
                                  "not known locally: %s\n") % (branch, heads))
         if remoteheads is None:
             if len(newhs) > 1:
                 dhs = list(newhs)
-                if error is None:
-                    error = (_("push creates new branch '%s' "
-                               "with multiple heads") % (branch))
+                if errormsg is None:
+                    errormsg = (_("push creates new branch '%s' "
+                                  "with multiple heads") % (branch))
                     hint = _("merge or"
                              " see \"hg help push\" for details about"
                              " pushing new heads")
         elif len(newhs) > len(oldhs):
             # remove bookmarked or existing remote heads from the new heads list
             dhs = sorted(newhs - bookmarkedheads - oldhs)
         if dhs:
-            if error is None:
+            if errormsg is None:
                 if branch not in ('default', None):
-                    error = _("push creates new remote head %s "
-                              "on branch '%s'!") % (short(dhs[0]), branch)
+                    errormsg = _("push creates new remote head %s "
+                                 "on branch '%s'!") % (short(dhs[0]), branch)
                 elif repo[dhs[0]].bookmarks():
-                    error = _("push creates new remote head %s "
-                              "with bookmark '%s'!") % (
-                              short(dhs[0]), repo[dhs[0]].bookmarks()[0])
+                    errormsg = _("push creates new remote head %s "
+                                 "with bookmark '%s'!") % (
+                                 short(dhs[0]), repo[dhs[0]].bookmarks()[0])
                 else:
-                    error = _("push creates new remote head %s!"
-                              ) % short(dhs[0])
+                    errormsg = _("push creates new remote head %s!"
+                                 ) % short(dhs[0])
                 if unsyncedheads:
                     hint = _("pull and merge or"
                              " see \"hg help push\" for details about"
                              " pushing new heads")
                 else:
@@ -387,7 +387,7 @@ def checkheads(repo, remote, outgoing, r
                 repo.ui.note(_("new remote heads:\n"))
             else:
                 repo.ui.note(_("new remote heads on branch '%s':\n") % branch)
             for h in dhs:
                 repo.ui.note((" %s\n") % short(h))
-    if error:
-        raise util.Abort(error, hint=hint)
+    if errormsg:
+        raise util.Abort(errormsg, hint=hint)


More information about the Mercurial-devel mailing list