Patchwork [07,of,21,RFC] filelog: make parsemeta a public module function, to be used by censor module

login
register
mail settings
Submitter michaeljedgar@gmail.com
Date Sept. 11, 2014, 12:26 a.m.
Message ID <96b547c542400ef1d75b.1410395168@adgar-macbookpro3.roam.corp.google.com>
Download mbox | patch
Permalink /patch/5782/
State Accepted
Commit 30a610424eff73d92aeb3e467cfa7b8ca16fc01c
Headers show

Comments

michaeljedgar@gmail.com - Sept. 11, 2014, 12:26 a.m.
# HG changeset patch
# User Mike Edgar <adgar@google.com>
# Date 1410322695 14400
#      Wed Sep 10 00:18:15 2014 -0400
# Node ID 96b547c542400ef1d75b7a2ed9a4731e7296a337
# Parent  4e691a50e055b4d7c513fca76ae3eed969710ec4
filelog: make parsemeta a public module function, to be used by censor module

Patch

diff -r 4e691a50e055 -r 96b547c54240 mercurial/filelog.py
--- a/mercurial/filelog.py	Wed Sep 10 00:17:17 2014 -0400
+++ b/mercurial/filelog.py	Wed Sep 10 00:18:15 2014 -0400
@@ -9,7 +9,7 @@ 
 import re
 
 _mdre = re.compile('\1\n')
-def _parsemeta(text):
+def parsemeta(text):
     """return (metadatadict, keylist, metadatasize)"""
     # text can be buffer, so we can't use .startswith or .index
     if text[:2] != '\1\n':
@@ -28,7 +28,7 @@ 
     return "\1\n%s\1\n%s" % (metatext, text)
 
 def _censoredtext(text):
-    m, offs = _parsemeta(text)
+    m, offs = parsemeta(text)
     return m and "censored" in m and not text[offs:]
 
 class filelog(revlog.revlog):
@@ -52,7 +52,7 @@ 
         if self.parents(node)[0] != revlog.nullid:
             return False
         t = self.revision(node)
-        m = _parsemeta(t)[0]
+        m = parsemeta(t)[0]
         if m and "copy" in m:
             return (m["copy"], revlog.bin(m["copyrev"]))
         return False