# HG changeset patch # User Matt Harbison # Date 2016-01-24 01:51:17 # Node ID eb1135d5e688f8540fb98a32759317a7eed31985 # Parent 75fa75d314950be8f96f3476253e0f10c4b3a944 largefiles: fix an explicit largefile commit after a remove (issue4969) The change in b68797f244e4 to handle a normal -> largefile switch was too aggressive in preserving the original matcher names. If a largefile is explicitly provided by the user, but only the standin exists in dirstate, then only the standin can be committed. There's still maybe an issue when the largefile is deleted outside of Mercurial: $ rm large $ hg ci -m "oops" large large: The system cannot find the file specified nothing changed [1] diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -575,11 +575,15 @@ def updatestandinsbymatch(repo, match): fstandin = standin(f) # For largefiles, only one of the normal and standin should be - # committed (except if one of them is a remove). + # committed (except if one of them is a remove). In the case of a + # standin removal, drop the normal file if it is unknown to dirstate. # Thus, skip plain largefile names but keep the standin. - if (f in lfiles or fstandin in standins) and \ - repo.dirstate[f] != 'r' and repo.dirstate[fstandin] != 'r': - continue + if f in lfiles or fstandin in standins: + if repo.dirstate[fstandin] != 'r': + if repo.dirstate[f] != 'r': + continue + elif repo.dirstate[f] == '?': + continue actualfiles.append(f) match._files = actualfiles 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 @@ -17,7 +17,7 @@ Create source repo, and commit adding la $ hg add --large large $ hg commit -m 'add largefile' $ hg rm large - $ hg commit -m 'branchhead without largefile' + $ hg commit -m 'branchhead without largefile' large $ hg up -qr 0 $ cd ..