D4138: changegroup: pull _fileheader out of cgpacker

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Thu Aug 9 14:16:07 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG227ebd88ce5e: changegroup: pull _fileheader out of cgpacker (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4138?vs=10009&id=10145

REVISION DETAIL
  https://phab.mercurial-scm.org/D4138

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -66,6 +66,10 @@
     """return a changegroup chunk header (string) for a zero-length chunk"""
     return struct.pack(">l", 0)
 
+def _fileheader(path):
+    """Obtain a changegroup chunk header for a named path."""
+    return chunkheader(len(path)) + path
+
 def writechunks(ui, chunks, filename, vfs=None):
     """Write chunks to a file and return its filename.
 
@@ -606,9 +610,6 @@
 
         return closechunk()
 
-    def _fileheader(self, fname):
-        return chunkheader(len(fname)) + fname
-
     # Extracted both for clarity and for overriding in extensions.
     def _sortgroup(self, store, ischangelog, nodelist, lookup):
         """Sort nodes for change group and turn them into revnums."""
@@ -701,7 +702,7 @@
 
         if dir:
             assert self.version == b'03'
-            yield self._fileheader(dir)
+            yield _fileheader(dir)
 
         # TODO violates storage abstractions by assuming revlogs.
         dirlog = self._repo.manifestlog._revlog.dirlog(dir)
@@ -981,7 +982,7 @@
             filenodes = self._prune(filerevlog, linkrevnodes, commonrevs)
             if filenodes:
                 progress.update(i + 1, item=fname)
-                h = self._fileheader(fname)
+                h = _fileheader(fname)
                 size = len(h)
                 yield h
                 for chunk in self.group(filenodes, filerevlog, False,



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list