largefiles: drop the override for 'fetch'
authorMatt Harbison <matt_harbison@yahoo.com>
Sun, 30 Nov 2014 23:30:31 -0500
changeset 23441 d289ba74dba3
parent 23439 743736fc7c41
child 23442 a5c94ea3b8af
largefiles: drop the override for 'fetch' The fetch extension has been calling cmdutil.bailifchanged() since a014fdc97154, so this is redundant. Add test coverage to prevent regression. It doesn't look like there is any testing for fetch with largefiles.
hgext/largefiles/overrides.py
hgext/largefiles/uisetup.py
tests/test-largefiles-misc.t
--- a/hgext/largefiles/overrides.py	Fri Nov 21 15:50:38 2014 -0800
+++ b/hgext/largefiles/overrides.py	Sun Nov 30 23:30:31 2014 -0500
@@ -946,7 +946,7 @@
 # If a largefile is modified, the change is not reflected in its
 # standin until a commit. cmdutil.bailifchanged() raises an exception
 # if the repo has uncommitted changes. Wrap it to also check if
-# largefiles were changed. This is used by bisect and backout.
+# largefiles were changed. This is used by bisect, backout and fetch.
 def overridebailifchanged(orig, repo):
     orig(repo)
     repo.lfstatus = True
@@ -955,15 +955,6 @@
     if s.modified or s.added or s.removed or s.deleted:
         raise util.Abort(_('uncommitted changes'))
 
-# Fetch doesn't use cmdutil.bailifchanged so override it to add the check
-def overridefetch(orig, ui, repo, *pats, **opts):
-    repo.lfstatus = True
-    s = repo.status()
-    repo.lfstatus = False
-    if s.modified or s.added or s.removed or s.deleted:
-        raise util.Abort(_('uncommitted changes'))
-    return orig(ui, repo, *pats, **opts)
-
 def overrideforget(orig, ui, repo, *pats, **opts):
     installnormalfilesmatchfn(repo[None].manifest())
     result = orig(ui, repo, *pats, **opts)
--- a/hgext/largefiles/uisetup.py	Fri Nov 21 15:50:38 2014 -0800
+++ b/hgext/largefiles/uisetup.py	Sun Nov 30 23:30:31 2014 -0500
@@ -160,9 +160,6 @@
 
     # override some extensions' stuff as well
     for name, module in extensions.extensions():
-        if name == 'fetch':
-            extensions.wrapcommand(getattr(module, 'cmdtable'), 'fetch',
-                overrides.overridefetch)
         if name == 'purge':
             extensions.wrapcommand(getattr(module, 'cmdtable'), 'purge',
                 overrides.overridepurge)
--- a/tests/test-largefiles-misc.t	Fri Nov 21 15:50:38 2014 -0800
+++ b/tests/test-largefiles-misc.t	Sun Nov 30 23:30:31 2014 -0500
@@ -67,6 +67,11 @@
   dirc/baz/largefile
   dirc/dirb
   dirc/dirb/largefile
+
+  $ hg clone -q . ../fetch
+  $ hg --config extensions.fetch= fetch ../fetch
+  abort: uncommitted changes
+  [255]
   $ hg up -qC
   $ cd ..