tag:blogger.com,1999:blog-48859087977437856242024-03-13T16:34:01.437+01:00Andreas WuestRandom notes.Andreas Wuesthttp://www.blogger.com/profile/16256007013977869726noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-4885908797743785624.post-13498828905056896132009-11-15T19:16:00.013+01:002009-11-16T01:18:29.780+01:00What to do when your Mercurial working directory got corrupted?<p>While performing a <span style="font-family:courier new;">hg qrefresh</span> today, I aborted the execution of the command because I added a wrong parameter. This resulted in a rather unfortunate situation:</p>
<blockquote style="font-family: courier new;">$ hg status<br/>
mq status file refers to unknown node 30284bbd679b<br/>
mq status file refers to unknown node 30284bbd679b<br/>
abort: unknown revision '30284bbd679b7214334ec9a5eadbcb40d399f22f'!</blockquote>
<p>Nothing would help, rolling back the aborted operation was not possible. After a bit of searching, I found <a href="http://mercurial.selenic.com/wiki/RepositoryCorruption">Dealing With Repository And Dirstate Corruption</a>. Apparently, my working directory suffered from dirstate corruption. According to <a href="http://www.selenic.com/pipermail/mercurial/2008-October/022069.html">http://www.selenic.com/pipermail/mercurial/2008-October/022069.html</a>, which deals with the fact that MQ was involved as well, the fix is simple:</p>
<blockquote style="font-family: courier new;">$ > .hg/patches/status<br/>
$ hg debugrebuildstate -r tip</blockquote>
<p>This only takes a few seconds. Executing <span style="font-family:courier new;">hg status</span> after that took quite a while -- more than an hour in fact (it was the mozilla-central repo after all) -- but then my working directory state was recovered to the tip, and all operations on it could be performed again.</p>
<p>This does not actually change the tree, the changes applied to the code before were still present, so I didn't lose any work. Emptying <span style="font-family:courier new;">.hg/patches/status</span> also doesn't destroy your patch queue, it only makes MQ forget about which patches are currently applied.</p>
<p>Rebuilding the dirstate makes Mercurial forget about which files were added to the working directory though, so you have to <span style="font-family:courier new;">hg add</span> any files that you created yourself.</p>
<p>You are in a bit of trouble with MQ now unfortunately, because now you have changes in your working directory that are also partially covered by the patch (or patches) in your patch queue. You can't simply <span style="font-family:courier new;">hg qrefresh</span>, because MQ thinks there are no patches applied (remember, <span style="font-family:courier new;">.hg/patches/status</span> was cleaned).</p>
<p>Probably the easiest way forward is to save away the current state using <span style="font-family:courier new;">hg diff > ../patches/backup.diff</span>, <span style="font-family:courier new;">hg revert</span> the working directory, <span style="font-family:courier new;">qpush</span> all the patches back into the tree that were applied before the mishap, do an <span style="font-family:courier new;">interdiff</span> (Cygwin patchutils package for the Windows sufferers amongst you) between the backed-up diff and the output of <span style="font-family:courier new;">hg qdiff</span>, and then apply the output of the <span style="font-family:courier new;">interdiff</span> to the working directory.</p>
<p>I didn't go that route because I didn't really care about what was in my patch queue, so I just got rid of it and created a new queue.</p>Andreas Wuesthttp://www.blogger.com/profile/16256007013977869726noreply@blogger.com0tag:blogger.com,1999:blog-4885908797743785624.post-60504683426220724872009-10-31T20:39:00.003+01:002009-10-31T20:49:23.089+01:00Cygwin and uuidgenNote to self: <span style="font-weight:bold;">uuidgen</span> is part of Cygwin's <span style="font-weight:bold;">e2fsprogs</span> package. Oh, and, yes, packages <span style="font-weight: bold;">are</span> <a href="http://cygwin.com/packages/">searchable</a> (but the setup UI as well as their website could use an overhaul...).Andreas Wuesthttp://www.blogger.com/profile/16256007013977869726noreply@blogger.com0tag:blogger.com,1999:blog-4885908797743785624.post-78455224559881200222009-01-18T11:02:00.009+01:002009-01-18T18:22:31.351+01:007 things…I love internet memes as much as the next guy, so here it goes. <a href="http://adblockplus.org/blog/now-it-got-me-as-well">Wladimir</a> tagged me, hoping that I would finally start to blog. So I did.
<h4>The rules:</h4><ol><li>Link to your original tagger(s) and list these rules in your post.</li>
<li>Share seven facts about yourself in the post.</li>
<li>Tag seven people at the end of your post by leaving their names and the links to their blogs.</li>
<li>Let them know they’ve been tagged.</li></ol><h4>The facts:</h4>(In no particular order.) Are those things surprising? I don't know, but how would I know what surprises you anyway.
<ul><li>I actually quite like statically type-checked languages (especially if they use type inference).</li>
<li>I love <a href="http://en.wikipedia.org/wiki/Bridget_Jones%27s_Diary_%28film%29">cheesy</a> <a href="http://en.wikipedia.org/wiki/Music_and_Lyrics">movies</a>, but don't like cheesy music.</li>
<li>After almost two years in the Netherlands, I still can't speak a single sentence of Dutch (except if you count «Dankjewel.» — which means «Thank you.» — as a sentence). Similar problems apply to listening. Nevertheless, I try to infer the meaning of the sentence by comparing with English and German, which can sometimes lead to rather ridiculous situations. A co-worker once asked me if I wanted some “pepernoten”, which I immediately translated to “paper notes”. I figured that he probably wanted to express that it's going to be a longer discussion, and pen and paper would be useful to remember the decisions taken. So I promptly got up, walked back to my desk and fetched my notebook and a pen. Turns out, <a href="http://en.wikipedia.org/wiki/Pepernoten">pepernoten</a> are actually a cookie-like candy, and this co-worker was just offering me some.</li>
<li>I love DIY, but I completely suck at it. Details are withheld.</li>
<li>I hate trailing whitespace, tabs, and inconsistency in general (ok, that should come to no surprise at all I guess…).</li>
<li>To all the people out there who still don't get what XUL is about: no, I have absolutely no experience with web design!</li>
<li>I don't like Swiss mountains. Or any mountain, really. They're too steep.</li></ul><h4>Taggees:</h4>(This meme was not my idea!)
<ul>
<li><a href="http://weblogs.mozillazine.org/weirdal/">Alex Vincent</a>, since we all love your dancing</li>
<li><a href="http://www.squarefree.com/">Jesse Ruderman</a>, because of his deep thoughts about porn</li>
<li><a href="http://ejohn.org/">John Resig</a>, because the last time I met him, I didn't have enough time to talk to him</li>
<li><a href="http://weblogs.mozillazine.org/jst/">Johnny Stenback</a>, because the planet needs more of him</li>
<li><a href="http://hyperstruct.net/">Massimiliano Mirra</a>, to get his blog out of that lethargic state</li>
<li><a href="http://www.sergimansilla.com/blog/">Sergi Mansilla</a>, since this guy is simply interesting</li>
<li><a href="http://viper.haque.net/%7Etimeless/blog/">timeless</a>, because I want to see a “7 things” post followed by a “What could be done?” post</li></ul>Andreas Wuesthttp://www.blogger.com/profile/16256007013977869726noreply@blogger.com0