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

login
register
mail settings
Submitter Pierre-Yves David
Date Sept. 23, 2014, 7:28 p.m.
Message ID <57f0bf2b4380fa517321.1411500506@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5920/
State Accepted
Headers show

Comments

Pierre-Yves David - Sept. 23, 2014, 7:28 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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: