##// END OF EJS Templates
filelog: make packmeta a public module function, to be used by censor
Mike Edgar -
r22420:4669e267 default
parent child Browse files
Show More
@@ -24,10 +24,10 b' def _parsemeta(text):'
24 keys.append(k)
24 keys.append(k)
25 return meta, keys, (s + 2)
25 return meta, keys, (s + 2)
26
26
27 def _packmeta(meta, keys=None):
27 def packmeta(meta, text):
28 if not keys:
28 keys = sorted(meta.iterkeys())
29 keys = sorted(meta.iterkeys())
29 metatext = "".join("%s: %s\n" % (k, meta[k]) for k in keys)
30 return "".join("%s: %s\n" % (k, meta[k]) for k in keys)
30 return "\1\n%s\1\n%s" % (metatext, text)
31
31
32 class filelog(revlog.revlog):
32 class filelog(revlog.revlog):
33 def __init__(self, opener, path):
33 def __init__(self, opener, path):
@@ -43,7 +43,7 b' class filelog(revlog.revlog):'
43
43
44 def add(self, text, meta, transaction, link, p1=None, p2=None):
44 def add(self, text, meta, transaction, link, p1=None, p2=None):
45 if meta or text.startswith('\1\n'):
45 if meta or text.startswith('\1\n'):
46 text = "\1\n%s\1\n%s" % (_packmeta(meta), text)
46 text = packmeta(meta, text)
47 return self.addrevision(text, transaction, link, p1, p2)
47 return self.addrevision(text, transaction, link, p1, p2)
48
48
49 def renamed(self, node):
49 def renamed(self, node):
General Comments 0
You need to be logged in to leave comments. Login now