##// END OF EJS Templates
storageutil: new function for extracting metadata-less content from text...
Gregory Szorc -
r39916:1b65fb4d default
parent child Browse files
Show More
@@ -113,11 +113,7 b' class filelog(object):'
113 113 return self._revlog.files()
114 114
115 115 def read(self, node):
116 t = self.revision(node)
117 if not t.startswith('\1\n'):
118 return t
119 s = t.index('\1\n', 2)
120 return t[s + 2:]
116 return storageutil.filtermetadata(self.revision(node))
121 117
122 118 def add(self, text, meta, transaction, link, p1=None, p2=None):
123 119 if meta or text.startswith('\1\n'):
@@ -69,3 +69,15 b' def packmeta(meta, text):'
69 69 def iscensoredtext(text):
70 70 meta = parsemeta(text)[0]
71 71 return meta and b'censored' in meta
72
73 def filtermetadata(text):
74 """Extract just the revision data from source text.
75
76 Returns ``text`` unless it has a metadata header, in which case we return
77 a new buffer without hte metadata.
78 """
79 if not text.startswith(b'\x01\n'):
80 return text
81
82 offset = text.index(b'\x01\n', 2)
83 return text[offset + 2:]
General Comments 0
You need to be logged in to leave comments. Login now