Show More
@@ -87,9 +87,9 b' Configs::' | |||||
87 | # git-lfs endpoint |
|
87 | # git-lfs endpoint | |
88 | # - file:///tmp/path |
|
88 | # - file:///tmp/path | |
89 | # local filesystem, usually for testing |
|
89 | # local filesystem, usually for testing | |
90 |
# if unset, lfs will assume the repository a |
|
90 | # if unset, lfs will assume the remote repository also handles blob storage | |
91 |
# |
|
91 | # for http(s) URLs. Otherwise, lfs will prompt to set this when it must | |
92 |
# |
|
92 | # use this value. | |
93 | # (default: unset) |
|
93 | # (default: unset) | |
94 | url = https://example.com/repo.git/info/lfs |
|
94 | url = https://example.com/repo.git/info/lfs | |
95 |
|
95 |
@@ -529,7 +529,7 b' def _verify(oid, content):' | |||||
529 | raise error.Abort(_('detected corrupt lfs object: %s') % oid, |
|
529 | raise error.Abort(_('detected corrupt lfs object: %s') % oid, | |
530 | hint=_('run hg verify')) |
|
530 | hint=_('run hg verify')) | |
531 |
|
531 | |||
532 | def remote(repo): |
|
532 | def remote(repo, remote=None): | |
533 | """remotestore factory. return a store in _storemap depending on config |
|
533 | """remotestore factory. return a store in _storemap depending on config | |
534 |
|
534 | |||
535 | If ``lfs.url`` is specified, use that remote endpoint. Otherwise, try to |
|
535 | If ``lfs.url`` is specified, use that remote endpoint. Otherwise, try to | |
@@ -541,7 +541,9 b' def remote(repo):' | |||||
541 | """ |
|
541 | """ | |
542 | url = util.url(repo.ui.config('lfs', 'url') or '') |
|
542 | url = util.url(repo.ui.config('lfs', 'url') or '') | |
543 | if url.scheme is None: |
|
543 | if url.scheme is None: | |
544 | if util.safehasattr(repo, '_subtoppath'): |
|
544 | if remote: | |
|
545 | defaulturl = util.url(remote) | |||
|
546 | elif util.safehasattr(repo, '_subtoppath'): | |||
545 | # The pull command sets this during the optional update phase, which |
|
547 | # The pull command sets this during the optional update phase, which | |
546 | # tells exactly where the pull originated, whether 'paths.default' |
|
548 | # tells exactly where the pull originated, whether 'paths.default' | |
547 | # or explicit. |
|
549 | # or explicit. |
@@ -289,7 +289,8 b' def prepush(pushop):' | |||||
289 | return uploadblobsfromrevs(pushop.repo, pushop.outgoing.missing) |
|
289 | return uploadblobsfromrevs(pushop.repo, pushop.outgoing.missing) | |
290 |
|
290 | |||
291 | def push(orig, repo, remote, *args, **kwargs): |
|
291 | def push(orig, repo, remote, *args, **kwargs): | |
292 |
"""bail on push if the extension isn't enabled on remote when needed |
|
292 | """bail on push if the extension isn't enabled on remote when needed, and | |
|
293 | update the remote store based on the destination path.""" | |||
293 | if 'lfs' in repo.requirements: |
|
294 | if 'lfs' in repo.requirements: | |
294 | # If the remote peer is for a local repo, the requirement tests in the |
|
295 | # If the remote peer is for a local repo, the requirement tests in the | |
295 | # base class method enforce lfs support. Otherwise, some revisions in |
|
296 | # base class method enforce lfs support. Otherwise, some revisions in | |
@@ -300,7 +301,18 b' def push(orig, repo, remote, *args, **kw' | |||||
300 | m = _("required features are not supported in the destination: %s") |
|
301 | m = _("required features are not supported in the destination: %s") | |
301 | raise error.Abort(m % 'lfs', |
|
302 | raise error.Abort(m % 'lfs', | |
302 | hint=_('enable the lfs extension on the server')) |
|
303 | hint=_('enable the lfs extension on the server')) | |
303 | return orig(repo, remote, *args, **kwargs) |
|
304 | ||
|
305 | # Repositories where this extension is disabled won't have the field. | |||
|
306 | # But if there's a requirement, then the extension must be loaded AND | |||
|
307 | # there may be blobs to push. | |||
|
308 | remotestore = repo.svfs.lfsremoteblobstore | |||
|
309 | try: | |||
|
310 | repo.svfs.lfsremoteblobstore = blobstore.remote(repo, remote.url()) | |||
|
311 | return orig(repo, remote, *args, **kwargs) | |||
|
312 | finally: | |||
|
313 | repo.svfs.lfsremoteblobstore = remotestore | |||
|
314 | else: | |||
|
315 | return orig(repo, remote, *args, **kwargs) | |||
304 |
|
316 | |||
305 | def writenewbundle(orig, ui, repo, source, filename, bundletype, outgoing, |
|
317 | def writenewbundle(orig, ui, repo, source, filename, bundletype, outgoing, | |
306 | *args, **kwargs): |
|
318 | *args, **kwargs): |
@@ -242,7 +242,23 b' lfs content, and the extension enabled.' | |||||
242 | $ echo 'this is another lfs file' > lfs2.txt |
|
242 | $ echo 'this is another lfs file' > lfs2.txt | |
243 | $ hg ci -Aqm 'lfs file with lfs client' |
|
243 | $ hg ci -Aqm 'lfs file with lfs client' | |
244 |
|
244 | |||
245 | $ hg push -q |
|
245 | $ hg --config paths.default= push -v http://localhost:$HGPORT | |
|
246 | pushing to http://localhost:$HGPORT/ | |||
|
247 | lfs: assuming remote store: http://localhost:$HGPORT/.git/info/lfs | |||
|
248 | searching for changes | |||
|
249 | remote has heads on branch 'default' that are not known locally: 8374dc4052cb | |||
|
250 | lfs: uploading a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de (25 bytes) | |||
|
251 | lfs: processed: a82f1c5cea0d40e3bb3a849686bb4e6ae47ca27e614de55c1ed0325698ef68de | |||
|
252 | lfs: uploaded 1 files (25 bytes) | |||
|
253 | 1 changesets found | |||
|
254 | uncompressed size of bundle content: | |||
|
255 | 206 (changelog) | |||
|
256 | 172 (manifests) | |||
|
257 | 275 lfs2.txt | |||
|
258 | remote: adding changesets | |||
|
259 | remote: adding manifests | |||
|
260 | remote: adding file changes | |||
|
261 | remote: added 1 changesets with 1 changes to 1 files | |||
246 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES |
|
262 | $ grep 'lfs' .hg/requires $SERVER_REQUIRES | |
247 | .hg/requires:lfs |
|
263 | .hg/requires:lfs | |
248 | $TESTTMP/server/.hg/requires:lfs |
|
264 | $TESTTMP/server/.hg/requires:lfs |
@@ -74,6 +74,7 b' store.' | |||||
74 | http auth: user foo, password *** |
|
74 | http auth: user foo, password *** | |
75 | pushing to ../repo2 |
|
75 | pushing to ../repo2 | |
76 | http auth: user foo, password *** |
|
76 | http auth: user foo, password *** | |
|
77 | http auth: user foo, password *** | |||
77 | query 1; heads |
|
78 | query 1; heads | |
78 | searching for changes |
|
79 | searching for changes | |
79 | 1 total queries in *s (glob) |
|
80 | 1 total queries in *s (glob) | |
@@ -209,6 +210,7 b' actions property completely.' | |||||
209 | http auth: user foo, password *** |
|
210 | http auth: user foo, password *** | |
210 | pushing to ../repo1 |
|
211 | pushing to ../repo1 | |
211 | http auth: user foo, password *** |
|
212 | http auth: user foo, password *** | |
|
213 | http auth: user foo, password *** | |||
212 | query 1; heads |
|
214 | query 1; heads | |
213 | searching for changes |
|
215 | searching for changes | |
214 | all remote heads known locally |
|
216 | all remote heads known locally | |
@@ -477,6 +479,7 b' Test a corrupted file upload' | |||||
477 | http auth: user foo, password *** |
|
479 | http auth: user foo, password *** | |
478 | pushing to ../repo1 |
|
480 | pushing to ../repo1 | |
479 | http auth: user foo, password *** |
|
481 | http auth: user foo, password *** | |
|
482 | http auth: user foo, password *** | |||
480 | query 1; heads |
|
483 | query 1; heads | |
481 | searching for changes |
|
484 | searching for changes | |
482 | all remote heads known locally |
|
485 | all remote heads known locally |
General Comments 0
You need to be logged in to leave comments.
Login now