icasefs: ignore removed files at building "dirstate._foldmap" up on icasefs

Before this patch, all files in dirstate are used to build "_foldmap"
up on case insensitive filesystem regardless of their statuses.

For example, when dirstate contains both removed file 'a' and added
file 'A', "_foldmap" may be updated finally by removed file 'a'. This
causes unexpected status information for added file 'A' at "hg status"
invocation.

This patch ignores removed files at building "_foldmap" up on case
insensitive filessytem.

This patch doesn't add any test, because this issue is difficult to
reproduce intentionally: it depends on iteration order of "dirstate._map".

--HG--
branch : stable
icasefs: refactor "test-casecollision-merge.t" to reuse in succeeding fixes

This patch refactors "test-casecollision-merge.t" to increase
reusability in succeeding patches.

It is confirmed that changed test also can detect issue3370.

--HG--
branch : stable
icasefs: rewrite case-folding collision detection (issue3452)

Before this patch, case-folding collision detection uses
"copies.pathcopies()" before "manifestmerge()", and is not aware of
renaming in some cases.

For example, in the case of issue3452, "copies.pathcopies()" can't
detect renaming, if the file is renamed at the revision before common
ancestor of merging. So, "hg merge" is aborted unexpectedly on case
insensitive filesystem.

This patch fully rewrites case-folding collision detection, and
relocate it into "manifestmerge()".

New implementation uses list of actions held in "actions" and
"prompts" to build provisional merged manifest up.

Provisional merged manifest should be correct, if actions required to
build merge result up in working directory are listed up in "actions"
and "prompts" correctly.

This patch checks case-folding collision still before prompting for
merge, to avoid aborting after some interactions with users. So, this
assumes that user would choose not "deleted" but "changed".

This patch also changes existing abort message, because sorting before
collision detection changes order of checked files.

--HG--
branch : stable
icasefs: enhance test to prevent regression by changes in the future

This patch adds steps to test case-folding collision detection on the
revision tree built up in the order different from the one reproducing
issue3452.

This may prevent regression by changes around "copy detection" and/or
"case-folding collision detection" logic in the future.

--HG--
branch : stable
match: fix root calculation for combining regexps with simple paths

The fall-back root for walking is the repo root, not no root.

The "roots" do however also end up in m.files() which is used in various ways,
for instance to indicate whether matches are exact. The change could thus have
other impacts.

--HG--
branch : stable