Patchwork [06,of,22] obsstore: separate marker parsing from obsstore reading

login
register
mail settings
Submitter Jun Wu
Date June 4, 2017, 11:59 p.m.
Message ID <17ce57b7873f61deefe4.1496620758@x1c>
Download mbox | patch
Permalink /patch/21183/
State Accepted
Headers show

Comments

Jun Wu - June 4, 2017, 11:59 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1496461081 25200
#      Fri Jun 02 20:38:01 2017 -0700
# Node ID 17ce57b7873f61deefe4ee34c4b7b9e6a54d489e
# Parent  d9ed7d0a4373b12c92055dd10718cffe96c98224
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 17ce57b7873f
obsstore: separate marker parsing from obsstore reading

This allows us to get raw obsstore content without parsing any markers.
Reading obsstore is much cheaper than parsing markers.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -667,6 +667,10 @@  class obsstore(object):
 
     @propertycache
+    def _data(self):
+        return self.svfs.tryread('obsstore')
+
+    @propertycache
     def _all(self):
-        data = self.svfs.tryread('obsstore')
+        data = self._data
         if not data:
             return []