##// END OF EJS Templates
manifest: extract method for creating manifest text...
Martin von Zweigbergk -
r24525:e118f74d default
parent child Browse files
Show More
@@ -31,6 +31,21 b' def _parse(data):'
31 31 else:
32 32 yield f, revlog.bin(n), ''
33 33
34 def _text(it):
35 """Given an iterator over (path, node, flags) tuples, returns a manifest
36 text"""
37 files = []
38 lines = []
39 _hex = revlog.hex
40 for f, n, fl in it:
41 files.append(f)
42 # if this is changed to support newlines in filenames,
43 # be sure to check the templates/ dir again (especially *-raw.tmpl)
44 lines.append("%s\0%s%s\n" % (f, _hex(n), fl))
45
46 _checkforbidden(files)
47 return ''.join(lines)
48
34 49 class _lazymanifest(dict):
35 50 """This is the pure implementation of lazymanifest.
36 51
@@ -92,13 +107,7 b' class _lazymanifest(dict):'
92 107
93 108 def text(self):
94 109 """Get the full data of this manifest as a bytestring."""
95 fl = self.iterentries()
96
97 _hex = revlog.hex
98 # if this is changed to support newlines in filenames,
99 # be sure to check the templates/ dir again (especially *-raw.tmpl)
100 return ''.join("%s\0%s%s\n" % (
101 f, _hex(n[:20]), flag) for f, n, flag in fl)
110 return _text(self.iterentries())
102 111
103 112 try:
104 113 _lazymanifest = parsers.lazymanifest
@@ -578,13 +587,8 b' class treemanifest(object):'
578 587
579 588 def text(self):
580 589 """Get the full data of this manifest as a bytestring."""
581 fl = self.keys()
582 _checkforbidden(fl)
583
584 hex, flags = revlog.hex, self.flags
585 # if this is changed to support newlines in filenames,
586 # be sure to check the templates/ dir again (especially *-raw.tmpl)
587 return ''.join("%s\0%s%s\n" % (f, hex(self[f]), flags(f)) for f in fl)
590 flags = self.flags
591 return _text((f, self[f], flags(f)) for f in self.keys())
588 592
589 593 class manifest(revlog.revlog):
590 594 def __init__(self, opener):
General Comments 0
You need to be logged in to leave comments. Login now