Mercurial > hg
comparison mercurial/exchange.py @ 21141:d8dd19e09ed4
bundle2: advertise bundle2 caps in server capabilities
We can now retrieve them from the server during push. The capabilities are
encoded the same way as in `replycaps` part (with an extra layer of urlquoting
to escape separators).
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 17 Apr 2014 01:49:20 -0400 |
parents | 1ff06386217f |
children | 15039ce3e4a3 |
comparison
equal
deleted
inserted
replaced
21140:4aeb8da68090 | 21141:d8dd19e09ed4 |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from i18n import _ | 8 from i18n import _ |
9 from node import hex, nullid | 9 from node import hex, nullid |
10 import errno | 10 import errno, urllib |
11 import util, scmutil, changegroup, base85 | 11 import util, scmutil, changegroup, base85 |
12 import discovery, phases, obsolete, bookmarks, bundle2 | 12 import discovery, phases, obsolete, bookmarks, bundle2 |
13 | 13 |
14 def readbundle(ui, fh, fname, vfs=None): | 14 def readbundle(ui, fh, fname, vfs=None): |
15 header = changegroup.readexactly(fh, 4) | 15 header = changegroup.readexactly(fh, 4) |
205 """push data to the remote using bundle2 | 205 """push data to the remote using bundle2 |
206 | 206 |
207 The only currently supported type of data is changegroup but this will | 207 The only currently supported type of data is changegroup but this will |
208 evolve in the future.""" | 208 evolve in the future.""" |
209 # Send known head to the server for race detection. | 209 # Send known head to the server for race detection. |
210 bundler = bundle2.bundle20(pushop.ui) | 210 capsblob = urllib.unquote(pushop.remote.capable('bundle2')) |
211 caps = bundle2.decodecaps(capsblob) | |
212 bundler = bundle2.bundle20(pushop.ui, caps) | |
211 bundler.addpart(bundle2.bundlepart('replycaps')) | 213 bundler.addpart(bundle2.bundlepart('replycaps')) |
212 if not pushop.force: | 214 if not pushop.force: |
213 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads)) | 215 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads)) |
214 bundler.addpart(part) | 216 bundler.addpart(part) |
215 # add the changegroup bundle | 217 # add the changegroup bundle |