Skip to content
Snippets Groups Projects
Commit bcf72d7b authored by Gregory Szorc's avatar Gregory Szorc
Browse files

lfs: don't add extension to hgrc after clone or share (BC)

Now that repository loading in core supports automatically loading
the lfs extension when the "lfs" requirement is present, we no
longer need to update the .hg/hgrc of newly-created repos to load
the lfs extension!

I'm marking this as BC because it is a change in behavior. But users
should not notice unless they create an LFS repo with new Mercurial
and then attempt to use it with an old versions that doesn't support
automatic extension loading.

Differential Revision: https://phab.mercurial-scm.org/D4712
parent 2c2fadbc
No related branches found
No related tags found
No related merge requests found
......@@ -344,9 +344,6 @@
),
)
wrapfunction(hg, 'clone', wrapper.hgclone)
wrapfunction(hg, 'postshare', wrapper.hgpostshare)
scmutil.fileprefetchhooks.add('lfs', wrapper._prefetchfiles)
# Make bundle choose changegroup3 instead of changegroup2. This affects
......
......@@ -228,32 +228,6 @@
if util.safehasattr(othervfs, name):
setattr(self, name, getattr(othervfs, name))
def hgclone(orig, ui, opts, *args, **kwargs):
result = orig(ui, opts, *args, **kwargs)
if result is not None:
sourcerepo, destrepo = result
repo = destrepo.local()
# When cloning to a remote repo (like through SSH), no repo is available
# from the peer. Therefore the hgrc can't be updated.
if not repo:
return result
# If lfs is required for this repo, permanently enable it locally
if 'lfs' in repo.requirements:
repo.vfs.append('hgrc',
util.tonativeeol('\n[extensions]\nlfs=\n'))
return result
def hgpostshare(orig, sourcerepo, destrepo, defaultpath=None):
orig(sourcerepo, destrepo, defaultpath=defaultpath)
# If lfs is required for this repo, permanently enable it locally
if 'lfs' in destrepo.requirements:
destrepo.vfs.append('hgrc', util.tonativeeol('\n[extensions]\nlfs=\n'))
def _prefetchfiles(repo, revs, match):
"""Ensure that required LFS blobs are present, fetching them as a group if
needed."""
......
......@@ -295,8 +295,6 @@
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd repo7
$ hg config extensions --debug | grep lfs
$TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob)
$ cat large
LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES
$ cat small
......@@ -307,8 +305,8 @@
$ 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)
$ grep lfs sharedrepo/.hg/requires
lfs
# Test rename and status
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment