def peernarrowwiden(remote, **kwargs): for ch in (r'oldincludes', r'newincludes', r'oldexcludes', r'newexcludes', r'commonheads', r'known'): kwargs[ch] = wireprototypes.encodelist(kwargs[ch]) kwargs[r'ellipses'] = '%i' % bool(kwargs[r'ellipses']) f = remote._callcompressable('narrow_widen', **kwargs) return bundle2.getunbundler(remote.ui, f)
def unbundle_fh(fh, path): header = readexactly(fh, 4) magic, version = header[0:2], header[2:4] if magic != 'HG': raise Exception('%s: not a Mercurial bundle' % path) if version == '10': alg = readexactly(fh, 2) return cg1unpacker(fh, alg) elif unbundle20 and version.startswith('2'): return getunbundler(get_ui(), fh, header) else: raise Exception('%s: unsupported bundle version %s' % (path, version))
def __init__(self, path): self._url = path fh = open(path, 'r') header = readexactly(fh, 4) magic, version = header[0:2], header[2:4] if magic != 'HG': raise Exception('%s: not a Mercurial bundle' % path) if version == '10': alg = readexactly(fh, 2) self._bundle = cg1unpacker(fh, alg) elif unbundle20 and version.startswith('2'): self._bundle = getunbundler(get_ui(), fh, magicstring=header) else: raise Exception('%s: unsupported bundle version %s' % (path, version)) self._file = os.path.basename(path)