36 |
36 |
37 def allsupportedversions(orig, ui): |
37 def allsupportedversions(orig, ui): |
38 versions = orig(ui) |
38 versions = orig(ui) |
39 versions.add('03') |
39 versions.add('03') |
40 return versions |
40 return versions |
|
41 |
|
42 def _capabilities(orig, repo, proto): |
|
43 '''Wrap server command to announce lfs server capability''' |
|
44 caps = orig(repo, proto) |
|
45 # XXX: change to 'lfs=serve' when separate git server isn't required? |
|
46 caps.append('lfs') |
|
47 return caps |
41 |
48 |
42 def bypasscheckhash(self, text): |
49 def bypasscheckhash(self, text): |
43 return False |
50 return False |
44 |
51 |
45 def readfromstore(self, text): |
52 def readfromstore(self, text): |
262 Read through the revisions to push, looking for filelog entries that can be |
269 Read through the revisions to push, looking for filelog entries that can be |
263 deserialized into metadata so that we can block the push on their upload to |
270 deserialized into metadata so that we can block the push on their upload to |
264 the remote blobstore. |
271 the remote blobstore. |
265 """ |
272 """ |
266 return uploadblobsfromrevs(pushop.repo, pushop.outgoing.missing) |
273 return uploadblobsfromrevs(pushop.repo, pushop.outgoing.missing) |
|
274 |
|
275 def push(orig, repo, remote, *args, **kwargs): |
|
276 """bail on push if the extension isn't enabled on remote when needed""" |
|
277 if 'lfs' in repo.requirements: |
|
278 # If the remote peer is for a local repo, the requirement tests in the |
|
279 # base class method enforce lfs support. Otherwise, some revisions in |
|
280 # this repo use lfs, and the remote repo needs the extension loaded. |
|
281 if not remote.local() and not remote.capable('lfs'): |
|
282 # This is a copy of the message in exchange.push() when requirements |
|
283 # are missing between local repos. |
|
284 m = _("required features are not supported in the destination: %s") |
|
285 raise error.Abort(m % 'lfs', |
|
286 hint=_('enable the lfs extension on the server')) |
|
287 return orig(repo, remote, *args, **kwargs) |
267 |
288 |
268 def writenewbundle(orig, ui, repo, source, filename, bundletype, outgoing, |
289 def writenewbundle(orig, ui, repo, source, filename, bundletype, outgoing, |
269 *args, **kwargs): |
290 *args, **kwargs): |
270 """upload LFS blobs added by outgoing revisions on 'hg bundle'""" |
291 """upload LFS blobs added by outgoing revisions on 'hg bundle'""" |
271 uploadblobsfromrevs(repo, outgoing.missing) |
292 uploadblobsfromrevs(repo, outgoing.missing) |