##// END OF EJS Templates
lfs: autoload the extension when cloning from repo with lfs enabled...
Matt Harbison -
r40360:6637b079 default
parent child Browse files
Show More
@@ -46,7 +46,13 b' def _capabilities(orig, repo, proto):'
46 46 '''Wrap server command to announce lfs server capability'''
47 47 caps = orig(repo, proto)
48 48 if util.safehasattr(repo.svfs, 'lfslocalblobstore'):
49 # XXX: change to 'lfs=serve' when separate git server isn't required?
49 # Advertise a slightly different capability when lfs is *required*, so
50 # that the client knows it MUST load the extension. If lfs is not
51 # required on the server, there's no reason to autoload the extension
52 # on the client.
53 if b'lfs' in repo.requirements:
54 caps.append('lfs-serve')
55
50 56 caps.append('lfs')
51 57 return caps
52 58
@@ -578,6 +578,23 b' def clone(ui, peeropts, source, dest=Non'
578 578
579 579 createopts['narrowfiles'] = True
580 580
581 if srcpeer.capable(b'lfs-serve'):
582 # Repository creation honors the config if it disabled the extension, so
583 # we can't just announce that lfs will be enabled. This check avoids
584 # saying that lfs will be enabled, and then saying it's an unknown
585 # feature. The lfs creation option is set in either case so that a
586 # requirement is added. If the extension is explicitly disabled but the
587 # requirement is set, the clone aborts early, before transferring any
588 # data.
589 createopts['lfs'] = True
590
591 if extensions.disabledext('lfs'):
592 ui.status(_('(remote is using large file support (lfs), but it is '
593 'explicitly disabled in the local configuration)\n'))
594 else:
595 ui.status(_('(remote is using large file support (lfs); lfs will '
596 'be enabled for this repository)\n'))
597
581 598 shareopts = shareopts or {}
582 599 sharepool = shareopts.get('pool')
583 600 sharenamemode = shareopts.get('mode')
@@ -2895,6 +2895,9 b' def newreporequirements(ui, createopts):'
2895 2895 if createopts.get('narrowfiles'):
2896 2896 requirements.add(repository.NARROW_REQUIREMENT)
2897 2897
2898 if createopts.get('lfs'):
2899 requirements.add('lfs')
2900
2898 2901 return requirements
2899 2902
2900 2903 def filterknowncreateopts(ui, createopts):
@@ -2913,6 +2916,7 b' def filterknowncreateopts(ui, createopts'
2913 2916 """
2914 2917 known = {
2915 2918 'backend',
2919 'lfs',
2916 2920 'narrowfiles',
2917 2921 'sharedrepo',
2918 2922 'sharedrelative',
@@ -2931,6 +2935,9 b' def createrepository(ui, path, createopt'
2931 2935
2932 2936 backend
2933 2937 The storage backend to use.
2938 lfs
2939 Repository will be created with ``lfs`` requirement. The lfs extension
2940 will automatically be loaded when the repository is accessed.
2934 2941 narrowfiles
2935 2942 Set up repository to support narrow file storage.
2936 2943 sharedrepo
@@ -42,6 +42,7 b' default cache, so it attempts to downloa'
42 42 Downloads fail...
43 43
44 44 $ hg clone http://localhost:$HGPORT httpclone
45 (remote is using large file support (lfs); lfs will be enabled for this repository)
45 46 requesting all changes
46 47 adding changesets
47 48 adding manifests
@@ -76,6 +77,7 b' Blob URIs are correct when --prefix is u'
76 77 $ hg clone --debug http://localhost:$HGPORT/subdir/mount/point cloned2
77 78 using http://localhost:$HGPORT/subdir/mount/point
78 79 sending capabilities command
80 (remote is using large file support (lfs); lfs will be enabled for this repository)
79 81 query 1; heads
80 82 sending batch command
81 83 requesting all changes
@@ -88,7 +90,6 b' Blob URIs are correct when --prefix is u'
88 90 adding file changes
89 91 adding lfs.bin revisions
90 92 added 1 changesets with 1 changes to 1 files
91 calling hook pretxnchangegroup.lfs: hgext.lfs.checkrequireslfs
92 93 bundle2-input-part: total payload size 648
93 94 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
94 95 bundle2-input-part: "phase-heads" supported
@@ -239,6 +240,7 b" though the client doesn't send the blob."
239 240 Test an I/O error in localstore.verify() (Batch API) with GET
240 241
241 242 $ hg clone http://localhost:$HGPORT1 httpclone2
243 (remote is using large file support (lfs); lfs will be enabled for this repository)
242 244 requesting all changes
243 245 adding changesets
244 246 adding manifests
@@ -304,10 +304,10 b' lfs content, and the extension enabled.'
304 304 $ grep 'lfs' .hg/requires $SERVER_REQUIRES
305 305 $TESTTMP/server/.hg/requires:lfs
306 306
307 TODO: fail more gracefully.
308
309 $ hg clone -q http://localhost:$HGPORT $TESTTMP/client4_clone
310 abort: HTTP Error 500: Internal Server Error
307 $ hg clone http://localhost:$HGPORT $TESTTMP/client4_clone
308 (remote is using large file support (lfs), but it is explicitly disabled in the local configuration)
309 abort: repository requires features unknown to this Mercurial: lfs!
310 (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
311 311 [255]
312 312 $ grep 'lfs' $TESTTMP/client4_clone/.hg/requires $SERVER_REQUIRES
313 313 grep: $TESTTMP/client4_clone/.hg/requires: $ENOENT$
@@ -661,8 +661,6 b' Only the files required by diff are pref'
661 661 $ cat $TESTTMP/errors.log | grep '^[A-Z]'
662 662 Traceback (most recent call last):
663 663 ValueError: no common changegroup version
664 Traceback (most recent call last):
665 ValueError: no common changegroup version
666 664 #else
667 665 $ cat $TESTTMP/errors.log
668 666 #endif
General Comments 0
You need to be logged in to leave comments. Login now