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

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 23, 2015, 5:48 a.m.
Message ID <35de00be99c2536643df.1442987285@mimosa>
Download mbox | patch
Permalink /patch/10591/
State Changes Requested
Headers show

Comments

Yuya Nishihara - Sept. 23, 2015, 5:48 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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')