changeset 17625:b83c18204c36

bookmarks: avoid redundant creation/assignment of "validdests" in "validdest()"
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 18 Sep 2012 21:39:12 +0900
parents ae103510f6aa
children 3a524b647897
files mercurial/bookmarks.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed Sep 19 14:00:23 2012 +0200
+++ 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()