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

login
register
mail settings
Submitter phabricator
Date Sept. 24, 2018, 4:13 p.m.
Message ID <differential-rev-PHID-DREV-z24i7o7j3dwd7uewi7uk-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/34989/
State New
Headers show

Comments

phabricator - Sept. 24, 2018, 4:13 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4716

AFFECTED FILES
  hgext/lfs/__init__.py
  hgext/lfs/wrapper.py
  tests/test-lfs.t

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -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
 
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -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."""
diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -137,7 +137,6 @@ 
     extensions,
     filelog,
     filesetlang,
-    hg,
     localrepo,
     minifileset,
     node,
@@ -344,9 +343,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