##// 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 else:
31 else:
32 yield f, revlog.bin(n), ''
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 class _lazymanifest(dict):
49 class _lazymanifest(dict):
35 """This is the pure implementation of lazymanifest.
50 """This is the pure implementation of lazymanifest.
36
51
@@ -92,13 +107,7 b' class _lazymanifest(dict):'
92
107
93 def text(self):
108 def text(self):
94 """Get the full data of this manifest as a bytestring."""
109 """Get the full data of this manifest as a bytestring."""
95 fl = self.iterentries()
110 return _text(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)
102
111
103 try:
112 try:
104 _lazymanifest = parsers.lazymanifest
113 _lazymanifest = parsers.lazymanifest
@@ -578,13 +587,8 b' class treemanifest(object):'
578
587
579 def text(self):
588 def text(self):
580 """Get the full data of this manifest as a bytestring."""
589 """Get the full data of this manifest as a bytestring."""
581 fl = self.keys()
590 flags = self.flags
582 _checkforbidden(fl)
591 return _text((f, self[f], flags(f)) for f in self.keys())
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)
588
592
589 class manifest(revlog.revlog):
593 class manifest(revlog.revlog):
590 def __init__(self, opener):
594 def __init__(self, opener):
General Comments 0
You need to be logged in to leave comments. Login now