[PATCH 1 of 4 V2] obsolete: ensure that `getrevs` always return a set

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Sep 23 19:28:26 UTC 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1411500098 25200
#      Tue Sep 23 12:21:38 2014 -0700
# Node ID 57f0bf2b4380fa517321f759e910785953997e8f
# Parent  171015d3b30c986d0d172fc9db816baaa466d224
obsolete: ensure that `getrevs` always return a set

We a set of revision was empyt we where using an empty tuple. We now return an
empty frozenset to ensure the object could be used in operation that requires a
set.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -850,11 +850,11 @@ def getrevs(repo, name):
     """Return the set of revision that belong to the <name> set
 
     Such access may compute the set and cache it for future use"""
     repo = repo.unfiltered()
     if not repo.obsstore:
-        return ()
+        return frozenset()
     if name not in repo.obsstore.caches:
         repo.obsstore.caches[name] = cachefuncs[name](repo)
     return repo.obsstore.caches[name]
 
 # To be simple we need to invalidate obsolescence cache when:


More information about the Mercurial-devel mailing list