Confused repository.

Matt Mackall mpm at selenic.com
Tue Dec 2 19:01:03 UTC 2014


On Tue, 2014-12-02 at 03:02 -0600, Rob Landley wrote:
> I accidentally commited a change on top of another change I thought I'd
> rolled back, and since rollback won't go more than one back that means
> my working repository is toast, so I replaced the .hg subdirectory with
> the one from the website

First, please erase "rollback" thoroughly from your vocabulary. It is
heavily deprecated because people aren't sufficiently cautious when
using it.

Second, there are numerous safer methods to remove a commit. 
For instance 'hg clone -r <lastgoodrev>' or 'hg strip'. You may also be
interested in 'hg commit --amend'.

>  (copying the hgrc file out of it first) and now
> the repository thinks the "current" version is an old commit from July,
> even though the .hg directory I cloned from has the newer commits up to
> yesterday.

Typically remote repositories have 'null' checked out to have an empty
working copy. Push doesn't touch the remote working copy, much like pull
doesn't touch the local one.

The state of what's checked out is stored in the .hg/dirstate file.

> Where is it getting this information from?
> 
> $ strace hg identify 2>&1 | grep '^open(' | wc -l
>     621
> 
> Is there any way to do a checkout without changing files in the current
> directory?

hg debugsetparents <rev>
hg debugrebuilddirstate

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list