Mercurial wipes repository history!?

Matt Mackall mpm at selenic.com
Thu Apr 8 10:47:21 CDT 2010


On Thu, 2010-04-08 at 15:54 +0100, Jon Ribbens wrote:
> On Thu, Apr 08, 2010 at 04:45:39PM +0200, Benoit Boissinot wrote:
> > A transaction is an operation modifying the history. As far as I can
> > tell from your command log, the last transaction *is* the clone
> > operation.
> 
> It is in that log, yes. It was not in the scenario we were trying to
> replicate. It is also not at all clear to me that "clone" should be
> a roll-backable operation (it is evidently not clear to the hg authors
> either, since a local clone is not roll-backable and a remote clone
> is.)

One uses the internal transaction mechanism (one big pull), and one
doesn't (directory tree copy). It's that simple.

> > > Surely it would be much better to make the remote behaviour fail too?
> > > Suddenly vaporising the entire repository without warning is hardly
> > > good behaviour to be more widely introduced!
> > 
> > from hg help rollback:
> > 
> >  This command should be used with care. There is only one level of
> > rollback, and there is no way to undo a rollback.
> 
> Sorry, is that supposed to have some relevance to the text quoted
> above it?

Apparently he thinks you didn't "use with care".

It's pretty much impossible for rollback to do anything but delete the
most recent transaction, because each transaction overwrites the log of
the previous one. So until you have evidence to the contrary, we're
going to assume that hasn't actually happened, as it's much more likely
that you were confused than that the transaction log got resurrected
(even on Easter).

To lose file data with rollback, you have to have first destroyed it
somewhere else, because transactions all involve copying. For instance:

hg clone --pull a b
rm -rf a
hg rollback -R b

hg commit a  # copy a into history
rm a
hg rollback

..which is why the documentation says "use with care". Apparently, we
need to make that more prominent somehow.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial mailing list