changeset 23782:304e69cb1ee9

largefiles: enable subrepo support for remove Previously, remove failed when operating on a largefile in a subrepo, stating that the file is untracked.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 30 Dec 2014 21:12:52 -0500
parents 49caef455912
children ee1bf2b5a780
files hgext/largefiles/overrides.py hgext/largefiles/uisetup.py tests/test-largefiles-misc.t
diffstat 3 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Thu Jan 08 21:36:12 2015 -0800
+++ b/hgext/largefiles/overrides.py	Tue Dec 30 21:12:52 2014 -0500
@@ -260,12 +260,11 @@
 
     return (result == 1 or bad) and 1 or 0
 
-def overrideremove(orig, ui, repo, *pats, **opts):
-    installnormalfilesmatchfn(repo[None].manifest())
-    result = orig(ui, repo, *pats, **opts)
-    restorematchfn()
-    matcher = scmutil.match(repo[None], pats, opts)
-    return removelargefiles(ui, repo, False, matcher, **opts) or result
+def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, subrepos):
+    normalmatcher = composenormalfilematcher(matcher, repo[None].manifest())
+    result = orig(ui, repo, normalmatcher, prefix, after, force, subrepos)
+    return removelargefiles(ui, repo, False, matcher, after=after,
+                            force=force) or result
 
 def overridestatusfn(orig, repo, rev2, **opts):
     try:
--- a/hgext/largefiles/uisetup.py	Thu Jan 08 21:36:12 2015 -0800
+++ b/hgext/largefiles/uisetup.py	Tue Dec 30 21:12:52 2014 -0500
@@ -33,8 +33,7 @@
     # and in the process of handling commit -A (issue3542)
     entry = extensions.wrapfunction(scmutil, 'addremove',
                                     overrides.scmutiladdremove)
-    entry = extensions.wrapcommand(commands.table, 'remove',
-                                   overrides.overrideremove)
+    extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
     entry = extensions.wrapcommand(commands.table, 'forget',
                                    overrides.overrideforget)
 
--- a/tests/test-largefiles-misc.t	Thu Jan 08 21:36:12 2015 -0800
+++ b/tests/test-largefiles-misc.t	Tue Dec 30 21:12:52 2014 -0500
@@ -362,6 +362,9 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status -S
 
+  $ hg rm -v subrepo/large.txt
+  removing subrepo/large.txt (glob)
+  $ hg revert -R subrepo subrepo/large.txt
   $ rm subrepo/large.txt
   $ hg addremove -S
   removing subrepo/large.txt