Patchwork [4,of,4,censor,RFC] filelog: use censored revlog flag bit to quickly check if a node is censored

login
register
mail settings
Submitter adgar@google.com
Date Jan. 12, 2015, 9:08 p.m.
Message ID <86068d18ad71ea47711d.1421096900@adgar.nyc.corp.google.com>
Download mbox | patch
Permalink /patch/7444/
State Accepted
Commit 22a979d1ae569d1cd87f166b5600def0fe93efb3
Headers show

Comments

adgar@google.com - Jan. 12, 2015, 9:08 p.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1421094576 18000
#      Mon Jan 12 15:29:36 2015 -0500
# Node ID 86068d18ad71ea47711d8b7ac96b422202deabef
# Parent  14ac00cc2162fb0d933e334b08bccdc49012843c
filelog: use censored revlog flag bit to quickly check if a node is censored
Matt Mackall - Jan. 15, 2015, 12:10 a.m.
On Mon, 2015-01-12 at 16:08 -0500, Mike Edgar wrote:
> # HG changeset patch
> # User Mike Edgar <adgar@google.com>
> # Date 1421094576 18000
> #      Mon Jan 12 15:29:36 2015 -0500
> # Node ID 86068d18ad71ea47711d8b7ac96b422202deabef
> # Parent  14ac00cc2162fb0d933e334b08bccdc49012843c
> filelog: use censored revlog flag bit to quickly check if a node is censored

These all look good, I've gone ahead and queued them for default,
thanks.

Patch

diff -r 14ac00cc2162 -r 86068d18ad71 mercurial/filelog.py
--- a/mercurial/filelog.py	Mon Jan 12 14:41:25 2015 -0500
+++ b/mercurial/filelog.py	Mon Jan 12 15:29:36 2015 -0500
@@ -85,7 +85,7 @@ 
             return False
 
         # censored files compare against the empty file
-        if self._iscensored(node):
+        if self._iscensored(self.rev(node)):
             return text != ''
 
         # renaming a file produces a different hash, even if the data
@@ -107,10 +107,6 @@ 
     def _file(self, f):
         return filelog(self.opener, f)
 
-    def _iscensored(self, revornode):
+    def _iscensored(self, rev):
         """Check if a file revision is censored."""
-        try:
-            self.revision(revornode)
-            return False
-        except error.CensoredNodeError:
-            return True
+        return self.flags(rev) & revlog.REVIDX_ISCENSORED