[sparse] make sure "hg update --clean" correctly forgets about excluded files

Summary:
A user ran into a bug where a failed rebase left their repository in a state
where "hg status" reported many excluded files had been removed.

They weren't able to recover from this state, even using "hg update --clean ."
This was because the sparse extension was ignoring the actions to forget these
files from the dirstate.  The sparse extension should allow excluded files to
be forgotten.

Test Plan:
I tried writing a test case for this but wasn't able to figure out how to
trigger exactly the situation that the user's repository was in.  (It looks
like there were other bugs in "hg rebase --abort" that led to their repository
state.)

I was able to cause some other problems with files in the "g" type
("remote created") that "hg update --clean" wouldn't fix.  I haven't added
those test cases for now though, since that problem isnt' fixed by this diff.
It does seem like there are potentially other problems here that still need to
be addressed.

Reviewers: quark, rmcelroy, mjpieters, durham

Reviewed By: durham

Subscribers: net-systems-diffs@, yogeshwer, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D3966580

Tasks: 13694820

Signature: t1:3966580:1475676328:48433e203ae702a50b40176e52f1ed90a5c45504
This commit is contained in:
Adam Simpkins 2016-10-13 11:49:58 -07:00
parent 27acd63250
commit 7f1c4eb449

View File

@ -106,6 +106,8 @@ def _setupupdates(ui):
if type != 'k': if type != 'k':
temporaryfiles.append(file) temporaryfiles.append(file)
prunedactions[file] = action prunedactions[file] = action
elif type == 'f':
prunedactions[file] = action
elif file in wctx: elif file in wctx:
prunedactions[file] = ('r', args, msg) prunedactions[file] = ('r', args, msg)