# HG changeset patch # User Boris Feld # Date 1508246842 -7200 # Node ID 44b8b5ad30eb41c678c6fccfeac98cff5ec0da38 # Parent cb4dcd7fabe7bfc243433cdb5aea28214ef38509 pull: retrieve bookmarks through the binary part when possible This makes pull consistent with the part used by push and provide us with a more compact representation of bookmarks. In addition, this opens the way for smarter bookmark exchanges (e.g. filtering by names or only sending the bookmark relevant to the pulled set, etc). diff -r cb4dcd7fabe7 -r 44b8b5ad30eb mercurial/exchange.py --- a/mercurial/exchange.py Tue Oct 17 15:27:17 2017 +0200 +++ b/mercurial/exchange.py Tue Oct 17 15:27:22 2017 +0200 @@ -1469,12 +1469,26 @@ kwargs['phases'] = True pullop.stepsdone.add('phases') + bookmarksrequested = False + legacybookmark = 'bookmarks' in ui.configlist('devel', 'legacy.exchange') + hasbinarybook = 'bookmarks' in pullop.remotebundle2caps + + if pullop.remotebookmarks is not None: + pullop.stepsdone.add('request-bookmarks') + + if ('request-bookmarks' not in pullop.stepsdone + and pullop.remotebookmarks is None + and not legacybookmark and hasbinarybook): + kwargs['bookmarks'] = True + bookmarksrequested = True + if 'listkeys' in pullop.remotebundle2caps: if 'phases' not in pullop.stepsdone: kwargs['listkeys'] = ['phases'] - if pullop.remotebookmarks is None: + if 'request-bookmarks' not in pullop.stepsdone: # make sure to always includes bookmark data when migrating # `hg incoming --bundle` to using this function. + pullop.stepsdone.add('request-bookmarks') kwargs.setdefault('listkeys', []).append('bookmarks') # If this is a full pull / clone and the server supports the clone bundles @@ -1502,7 +1516,9 @@ _pullbundle2extraprepare(pullop, kwargs) bundle = pullop.remote.getbundle('pull', **pycompat.strkwargs(kwargs)) try: - op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) + op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction) + op.modes['bookmarks'] = 'records' + bundle2.processbundle(pullop.repo, bundle, op=op) except bundle2.AbortFromPart as exc: pullop.repo.ui.status(_('remote: abort: %s\n') % exc) raise error.Abort(_('pull failed on remote'), hint=exc.hint) @@ -1518,9 +1534,15 @@ _pullapplyphases(pullop, value) # processing bookmark update - for namespace, value in op.records['listkeys']: - if namespace == 'bookmarks': - pullop.remotebookmarks = bookmod.unhexlifybookmarks(value) + if bookmarksrequested: + books = {} + for record in op.records['bookmarks']: + books[record['bookmark']] = record["node"] + pullop.remotebookmarks = books + else: + for namespace, value in op.records['listkeys']: + if namespace == 'bookmarks': + pullop.remotebookmarks = bookmod.unhexlifybookmarks(value) # bookmark data were either already there or pulled in the bundle if pullop.remotebookmarks is not None: diff -r cb4dcd7fabe7 -r 44b8b5ad30eb tests/test-clonebundles.t --- a/tests/test-clonebundles.t Tue Oct 17 15:27:17 2017 +0200 +++ b/tests/test-clonebundles.t Tue Oct 17 15:27:22 2017 +0200 @@ -33,7 +33,7 @@ $ cat server/access.log * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) - $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) Empty manifest file results in retrieval (the extension only checks if the manifest file exists) diff -r cb4dcd7fabe7 -r 44b8b5ad30eb tests/test-http-bad-server.t --- a/tests/test-http-bad-server.t Tue Oct 17 15:27:17 2017 +0200 +++ b/tests/test-http-bad-server.t Tue Oct 17 15:27:22 2017 +0200 @@ -137,7 +137,7 @@ Failure to read getbundle HTTP request - $ hg serve --config badserver.closeafterrecvbytes=292 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.closeafterrecvbytes=304 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone requesting all changes @@ -147,35 +147,36 @@ $ killdaemons.py $DAEMON_PIDS $ cat error.log - readline(292 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n - readline(259 from -1) -> (27) Accept-Encoding: identity\r\n - readline(232 from -1) -> (35) accept: application/mercurial-0.1\r\n - readline(197 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob) - readline(17? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(12? from -1) -> (2) \r\n (glob) + readline(1 from -1) -> (1) x (?) + readline(1 from -1) -> (1) x (?) + readline(304 from 65537) -> (33) GET /?cmd=capabilities HTTP/1.1\r\n + readline(271 from -1) -> (27) Accept-Encoding: identity\r\n + readline(244 from -1) -> (35) accept: application/mercurial-0.1\r\n + readline(209 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob) + readline(18? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) + readline(13? from -1) -> (2) \r\n (glob) write(36) -> HTTP/1.1 200 Script output follows\r\n write(23) -> Server: badhttpserver\r\n write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n write(41) -> Content-Type: application/mercurial-0.1\r\n - readline(1 from -1) -> (1) x (?) write(21) -> Content-Length: 417\r\n write(2) -> \r\n write(417) -> lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none - readline\(12[34] from 65537\) -> \(2[67]\) GET /\?cmd=batch HTTP/1.1\\r\\n (re) - readline(9? from -1) -> (27) Accept-Encoding: identity\r\n (glob) - readline(7? from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) - readline(4? from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) - readline(1 from -1) -> (1) x (?) + readline(13? from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n (glob) + readline(1?? from -1) -> (27) Accept-Encoding: identity\r\n (glob) + readline(8? from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n (glob) + readline(5? from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n (glob) + readline(1? from -1) -> (1?) x-hgproto-1:* (glob) read limit reached; closing socket - readline(292 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n - readline(266 from -1) -> (27) Accept-Encoding: identity\r\n - readline(239 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n - readline(210 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n - readline(169 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n - readline(121 from -1) -> (35) accept: application/mercurial-0.1\r\n - readline(86 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob) - readline(6? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) - readline(1? from -1) -> (2) \r\n (glob) + readline(304 from 65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n + readline(278 from -1) -> (27) Accept-Encoding: identity\r\n + readline(251 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n + readline(222 from -1) -> (41) x-hgarg-1: cmds=heads+%3Bknown+nodes%3D\r\n + readline(181 from -1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n + readline(133 from -1) -> (35) accept: application/mercurial-0.1\r\n + readline(98 from -1) -> (2?) host: localhost:$HGPORT\r\n (glob) + readline(7? from -1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n (glob) + readline(2? from -1) -> (2) \r\n (glob) write(36) -> HTTP/1.1 200 Script output follows\r\n write(23) -> Server: badhttpserver\r\n write(37) -> Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n @@ -183,12 +184,12 @@ write(20) -> Content-Length: 42\r\n write(2) -> \r\n write(42) -> 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; - readline\(1[23] from 65537\) -> \(1[23]\) GET /\?cmd=ge.? (re) + readline(2? from 65537) -> (2?) GET /?cmd=getbundle HTTP* (glob) read limit reached; closing socket - readline(292 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n - readline(262 from -1) -> (27) Accept-Encoding: identity\r\n - readline(235 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n - readline(206 from -1) -> (206) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtag + readline(304 from 65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n + readline(274 from -1) -> (27) Accept-Encoding: identity\r\n + readline(247 from -1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n + readline(218 from -1) -> (218) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtag read limit reached; closing socket $ rm -f error.log @@ -399,7 +400,7 @@ Server sends incomplete headers for getbundle response - $ hg serve --config badserver.closeaftersendbytes=895 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.closeaftersendbytes=907 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS TODO this output is terrible @@ -407,7 +408,7 @@ $ hg clone http://localhost:$HGPORT/ clone requesting all changes abort: 'http://localhost:$HGPORT/' does not appear to be an hg repository: - ---%<--- (applica) + ---%<--- (application/mercuri) ---%<--- ! @@ -422,13 +423,13 @@ readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n readline(-1) -> (2) \r\n - write(36 from 36) -> (859) HTTP/1.1 200 Script output follows\r\n - write(23 from 23) -> (836) Server: badhttpserver\r\n - write(37 from 37) -> (799) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n - write(41 from 41) -> (758) Content-Type: application/mercurial-0.1\r\n - write(21 from 21) -> (737) Content-Length: 417\r\n - write(2 from 2) -> (735) \r\n - write(417 from 417) -> (318) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none + write(36 from 36) -> (871) HTTP/1.1 200 Script output follows\r\n + write(23 from 23) -> (848) Server: badhttpserver\r\n + write(37 from 37) -> (811) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n + write(41 from 41) -> (770) Content-Type: application/mercurial-0.1\r\n + write(21 from 21) -> (749) Content-Length: 417\r\n + write(2 from 2) -> (747) \r\n + write(417 from 417) -> (330) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(-1) -> (27) Accept-Encoding: identity\r\n readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n @@ -438,26 +439,26 @@ readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n readline(-1) -> (2) \r\n - write(36 from 36) -> (282) HTTP/1.1 200 Script output follows\r\n - write(23 from 23) -> (259) Server: badhttpserver\r\n - write(37 from 37) -> (222) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n - write(41 from 41) -> (181) Content-Type: application/mercurial-0.1\r\n - write(20 from 20) -> (161) Content-Length: 42\r\n - write(2 from 2) -> (159) \r\n - write(42 from 42) -> (117) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; + write(36 from 36) -> (294) HTTP/1.1 200 Script output follows\r\n + write(23 from 23) -> (271) Server: badhttpserver\r\n + write(37 from 37) -> (234) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n + write(41 from 41) -> (193) Content-Type: application/mercurial-0.1\r\n + write(20 from 20) -> (173) Content-Length: 42\r\n + write(2 from 2) -> (171) \r\n + write(42 from 42) -> (129) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n readline(-1) -> (27) Accept-Encoding: identity\r\n readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n - readline(-1) -> (410) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n + readline(-1) -> (422) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n readline(-1) -> (35) accept: application/mercurial-0.1\r\n readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n readline(-1) -> (2) \r\n - write(36 from 36) -> (81) HTTP/1.1 200 Script output follows\r\n - write(23 from 23) -> (58) Server: badhttpserver\r\n - write(37 from 37) -> (21) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n - write(21 from 41) -> (0) Content-Type: applica + write(36 from 36) -> (93) HTTP/1.1 200 Script output follows\r\n + write(23 from 23) -> (70) Server: badhttpserver\r\n + write(37 from 37) -> (33) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n + write(33 from 41) -> (0) Content-Type: application/mercuri write limit reached; closing socket write(36) -> HTTP/1.1 500 Internal Server Error\r\n @@ -509,7 +510,7 @@ readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n readline(-1) -> (27) Accept-Encoding: identity\r\n readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n - readline(-1) -> (410) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n + readline(-1) -> (422) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n readline(-1) -> (35) accept: application/mercurial-0.1\r\n readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) @@ -528,12 +529,12 @@ Server sends partial compression string - $ hg serve --config badserver.closeaftersendbytes=957 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.closeaftersendbytes=969 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone requesting all changes - abort: HTTP request error (incomplete response; expected 1 bytes got 3) + abort: HTTP request error (incomplete response) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] @@ -546,13 +547,13 @@ readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n readline(-1) -> (2) \r\n - write(36 from 36) -> (921) HTTP/1.1 200 Script output follows\r\n - write(23 from 23) -> (898) Server: badhttpserver\r\n - write(37 from 37) -> (861) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n - write(41 from 41) -> (820) Content-Type: application/mercurial-0.1\r\n - write(21 from 21) -> (799) Content-Length: 417\r\n - write(2 from 2) -> (797) \r\n - write(417 from 417) -> (380) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none + write(36 from 36) -> (933) HTTP/1.1 200 Script output follows\r\n + write(23 from 23) -> (910) Server: badhttpserver\r\n + write(37 from 37) -> (873) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n + write(41 from 41) -> (832) Content-Type: application/mercurial-0.1\r\n + write(21 from 21) -> (811) Content-Length: 417\r\n + write(2 from 2) -> (809) \r\n + write(417 from 417) -> (392) lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 bundle2=HG20%0Abookmarks%0Achangegroup%3D01%2C02%0Adigests%3Dmd5%2Csha1%2Csha512%0Aerror%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0Ahgtagsfnodes%0Alistkeys%0Apushkey%0Aremote-changegroup%3Dhttp%2Chttps unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024 httpmediatype=0.1rx,0.1tx,0.2tx compression=none readline(65537) -> (26) GET /?cmd=batch HTTP/1.1\r\n readline(-1) -> (27) Accept-Encoding: identity\r\n readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n @@ -562,30 +563,31 @@ readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n readline(-1) -> (2) \r\n - write(36 from 36) -> (344) HTTP/1.1 200 Script output follows\r\n - write(23 from 23) -> (321) Server: badhttpserver\r\n - write(37 from 37) -> (284) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n - write(41 from 41) -> (243) Content-Type: application/mercurial-0.1\r\n - write(20 from 20) -> (223) Content-Length: 42\r\n - write(2 from 2) -> (221) \r\n - write(42 from 42) -> (179) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; + write(36 from 36) -> (356) HTTP/1.1 200 Script output follows\r\n + write(23 from 23) -> (333) Server: badhttpserver\r\n + write(37 from 37) -> (296) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n + write(41 from 41) -> (255) Content-Type: application/mercurial-0.1\r\n + write(20 from 20) -> (235) Content-Length: 42\r\n + write(2 from 2) -> (233) \r\n + write(42 from 42) -> (191) 96ee1d7354c4ad7372047672c36a1f561e3a6a4c\n; readline(65537) -> (30) GET /?cmd=getbundle HTTP/1.1\r\n readline(-1) -> (27) Accept-Encoding: identity\r\n readline(-1) -> (29) vary: X-HgArg-1,X-HgProto-1\r\n - readline(-1) -> (410) x-hgarg-1: bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n + readline(-1) -> (422) x-hgarg-1: bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=96ee1d7354c4ad7372047672c36a1f561e3a6a4c&listkeys=phases%2Cbookmarks\r\n readline(-1) -> (48) x-hgproto-1: 0.1 0.2 comp=$USUAL_COMPRESSIONS$\r\n readline(-1) -> (35) accept: application/mercurial-0.1\r\n readline(-1) -> (2?) host: localhost:$HGPORT\r\n (glob) readline(-1) -> (49) user-agent: mercurial/proto-1.0 (Mercurial 4.2)\r\n readline(-1) -> (2) \r\n - write(36 from 36) -> (143) HTTP/1.1 200 Script output follows\r\n - write(23 from 23) -> (120) Server: badhttpserver\r\n - write(37 from 37) -> (83) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n - write(41 from 41) -> (42) Content-Type: application/mercurial-0.2\r\n - write(28 from 28) -> (14) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (12) \r\n - write(6 from 6) -> (6) 1\\r\\n\x04\\r\\n (esc) - write(6 from 9) -> (0) 4\r\nnon + write(36 from 36) -> (155) HTTP/1.1 200 Script output follows\r\n + write(23 from 23) -> (132) Server: badhttpserver\r\n + write(37 from 37) -> (95) Date: Fri, 14 Apr 2017 00:00:00 GMT\r\n + write(41 from 41) -> (54) Content-Type: application/mercurial-0.2\r\n + write(28 from 28) -> (26) Transfer-Encoding: chunked\r\n + write(2 from 2) -> (24) \r\n + write(6 from 6) -> (18) 1\\r\\n\x04\\r\\n (esc) + write(9 from 9) -> (9) 4\r\nnone\r\n + write(9 from 9) -> (0) 4\r\nHG20\r\n write limit reached; closing socket write(27) -> 15\r\nInternal Server Error\r\n @@ -723,7 +725,7 @@ Server stops after bundle2 part payload chunk size - $ hg serve --config badserver.closeaftersendbytes=1043 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.closeaftersendbytes=1055 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -731,22 +733,22 @@ adding changesets transaction abort! rollback completed - abort: HTTP request error (incomplete response) + abort: HTTP request error (incomplete response; expected 459 bytes got 7) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] $ killdaemons.py $DAEMON_PIDS $ tail -11 error.log - write(28 from 28) -> (100) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (98) \r\n - write(6 from 6) -> (92) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (83) 4\r\nnone\r\n - write(9 from 9) -> (74) 4\r\nHG20\r\n - write(9 from 9) -> (65) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (56) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (9) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) -> (0) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + write(2 from 2) -> (110) \r\n + write(6 from 6) -> (104) 1\\r\\n\x04\\r\\n (esc) + write(9 from 9) -> (95) 4\r\nnone\r\n + write(9 from 9) -> (86) 4\r\nHG20\r\n + write(9 from 9) -> (77) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9 from 9) -> (68) 4\\r\\n\x00\x00\x00)\\r\\n (esc) + write(47 from 47) -> (21) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + write(9 from 9) -> (12) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + write(12 from 473) -> (0) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1d (esc) write limit reached; closing socket write(27) -> 15\r\nInternal Server Error\r\n @@ -786,7 +788,7 @@ Server stops sending after 0 length payload chunk size - $ hg serve --config badserver.closeaftersendbytes=1525 -p $HGPORT -d --pid-file=hg.pid -E error.log + $ hg serve --config badserver.closeaftersendbytes=1547 -p $HGPORT -d --pid-file=hg.pid -E error.log $ cat hg.pid > $DAEMON_PIDS $ hg clone http://localhost:$HGPORT/ clone @@ -797,24 +799,24 @@ added 1 changesets with 1 changes to 1 files transaction abort! rollback completed - abort: HTTP request error (incomplete response) + abort: HTTP request error (incomplete response; expected 23 bytes got 9) (this may be an intermittent network failure; if the error persists, consider contacting the network or server operator) [255] $ killdaemons.py $DAEMON_PIDS $ tail -13 error.log - write(28 from 28) -> (582) Transfer-Encoding: chunked\r\n - write(2 from 2) -> (580) \r\n - write(6 from 6) -> (574) 1\\r\\n\x04\\r\\n (esc) - write(9 from 9) -> (565) 4\r\nnone\r\n - write(9 from 9) -> (556) 4\r\nHG20\r\n - write(9 from 9) -> (547) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) - write(9 from 9) -> (538) 4\\r\\n\x00\x00\x00)\\r\\n (esc) - write(47 from 47) -> (491) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) - write(9 from 9) -> (482) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) - write(473 from 473) -> (9) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (0) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(6 from 6) -> (596) 1\\r\\n\x04\\r\\n (esc) + write(9 from 9) -> (587) 4\r\nnone\r\n + write(9 from 9) -> (578) 4\r\nHG20\r\n + write(9 from 9) -> (569) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9 from 9) -> (560) 4\\r\\n\x00\x00\x00)\\r\\n (esc) + write(47 from 47) -> (513) 29\\r\\n\x0bCHANGEGROUP\x00\x00\x00\x00\x01\x01\x07\x02 \x01version02nbchanges1\\r\\n (esc) + write(9 from 9) -> (504) 4\\r\\n\x00\x00\x01\xd2\\r\\n (esc) + write(473 from 473) -> (31) 1d2\\r\\n\x00\x00\x00\xb2\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x96\xee\x1dsT\xc4\xadsr\x04vr\xc3j\x1fV\x1e:jL\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50\\ntest\\n0 0\\nfoo\\n\\ninitial\x00\x00\x00\x00\x00\x00\x00\xa1j=\xf4\xde8\x8f (22) 4\\r\\n\x00\x00\x00\x00\\r\\n (esc) + write(9 from 9) -> (13) 4\\r\\n\x00\x00\x00 \\r\\n (esc) + write(13 from 38) -> (0) 20\\r\\n\x08LISTKEYS (esc) write limit reached; closing socket write(27) -> 15\r\nInternal Server Error\r\n diff -r cb4dcd7fabe7 -r 44b8b5ad30eb tests/test-http-proxy.t --- a/tests/test-http-proxy.t Tue Oct 17 15:27:17 2017 +0200 +++ b/tests/test-http-proxy.t Tue Oct 17 15:27:22 2017 +0200 @@ -110,16 +110,16 @@ $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=branchmap HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=stream_out HTTP/1.1" - - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D83180e7845de420a1bb46896fd5fe05294f8d629 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) - $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=0&common=83180e7845de420a1bb46896fd5fe05294f8d629&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=83180e7845de420a1bb46896fd5fe05294f8d629&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) - $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) - $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) - $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob) $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) - $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) + $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ (glob) diff -r cb4dcd7fabe7 -r 44b8b5ad30eb tests/test-http.t --- a/tests/test-http.t Tue Oct 17 15:27:17 2017 +0200 +++ b/tests/test-http.t Tue Oct 17 15:27:22 2017 +0200 @@ -286,11 +286,11 @@ "GET /?cmd=stream_out HTTP/1.1" 401 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ "GET /?cmd=stream_out HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D5fed3813f7f5e1824344fdc9cf8f63bb662c292d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ - "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ + "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=0&common=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ - "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ - "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ + "GET /?cmd=getbundle HTTP/1.1" 401 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ + "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=5fed3813f7f5e1824344fdc9cf8f63bb662c292d&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=lookup HTTP/1.1" 200 - x-hgarg-1:key=tip x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ "GET /?cmd=listkeys HTTP/1.1" 401 - x-hgarg-1:namespace=namespaces x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ diff -r cb4dcd7fabe7 -r 44b8b5ad30eb tests/test-ssh.t --- a/tests/test-ssh.t Tue Oct 17 15:27:17 2017 +0200 +++ b/tests/test-ssh.t Tue Oct 17 15:27:22 2017 +0200 @@ -493,11 +493,13 @@ no changes found sending getbundle command bundle2-input-bundle: with-transaction + bundle2-input-part: "bookmarks" supported + bundle2-input-part: total payload size 26 bundle2-input-part: "listkeys" (params: 1 mandatory) supported bundle2-input-part: total payload size 45 bundle2-input-part: "phase-heads" supported bundle2-input-part: total payload size 72 - bundle2-input-bundle: 1 parts total + bundle2-input-bundle: 2 parts total checking for updated bookmarks $ cd ..