Help. I've screwed up my repo again, and I have no idea how.

Brendan Cully brendan at kublai.com
Thu Nov 2 01:18:14 CST 2006


On 1-Nov-06, at 10:04 PM, Rob Landley wrote:

> On Wednesday 01 November 2006 11:43 pm, Brendan Cully wrote:
>> I really don't know how you got your repository into the state it was
>> in (revisions 10 and 11 are not just branches, they are completely
>> unrelated to the rest of your repo),
>
> The frightening part is this isn't the first time I've done that.  The
> previous times, I just backed up to a saved tarball of the entire  
> directory.
>
>> but there is a simpler way to
>> fix it:
>>
>> hg clone toybox tmp
>> cd tmp
>> hg merge
>> hg commit -m'merge'
>
> I understand up to that point.  I suspect that right here there's a
> missing "cd ../toybox"?  Otherwise the ../tmp when we're in tmp is  
> black
> magic...

you're right, I forgot a cd ../toybox.

>> hg pull ../tmp
>> cp ../tmp/.hg/dirstate .hg
>> rm -r ../tmp
>>
>> copying the dirstate is a little grody, but should work.
>
> What's in dirstate, anyway?

Pointers to the parents (revision you've checked out, plus a merge  
revision if you're doing one), and a stat cache for quickly computing  
status. hg debugsetparents tip; hg debugrebuildstate would have  
accomplished the same thing.

> One thing I've noticed in another repository I have lying around
> is .hg/dirstate is owned by root (none of the other files are).   
> Apparently I
> did some hg thing while logged in as root, without noticing.  This  
> means that
> on the next update as my normal user, it can't write to that file,  
> but maybe
> it doesn't notice that it can't?
>
> Did I mention I have a knack for breaking stuff?

That does sound like a likely culprit.



More information about the Mercurial mailing list