[PATCH 1 of 6 RFC] destutil: add new local variable to increase readability

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Feb 24 14:17:09 UTC 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1456322432 -32400
#      Wed Feb 24 23:00:32 2016 +0900
# Node ID 609548f6366bcc6d310dbea042f68902f3f67dce
# Parent  1d3998abd58ad32bd17381e14a530ff7ff175d48
destutil: add new local variable to increase readability

Before this patch, local variable 'heads' is used not only for "all
branch heads" but also for "branch heads other than current parent".

This patch newly adds local variable 'otherheads' for the latter
purpose, to increase readability.

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -360,10 +360,10 @@ def _statusotherbranchheads(ui, repo):
     l = len(heads)
     if repo.revs('%ln and parents()', heads):
         # we are on a head
-        heads = repo.revs('%ln - parents()', heads)
-        if heads and l != len(heads):
+        otherheads = repo.revs('%ln - parents()', heads)
+        if otherheads and l != len(otherheads):
             ui.status(_('%i other heads for branch "%s"\n') %
-                      (len(heads), currentbranch))
+                      (len(otherheads), currentbranch))
 
 def statusotherdests(ui, repo):
     """Print message about other head"""


More information about the Mercurial-devel mailing list