##// END OF EJS Templates
changegroup: pull _fileheader out of cgpacker...
Gregory Szorc -
r39017:227ebd88 default
parent child Browse files
Show More
@@ -66,6 +66,10 b' def closechunk():'
66 """return a changegroup chunk header (string) for a zero-length chunk"""
66 """return a changegroup chunk header (string) for a zero-length chunk"""
67 return struct.pack(">l", 0)
67 return struct.pack(">l", 0)
68
68
69 def _fileheader(path):
70 """Obtain a changegroup chunk header for a named path."""
71 return chunkheader(len(path)) + path
72
69 def writechunks(ui, chunks, filename, vfs=None):
73 def writechunks(ui, chunks, filename, vfs=None):
70 """Write chunks to a file and return its filename.
74 """Write chunks to a file and return its filename.
71
75
@@ -606,9 +610,6 b' class cgpacker(object):'
606
610
607 return closechunk()
611 return closechunk()
608
612
609 def _fileheader(self, fname):
610 return chunkheader(len(fname)) + fname
611
612 # Extracted both for clarity and for overriding in extensions.
613 # Extracted both for clarity and for overriding in extensions.
613 def _sortgroup(self, store, ischangelog, nodelist, lookup):
614 def _sortgroup(self, store, ischangelog, nodelist, lookup):
614 """Sort nodes for change group and turn them into revnums."""
615 """Sort nodes for change group and turn them into revnums."""
@@ -701,7 +702,7 b' class cgpacker(object):'
701
702
702 if dir:
703 if dir:
703 assert self.version == b'03'
704 assert self.version == b'03'
704 yield self._fileheader(dir)
705 yield _fileheader(dir)
705
706
706 # TODO violates storage abstractions by assuming revlogs.
707 # TODO violates storage abstractions by assuming revlogs.
707 dirlog = self._repo.manifestlog._revlog.dirlog(dir)
708 dirlog = self._repo.manifestlog._revlog.dirlog(dir)
@@ -981,7 +982,7 b' class cgpacker(object):'
981 filenodes = self._prune(filerevlog, linkrevnodes, commonrevs)
982 filenodes = self._prune(filerevlog, linkrevnodes, commonrevs)
982 if filenodes:
983 if filenodes:
983 progress.update(i + 1, item=fname)
984 progress.update(i + 1, item=fname)
984 h = self._fileheader(fname)
985 h = _fileheader(fname)
985 size = len(h)
986 size = len(h)
986 yield h
987 yield h
987 for chunk in self.group(filenodes, filerevlog, False,
988 for chunk in self.group(filenodes, filerevlog, False,
General Comments 0
You need to be logged in to leave comments. Login now