#pragma section-numbers 2 = Manual Checkout = Emulating a checkout to repair various issues <> == Why would I want to manually checkout a revision? == Sometimes it may be necessary to bypass Mercurial's consistency checks to fix certain problems: * fixing case collisions on Windows * changing non-portable file names (eg 'con' or 'aux' on Windows) * subrepository revisions that are no longer available * recovering data from damaged repositories == Performing a manual checkout == If you are cloning a repository, first start by using the -U flag to avoid the initial checkout: {{{ $ hg clone -U http://myproject/ }}} Next, use the `revert` command to retrieve all the files from a given revision. Use one or more -X options to exclude problem files. {{{ $ hg revert -a -r -X badfile -X baddir }}} Next, manually set the parent of the working copy: {{{ $ hg debugrebuildstate -r }}} Now Mercurial should be in a state where the target revisions is checked out except the problem files. Double-check against summary and status: {{{ $ hg summary parent: 15782:cde35835b333 blah blah blah branch: default commit: 7 missing (clean) update: (current) $ hg status ! badfile ! baddir/a ! baddir/A }}} Now you can manually repair or recreate those files, possibly with `hg revert -r badfile`. When your working directory is in a consistent state, you can commit. ---- CategoryHowTo