# HG changeset patch # User Matt Harbison # Date 2014-12-21 20:04:13 # Node ID 9dd5dfeaab4c4f62527675e08d84e2eb334557d7 # Parent f1e6b86da4c0f72cae201e901065f0d99d677fa4 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. diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -156,7 +156,8 @@ def removelargefiles(ui, repo, isaddremo 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) diff --git a/tests/test-largefiles-cache.t b/tests/test-largefiles-cache.t --- a/tests/test-largefiles-cache.t +++ b/tests/test-largefiles-cache.t @@ -134,3 +134,15 @@ Test permission of files created by push $ 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]