Mercurial > public > mercurial-scm > hg
diff mercurial/changegroup.py @ 21063:7ca4f2049d3b
bundle2: move `readbundle` into the `exchange` module
The `readbundle` function is going to understand the bundle2 header. We move the
function to a more suitable place before making any other changes.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Mon, 14 Apr 2014 15:33:50 -0400 |
parents | 1e28ec9744bf |
children | 240d340fe152 |
line wrap: on
line diff
--- a/mercurial/changegroup.py Mon Apr 14 14:46:32 2014 -0400 +++ b/mercurial/changegroup.py Mon Apr 14 15:33:50 2014 -0400 @@ -227,25 +227,6 @@ return d return readexactly(self._fh, n) -def readbundle(fh, fname, vfs=None): - header = readexactly(fh, 6) - - if not fname: - fname = "stream" - if not header.startswith('HG') and header.startswith('\0'): - fh = headerlessfixup(fh, header) - header = "HG10UN" - elif vfs: - fname = vfs.join(fname) - - magic, version, alg = header[0:2], header[2:4], header[4:6] - - if magic != 'HG': - raise util.Abort(_('%s: not a Mercurial bundle') % fname) - if version != '10': - raise util.Abort(_('%s: unknown bundle version %s') % (fname, version)) - return unbundle10(fh, alg) - class bundle10(object): deltaheader = _BUNDLE10_DELTA_HEADER def __init__(self, repo, bundlecaps=None):