Confused repository.
Ben Schmidt
mail_ben_schmidt at yahoo.com.au
Tue Dec 2 20:20:24 UTC 2014
On 2/12/14 8:02 PM, 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 (copying the hgrc file out of it first) and now
There are MUCH better ways to get yourself out of a situation such as an
accidental commit. Don't treat Mercurial like CVS where you have to hack
and move files around to edit history. Mercurial has relatively safe
ways to do these things (histedit, strip, mq, ...) carefully engineered
so it's hard to shoot yourself in the foot (and sorry, mate, but really,
you just did). You definitely want to invest some time into learning
these commands/extensions.
> 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. Where is it getting this information from?
Funnily enough, I believe it's getting it from inside the .hg directory
that you copied. Although that repository may have newer commits in it,
what was its working directory parent when you copied that data?
> Is there any way to do a checkout without changing files in the current
> directory?
You can use hg debugsetparents, which might be the easy way out in this
case.
Unless you happened to keep your old .hg folder before replacing it. If
so, I would recommend putting that back, backing out the erroneous
commit, and then using histedit to fold the three commits into one (the
bad one, the one you want, and the one backing out the bad one). Or if
the changes are nicely independent, you could just use histedit to drop
the erroneous commit (without bothering to back it out).
Ben.
More information about the Mercurial
mailing list