changeset 23618:9dd5dfeaab4c stable

largefiles: fix a spurious missing file warning with 'remove -A' (issue4053) The bug report doesn't mention largefiles, but the given recipe doesn't fail unless the largefiles extension is loaded. The problem only affected normal files, whether or not any largefiles are committed, and only files that have not been committed yet. (Files with an 'a' state are dropped from dirstate, not marked removed.) Further, if the named normal file never existed, the warning would be printed out twice. The problem is that the core implementation of remove() calls repo.status(), which eventually triggers a dirstate.walk(). When the file isn't seen in the filesystem during the walk, the exception handling finds the file in dirstate, so it doesn't complain. However, the largefiles implementation called status() again with all of the original files (including the normal ones, just dropped). This time, the exception handler doesn't find the file in dirstate and does complain. This simply excludes the normal files from the second repo.status() call, which the largefiles extension has no interest is processing anyway.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 21 Dec 2014 15:04:13 -0500
parents f1e6b86da4c0
children 70afc58c32d3
files hgext/largefiles/overrides.py tests/test-largefiles-cache.t
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py	Sun Dec 21 14:42:46 2014 -0500
+++ b/hgext/largefiles/overrides.py	Sun Dec 21 15:04:13 2014 -0500
@@ -156,7 +156,8 @@
     after = opts.get('after')
     if not pats and not after:
         raise util.Abort(_('no files specified'))
-    m = scmutil.match(repo[None], pats, opts)
+    m = composelargefilematcher(scmutil.match(repo[None], pats, opts),
+                                repo[None].manifest())
     try:
         repo.lfstatus = True
         s = repo.status(match=m, clean=True)
--- a/tests/test-largefiles-cache.t	Sun Dec 21 14:42:46 2014 -0500
+++ b/tests/test-largefiles-cache.t	Sun Dec 21 15:04:13 2014 -0500
@@ -134,3 +134,15 @@
   $ cd ..
 
 #endif
+
+Test issue 4053 (remove --after on a deleted, uncommitted file shouldn't say
+it is missing, but a remove on a nonexistant unknown file still should)
+
+  $ cd src
+  $ touch x
+  $ hg add x
+  $ mv x y
+  $ hg remove -A x y ENOENT
+  ENOENT: * (glob)
+  not removing y: file is untracked
+  [1]