# HG changeset patch # User Pierre-Yves David # Date 1685326350 -7200 # Node ID 1415e17ea20f9312ce98e2b5b1b091f31261de93 # Parent f2ae815ae34c8254f306afa18849e3313e8aeec5 stream-clone: pre-indent some code This make the next changeset clearer. diff -r f2ae815ae34c -r 1415e17ea20f mercurial/streamclone.py --- a/mercurial/streamclone.py Sun May 28 04:12:10 2023 +0200 +++ b/mercurial/streamclone.py Mon May 29 04:12:30 2023 +0200 @@ -644,40 +644,39 @@ totalbytecount = 0 for src, name, ftype, data in entries: - vfs = vfsmap[src] - yield src - yield util.uvarintencode(len(name)) - if ftype == _fileappend: - fp = vfs(name) - size = data - elif ftype == _filefull: - fp = open(data, b'rb') - size = util.fstat(fp).st_size - bytecount = 0 - try: - yield util.uvarintencode(size) - yield name - if size <= 65536: - chunks = (fp.read(size),) - else: - chunks = util.filechunkiter(fp, limit=size) - for chunk in chunks: - bytecount += len(chunk) - totalbytecount += len(chunk) - progress.update(totalbytecount) - yield chunk - if bytecount != size: - # Would most likely be caused by a race due to `hg strip` or - # a revlog split - raise error.Abort( - _( + if True: + vfs = vfsmap[src] + yield src + yield util.uvarintencode(len(name)) + if ftype == _fileappend: + fp = vfs(name) + size = data + elif ftype == _filefull: + fp = open(data, b'rb') + size = util.fstat(fp).st_size + bytecount = 0 + try: + yield util.uvarintencode(size) + yield name + if size <= 65536: + chunks = (fp.read(size),) + else: + chunks = util.filechunkiter(fp, limit=size) + for chunk in chunks: + bytecount += len(chunk) + totalbytecount += len(chunk) + progress.update(totalbytecount) + yield chunk + if bytecount != size: + # Would most likely be caused by a race due to `hg + # strip` or a revlog split + msg = _( b'clone could only read %d bytes from %s, but ' b'expected %d bytes' ) - % (bytecount, name, size) - ) - finally: - fp.close() + raise error.Abort(msg % (bytecount, name, size)) + finally: + fp.close() def _test_sync_point_walk_1(repo):