[PATCH 1 of 3] bookmarks: avoid redundant creation/assignment of "validdests" in "validdest()"

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Sep 18 07:44:05 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1347971952 -32400
# Node ID da712d99933e8b524eef25c0fe014ed5c1215764
# Parent  55724f42fa14b6759a47106998feea25a032e45c
bookmarks: avoid redundant creation/assignment of "validdests" in "validdest()"

diff -r 55724f42fa14 -r da712d99933e mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Mon Sep 17 15:13:17 2012 -0500
+++ b/mercurial/bookmarks.py	Tue Sep 18 21:39:12 2012 +0900
@@ -257,11 +257,11 @@
     """Is the new bookmark destination a valid update from the old one"""
     if old == new:
         # Old == new -> nothing to update.
-        validdests = ()
+        return False
     elif not old:
         # old is nullrev, anything is valid.
         # (new != nullrev has been excluded by the previous check)
-        validdests = (new,)
+        return True
     elif repo.obsstore:
         # We only need this complicated logic if there is obsolescence
         # XXX will probably deserve an optimised rset.
@@ -279,6 +279,6 @@
                                                         c.node()))
             validdests = set(repo.set('%ln::', succs))
         validdests.remove(old)
+        return new in validdests
     else:
-        validdests = old.descendants()
-    return new in validdests
+        return new in old.descendants()


More information about the Mercurial-devel mailing list