mercurial/hg.py
changeset 40324 6637b079ae45
parent 39849 d3d4b4b5f725
child 40331 ac59de55c8b4
--- a/mercurial/hg.py	Tue Oct 16 16:24:46 2018 +0200
+++ b/mercurial/hg.py	Thu Sep 20 17:27:01 2018 -0700
@@ -578,6 +578,23 @@
 
         createopts['narrowfiles'] = True
 
+    if srcpeer.capable(b'lfs-serve'):
+        # Repository creation honors the config if it disabled the extension, so
+        # we can't just announce that lfs will be enabled.  This check avoids
+        # saying that lfs will be enabled, and then saying it's an unknown
+        # feature.  The lfs creation option is set in either case so that a
+        # requirement is added.  If the extension is explicitly disabled but the
+        # requirement is set, the clone aborts early, before transferring any
+        # data.
+        createopts['lfs'] = True
+
+        if extensions.disabledext('lfs'):
+            ui.status(_('(remote is using large file support (lfs), but it is '
+                        'explicitly disabled in the local configuration)\n'))
+        else:
+            ui.status(_('(remote is using large file support (lfs); lfs will '
+                        'be enabled for this repository)\n'))
+
     shareopts = shareopts or {}
     sharepool = shareopts.get('pool')
     sharenamemode = shareopts.get('mode')