mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
manifest: move manifestdict-to-text encoding to manifest class
A future patch will introduce a new format, with a new class.
This commit is contained in:
parent
7a97abf550
commit
6d53ff9d24
@ -40,6 +40,14 @@ class manifestdict(dict):
|
||||
def flagsdiff(self, d2):
|
||||
return dicthelpers.diff(self._flags, d2._flags, "")
|
||||
|
||||
def text(self):
|
||||
fl = sorted(self)
|
||||
_checkforbidden(fl)
|
||||
|
||||
hex, flags = revlog.hex, self.flags
|
||||
# if this is changed to support newlines in filenames,
|
||||
# be sure to check the templates/ dir again (especially *-raw.tmpl)
|
||||
return ''.join("%s\0%s%s\n" % (f, hex(self[f]), flags(f)) for f in fl)
|
||||
|
||||
def _checkforbidden(l):
|
||||
"""Check filenames for illegal characters."""
|
||||
@ -220,14 +228,7 @@ class manifest(revlog.revlog):
|
||||
# just encode a fulltext of the manifest and pass that
|
||||
# through to the revlog layer, and let it handle the delta
|
||||
# process.
|
||||
files = sorted(map)
|
||||
_checkforbidden(files)
|
||||
|
||||
# if this is changed to support newlines in filenames,
|
||||
# be sure to check the templates/ dir again (especially *-raw.tmpl)
|
||||
hex, flags = revlog.hex, map.flags
|
||||
text = ''.join("%s\0%s%s\n" % (f, hex(map[f]), flags(f))
|
||||
for f in files)
|
||||
text = map.text()
|
||||
arraytext = array.array('c', text)
|
||||
cachedelta = None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user