Mercurial > public > mercurial-scm > hg
diff mercurial/wireproto.py @ 35491:ded3a63f305b
streamclone: move wire protocol status code from wireproto command
This consolidates the code for the streaming clone wire protocol format
into streamclone.py. It also eliminates a generator wrapper, which might
make streaming clones slightly faster.
Differential Revision: https://phab.mercurial-scm.org/D1754
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 24 Dec 2017 11:46:13 -0700 |
parents | 7d2292416046 |
children | 8cdb671dbd0b |
line wrap: on
line diff
--- a/mercurial/wireproto.py Fri Dec 22 15:25:34 2017 -0600 +++ b/mercurial/wireproto.py Sun Dec 24 11:46:13 2017 -0700 @@ -954,21 +954,7 @@ capability with a value representing the version and flags of the repo it is serving. Client checks to see if it understands the format. ''' - if not streamclone.allowservergeneration(repo): - return '1\n' - - def getstream(it): - yield '0\n' - for chunk in it: - yield chunk - - try: - # LockError may be raised before the first result is yielded. Don't - # emit output until we're sure we got the lock successfully. - it = streamclone.generatev1wireproto(repo) - return streamres(gen=getstream(it)) - except error.LockError: - return '2\n' + return streamres(streamclone.generatev1wireproto(repo)) @wireprotocommand('unbundle', 'heads') def unbundle(repo, proto, heads):