[PATCH 4 of 5 RFC] obsolete: extract function that lists revisions marked as obsolete

Yuya Nishihara yuya at tcha.org
Wed Sep 23 00:48:05 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1442815961 -32400
#      Mon Sep 21 15:12:41 2015 +0900
# Node ID 35de00be99c2536643df4e100c7784d39829614b
# Parent  13a9dacedbbee19365ddd911020a74e8ba392f0e
obsolete: extract function that lists revisions marked as obsolete

This list will be cached later. This allows us to generate a cache validation
key without the phase information.

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -1102,12 +1102,21 @@ def clearobscaches(repo):
 def _computeobsoleteset(repo):
     """the set of obsolete revisions"""
     obs = set()
+    getphase = repo._phasecache.phase
+    for rev in _computerawobsoletelist(repo):
+        if getphase(repo, rev):
+            obs.add(rev)
+    return obs
+
+def _computerawobsoletelist(repo):
+    """the list of revisions marked as obsolete, which may include public
+    revisions"""
+    obs = []
     getrev = repo.changelog.nodemap.get
-    getphase = repo._phasecache.phase
     for n in repo.obsstore.successors:
         rev = getrev(n)
-        if rev is not None and getphase(repo, rev):
-            obs.add(rev)
+        if rev is not None:
+            obs.append(rev)
     return obs
 
 @cachefor('unstable')


More information about the Mercurial-devel mailing list