Mercurial > hg
changeset 35214:a8c778b2a689
lfs: enable the extension locally after sharing a repo with 'lfs' requirement
This is consistent with clone in the previous commit.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 16 Nov 2017 21:01:21 -0500 |
parents | 24aa4853c031 |
children | 8887a45e3384 |
files | hgext/lfs/__init__.py hgext/lfs/wrapper.py tests/test-lfs.t |
diffstat | 3 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/lfs/__init__.py Thu Nov 16 20:23:20 2017 -0500 +++ b/hgext/lfs/__init__.py Thu Nov 16 21:01:21 2017 -0500 @@ -153,6 +153,7 @@ ) wrapfunction(hg, 'clone', wrapper.hgclone) + wrapfunction(hg, 'postshare', wrapper.hgpostshare) # Make bundle choose changegroup3 instead of changegroup2. This affects # "hg bundle" command. Note: it does not cover all bundle formats like
--- a/hgext/lfs/wrapper.py Thu Nov 16 20:23:20 2017 -0500 +++ b/hgext/lfs/wrapper.py Thu Nov 16 21:01:21 2017 -0500 @@ -221,6 +221,14 @@ return result +def hgpostshare(orig, sourcerepo, destrepo, bookmarks=True, defaultpath=None): + orig(sourcerepo, destrepo, bookmarks, defaultpath) + + # If lfs is required for this repo, permanently enable it locally + if 'lfs' in destrepo.requirements: + with destrepo.vfs('hgrc', 'a', text=True) as fp: + fp.write('\n[extensions]\nlfs=\n') + def _canskipupload(repo): # if remotestore is a null store, upload is a no-op and can be skipped return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote)
--- a/tests/test-lfs.t Thu Nov 16 20:23:20 2017 -0500 +++ b/tests/test-lfs.t Thu Nov 16 21:01:21 2017 -0500 @@ -208,6 +208,12 @@ $ cd .. + $ hg --config extensions.share= share repo7 sharedrepo + updating working directory + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg -R sharedrepo config extensions --debug | grep lfs + $TESTTMP/sharedrepo/.hg/hgrc:*: extensions.lfs= (glob) + # Test rename and status $ hg init repo8