share + rollback: potential confusion
Matt Mackall
mpm at selenic.com
Wed Jan 13 13:05:40 CST 2010
On Wed, 2010-01-13 at 09:26 -0500, Greg Ward wrote:
> A colleague stumbled across a nasty interaction between shared clones
> and rollback yesterday. In a nutshell, you can trivially get one
> clone into the dreaded "abort: working directory has unknown parent"
> state. Here's how to do it:
>
> $ hg init r1
> $ cd r1
> $ touch a
> $ hg commit -A -m init
> $ cd ..
> $ hg share r1 r2
> $ cd r1
> $ hg rollback
> rolling back last transaction
> $ cd ../r2
> $ hg par
> abort: working directory has unknown parent '2cf853de8aa2'!
>
> Once I understood what was happening, it was clear to me... but I
> think this could be very confusing for the average user.
>
> The good news is that the workaround is pretty easy:
>
> $ hg debugsetparents <branchname>
>
> What to do? I could file a bug report on the grounds that I got an
> "abort" doing basic operations without any sneaky tricks. But if this
> is a bug, I cannot think of a way to fix it. After all, r1 has no
> idea that there are shared clones of it out there somewhere, never
> mind what the parent of the working dir is in those shared clones. So
> it's not like we can somehow detect that this rollback is a bad idea.
>
> At the very least, I'm going to add something to the ShareExtension
> wiki page. It's hinted at, but I think this deserves an explicit
> mention.
Seems a big warning in the share help would be even better.
--
http://selenic.com : development and support for Mercurial and Linux
More information about the Mercurial-devel
mailing list