mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
902af15d1e
Summary: The pack wireprotocol will be useful for exchanging treemanifests, so let's refactor it out to it's own file. There's a slight protocol change here, where we terminate the response with 10 null bytes (2 for 0 length filename, 4 for 0 length data, 4 for 0 length history) instead of the original 2 null bytes (for 0 length filename) which didn't let us handle entries with '' as the name. This pack exchange code isn't even used in production, since most remotefilelog downloads are done via the lose file (getfile/getfiles) format. Test Plan: Ran the tests. Even though this code isn't used in production, the prefetch and repack tests still cover it. Reviewers: #mercurial, rmcelroy Reviewed By: rmcelroy Subscribers: mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4860556 Signature: t1:4860556:1491853521:c3810a4a681606571354b270b957e8df0962c86a
27 lines
541 B
Python
27 lines
541 B
Python
from mercurial.i18n import _
|
|
|
|
import struct
|
|
|
|
REQUIREMENT = "remotefilelog"
|
|
|
|
FILENAMESTRUCT = '!H'
|
|
FILENAMESIZE = struct.calcsize(FILENAMESTRUCT)
|
|
|
|
NODESIZE = 20
|
|
PACKREQUESTCOUNTSTRUCT = '!I'
|
|
|
|
NODECOUNTSTRUCT = '!I'
|
|
NODECOUNTSIZE = struct.calcsize(NODECOUNTSTRUCT)
|
|
|
|
PATHCOUNTSTRUCT = '!I'
|
|
PATHCOUNTSIZE = struct.calcsize(PATHCOUNTSTRUCT)
|
|
|
|
FILEPACK_CATEGORY=""
|
|
TREEPACK_CATEGORY="manifests"
|
|
|
|
def getunits(category):
|
|
if category == FILEPACK_CATEGORY:
|
|
return _("files")
|
|
if category == TREEPACK_CATEGORY:
|
|
return _("trees")
|