[PATCH 1 of 3] prepush: eliminate 'if branch'

Adrian Buehlmann adrian at cadifra.com
Fri Jun 3 07:36:16 CDT 2011


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1307093203 -7200
# Node ID fb486d537aaf30f0f19618cbe2f684b4669d4458
# Parent  a67e866f46f9919a963afb4e4f1bb4a2c56a3c42
prepush: eliminate 'if branch'

branch is always set anyway

No change in program behavior.

diff --git a/mercurial/discovery.py b/mercurial/discovery.py
--- a/mercurial/discovery.py
+++ b/mercurial/discovery.py
@@ -160,19 +160,15 @@
             oldhs = set(oldmap[branch])
             if len(newhs) > len(oldhs):
                 if error is None:
-                    if branch:
-                        error = _("push creates new remote heads "
-                                  "on branch '%s'!") % branch
-                    else:
-                        error = _("push creates new remote heads!")
+                    error = _("push creates new remote heads "
+                              "on branch '%s'!") % branch
                     if branch in unsynced:
                         hint = _("you should pull and merge or "
                                  "use push -f to force")
                     else:
                         hint = _("did you forget to merge? "
                                  "use push -f to force")
-                if branch:
-                    repo.ui.debug("new remote heads on branch '%s'\n" % branch)
+                repo.ui.debug("new remote heads on branch '%s'\n" % branch)
                 for h in (newhs - oldhs):
                     repo.ui.debug("new remote head %s\n" % short(h))
         if error:


More information about the Mercurial-devel mailing list