diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -903,6 +903,14 @@ def hgclone(orig, ui, opts, *args, **kwa return result +def hgpostshare(orig, sourcerepo, destrepo, bookmarks=True, defaultpath=None): + orig(sourcerepo, destrepo, bookmarks, defaultpath) + + # If largefiles is required for this repo, permanently enable it locally + if 'largefiles' in destrepo.requirements: + with destrepo.vfs('hgrc', 'a+', text=True) as fp: + fp.write('\n[extensions]\nlargefiles=\n') + def overriderebase(orig, ui, repo, **opts): if not util.safehasattr(repo, '_largefilesenabled'): return orig(ui, repo, **opts) diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py --- a/hgext/largefiles/uisetup.py +++ b/hgext/largefiles/uisetup.py @@ -120,6 +120,7 @@ def uisetup(ui): _('download all versions of all largefiles'))] entry[1].extend(cloneopt) entry = extensions.wrapfunction(hg, 'clone', overrides.hgclone) + entry = extensions.wrapfunction(hg, 'postshare', overrides.hgpostshare) entry = extensions.wrapcommand(commands.table, 'cat', overrides.overridecat) diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t --- a/tests/test-largefiles-misc.t +++ b/tests/test-largefiles-misc.t @@ -212,6 +212,18 @@ verify that largefiles doesn't break fil date: Thu Jan 01 00:00:00 1970 +0000 summary: add files +sharing a largefile repo automatically enables largefiles on the share + + $ hg share --config extensions.share= . ../shared_lfrepo + updating working directory + getting changed largefiles + 1 largefiles updated, 0 removed + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cat ../shared_lfrepo/.hg/hgrc + + [extensions] + largefiles= + verify that large files in subrepos handled properly $ hg init subrepo $ echo "subrepo = subrepo" > .hgsub diff --git a/tests/test-share.t b/tests/test-share.t --- a/tests/test-share.t +++ b/tests/test-share.t @@ -240,6 +240,14 @@ test that commits work bm3 4:62f4ded848e4 $ cd .. +non largefiles repos won't enable largefiles + + $ hg share --config extensions.largefiles= repo3 sharedrepo + updating working directory + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ [ -f sharedrepo/.hg/hgrc ] + [1] + test pushing bookmarks works $ hg clone repo3 repo4