If you have modified Working Directory ("modified" by any way) you can easy discard changes and return to the state of clean "."-changeset using
hg up -C -r .
And yes, follow-up to @torek, hg purge
must not touch tracked files, because, according to its wiki
extension purges all files and directories not being tracked by
Mercurial in the current repository
but I can see one possible case, why its may happen. Next para in description sheds some light on topic:
With the --all option, it will also remove ignored files
(and some pure speculation below...)
If you had files in .hgignore
and added these files into repository by hand (you can hg add
ignored files), purge probably may delete these files.
You can (rather easy) verify my idea after returning to good state of repo
- Install|add hg-isignored extension (Bitbucket, will disapper soon due to BB-refugee from HG) and check ignorance state of versioned, but deleted by extension files (at least some of) - you'll see result and used pattern from
.hgignore
- Try (again)
hg purge --print
in order to get list of purged files. If lists (deleted and ignored versoned files) will have intersections, then you'll get answer on question "Why?"
I can't see any other reasons for such behavior of the extension.