gitKiBi’s bloghttp://mraw.org/blog/tags/git/KiBi’s blogikiwiki2013-12-17T02:11:29ZGit tip of the day: insteadOfhttp://mraw.org/blog/2011/05/24/Git_tip_of_the_day_insteadOf/2013-12-17T02:11:29Z2011-05-24T10:00:00Z
<p>The recent <a href="http://alioth.debian.org/">Alioth</a> migration (thanks,
Alioth folks!) led to slight variations in the URL schemes for various
VCS. I guess some migration path will be considered but in the
meanwhile that seemed to be a good example for the nice
<a href="http://www.kernel.org/pub/software/scm/git/docs/git-config.html">git-config</a>
<code>insteadOf</code> trick.</p>
<p>Here’s the bottom of <code>~/.gitconfig</code>:</p>
<pre><code>[url "git://anonscm.debian.org"]
insteadOf = "git://git.debian.org"
[url "ssh://git.debian.org"]
pushInsteadOf = "git://git.debian.org"
</code></pre>
<p>And tada! <code>debcheckout</code> picks the appropriate service (<code>anonscm</code> for
anonymous access), and one is still able to push (through <code>ssh</code>)
without having to change the URL in each and every <code>.git/config</code> file
(which would also lead to higher CPU usage when updating afterwards).</p>
ikiwiki dateshttp://mraw.org/blog/2009/07/02/ikiwiki_dates/2013-12-17T02:11:28Z2009-07-01T23:00:00Z
<p>Some time ago, the box on which my blog is hosted went dramatically
down, and I had to restore the blog by populating the git repository
again, from my local copy.</p>
<p>Unfortunately, that means that the wiki had to be rebuilt from
scratch, and all creation dates were messed up, leading some
planet-like sites to show all of my posts again.</p>
<p>To ensure that this won’t happen again (even if I switch branches in
the git repositories, move some files around, trash the ikiwiki cache,
etc.), it looks like <a href="http://ikiwiki.info/bugs/inline_sort_order_and_meta_date_value/">using meta dates is the way to
go</a>,
for example:</p>
<pre><code> [[meta date="2009-07-02"]]
</code></pre>
<p>(One can use <code>2009-07-02 00:00:00</code> and <code>2009-07-02 01:00:00</code> to sort
several entries on the same day, too.)</p>
<p>This way, all pages are rendered identically on every system.</p>
<p>To help maintaining those extra dates (kind of a burden, to be
honest), I’ve written a <a href="http://mraw.org/blog/2009/07/02/ikiwiki-dates.pl">tiny Perl script to automate
it</a>, and specified an alias in
<code>.git/config</code> for that repository:</p>
<pre><code> [alias]
ikiwiki-check = "!blog/2009/07/02/ikiwiki-dates.pl"
</code></pre>
<p>Inline replacement (in case of conflicts: same date without time, or
with same time) or additions are then performed, and <code>git status</code> will
show what needs tweaking.</p>
<p>More work that I initially imagined, but robustness should
follow.</p>
Can I has a wokking copy?http://mraw.org/blog/2007/10/11/Can_I_has_a_wokking_copy/2013-12-17T02:11:28Z2007-10-10T22:00:00Z
<p><img src="http://mraw.org/blog/2007/10/11/wokking-copy.png" alt="wokking-copy.png" /></p>
<p>Getting back to a working copy of <a href="http://webkit.org/">WebKit</a>:</p>
<pre><code>$ svn up
svn: REPORT request failed on '/repository/webkit/!svn/vcc/default'
svn: REPORT of '/repository/webkit/!svn/vcc/default':…
…413 Request Entity Too Large (http://svn.webkit.org)
</code></pre>
<p>Combine svn and
<a href="http://webkit.org/building/checkout.html">http transport</a>…
And the approximate size of a working copy is around 800MB…</p>
<p>Oh. Now. <a href="http://git.debian.org/">http://git.debian.org/</a> has
<a href="http://git.debian.org/?p=pkg-webkit/upstream.git">pkg-webkit/upstream.git</a>
and
<a href="http://git.debian.org/?p=pkg-webkit/webkit.git">pkg-webkit/webkit.git</a>
(Debian packaging).</p>
<p>Considering the first one, the history from June 2007 until takes
120MB (<code>du -sh .git</code>). There are two branches: <code>filtered</code> (180MB,
<code>.git</code> included), and <code>svn</code> (460MB, <code>.git</code> included).</p>
<p>Also, checking <a href="http://packages.debian.org/ccache">ccache</a> is installed and ready to be used
(<em>e.g.</em> by prepending <code>$PATH</code> by <code>/usr/lib/ccache</code>) is always a good
idea. Using <a href="http://packages.debian.org/colormake">colormake</a> might also be interesting (once
installed, set <code>$MAKE</code> to <code>colormake</code>, done).</p>
<p>So: <em>Can I has a wokking copy?</em></p>
<p>Sure:</p>
<pre><code># Fetch
$ git-clone git://git.debian.org/git/pkg-webkit/upstream.git
$ cd upstream
# Check local branches
$ git-branch
* filtered
# Check all branches
$ git-branch -a
* filtered
origin/HEAD
origin/filtered
origin/svn
# Work on the full sources, and make sure
$ git-checkout -b svn origin/svn
$ git-branch
filtered
* svn
# Set the build environment, and build
$ ./WebKitTools/Scripts/set-webkit-configuration --release
$ ./WebKitTools/Scripts/build-webkit --gtk
# In case the build is interrupted, “make” from there
$ cd WebKitBuild/Release
$ sudo make install
</code></pre>
Lumping commitshttp://mraw.org/blog/2007/08/28/Lumping_commits/2013-12-17T02:11:28Z2007-08-27T22:00:00Z
<p>The goal is to lump some commits together because they should have
been just one. That's the kind of thing that can be done with <code>svk</code> by
calling <code>svk push -l</code>.</p>
<p><strong>Setup</strong></p>
<p>A (remote) <code>origin</code> branch, a local <code>master</code> one, regularly <code>pull</code>ed
and <code>push</code>ed. Some commits are in the <code>master</code> branch, and they should
be pushed into <code>origin</code> as a single commit. The log diff can be seen
by using <code>git-log origin/master..master</code>.</p>
<p><strong>Create a single, equivalent commit</strong></p>
<pre><code>git-checkout -b merger origin/master
git-merge --squash master # HEAD isn't modified (squash commit),
# fast-forward
git-commit -m 'Commit message'
git-log origin/master..merger # Shows the wanted diff
</code></pre>
<p><strong>Apply that diff to master</strong></p>
<pre><code>git-checkout master
git-reset --hard origin/master # Reset master to origin/master
git-log origin/master..master # Shows nothing
git-rebase merger master # Apply the (only) additional commit
# from merger to master
git-log origin/master..master # Shows the wanted diff
</code></pre>
<p><strong>Finition</strong></p>
<pre><code>git-push origin master
git-branch -D merger
</code></pre>
<p>Some bits of work, but a nice occasion to handle some <code>git</code> commands.</p>
Public git on aliothhttp://mraw.org/blog/2007/08/13/Public_git_on_alioth/2013-12-17T02:11:28Z2007-08-12T22:00:00Z
<p>Now the git repositories put under <code>~/public_git</code> are visible through
<code>gitweb</code>, here are the URLs for my git repositories out there:</p>
<ul>
<li><a href="http://git.debian.org/?p=users/kibi-guest/debootstrap.git;a=summary">http://git.debian.org/?p=users/kibi-guest/debootstrap.git;a=summary</a></li>
<li><a href="http://git.debian.org/?p=users/kibi-guest/deblog.git;a=summary">http://git.debian.org/?p=users/kibi-guest/deblog.git;a=summary</a></li>
</ul>
<p>My <code>debootstrap</code> branch is quite useless, now that upstream told me to
do things differently, but at least it contains a working debootstrap
for GNU/kFreeBSD.</p>
<p><code>DebLog</code> is a Perl module to access build logs. It is not yet
finished, but it can help fetch some logs and compare them. See the
<code>scripts/</code> directories for examples.</p>
Using git-svnhttp://mraw.org/blog/2007/08/11/Using_git-svn/2013-12-17T02:11:28Z2007-08-10T22:00:00Z
<p>SVN with git. One package: <a href="http://packages.debian.org/git%2Dsvn">git-svn</a>; two tools:
<code>git-svnimport</code>, <code>git-svn</code>.</p>
<p>First thought: <em>Oh, I don't need to modify things, let's use
<code>git-svnimport</code></em>. Bad guess. After some revisions fetched from
<code>blender.org</code>, the download gets stalled, and no way to resume. That's
documented in <a href="http://bugs.debian.org/436930">Debian bug #436930</a>.</p>
<p>After having asked on <code>#git/irc.freenode.net</code>, it looks like
<code>git-svnimport</code> is quite unmaintained and that <code>git-svn</code> is the way to
go.</p>
<pre><code>git-svn clone https://svn.blender.org/svnroot/bf-blender
</code></pre>
<p>Far better, but after 6000+ revisions, interrupted download, and
impossible to resume it. Damn (but thinking about it, I might have
used the wrong command). Another way to do that:</p>
<pre><code>git-svn init https://svn.blender.org/svnroot/bf-blender
# Get 10 revisions
git-svn fetch -r BASE:10
# Get the rest
git-svn fetch -r BASE:HEAD
</code></pre>
<p>Using <code>-r BASE:HEAD</code> is quite interesting since only the needed
revisions are fetched.</p>
<p><strong>Important:</strong> Don't forget to use <code>git-svn</code> and not <code>git</code>.</p>
<p>Now, two branches: <code>master</code>, local, and <code>git-svn</code>, remote. Go!</p>
<pre><code>$ du -sh .git/
1.1G .git/
$ time git gc
real 67m14.503s
user 7m26.616s
sys 0m57.740s
$ du -sh .git/
221M .git/
</code></pre>
<p>And all the project's history is there! The <code>branches</code>, <code>tags</code>,
<code>trunk</code> are all available as directories, but it is also possible to
have them as remote branches, using the following options: <code>-T trunk
-b branches -t tags</code>.</p>
Git on aliothhttp://mraw.org/blog/2007/08/02/Git_on_alioth/2013-12-17T02:11:28Z2007-08-01T22:00:00Z
<p>To share easily ones git branches, it is possible to store <code>$foo.git</code>
repositories in <code>~/public_git</code> on alioth, the repositories being
then available at <code>git://alioth.debian.org/~$login/$foo.git</code>.</p>
<p><strong>Edited:</strong> missing <code>~</code> before the login name...</p>
Using git to manage l10nhttp://mraw.org/blog/2007/07/11/Using_git_to_manage_l10n/2013-12-17T02:11:28Z2007-07-10T22:00:00Z
<p>The idea is to have backups of working files easily, as well as easing some
tasks like sending bugreports with attached files, ensuring <code>msgcat</code> has been
run, fetch the new <code>templates.pot</code> file from the server, etc.</p>
<p>Various thoughts on using git to manage localization.</p>
<ul>
<li><p>hierarchy:</p></li>
<li><p><code>l10n.git</code></p></li>
<li><p><code>l10n.git/po</code>: upstream PO files.</p></li>
<li><p><code>l10n.git/po-debconf</code>: debian debconf screens.</p></li>
<li><p><code>l10n.git/scripts</code>: scripts to ease the manipulation of translations, update
of working files, etc.</p></li>
<li><p>ideas:</p></li>
<li><p>adaptation of bubulle's script for this layout, maybe using ReadLine to ask
for the package, version, and file to send;</p></li>
<li><p>same kind of scripts for sending RFR (or RFRn), LCFC (or LCFCn) from the
commandline.</p></li>
<li><p>script to which a TAF or MAJ mail can be piped, so that the appropriate file
is fetch from the server;</p></li>
<li><p>script to which a diff can be piped, so that it gets applied (if possible)
and commit'd in the tree, automating the addition of the submitter's mail in
the log;</p></li>
<li><p>script(s) to check for missing msgcat invocations, incomplete translations
and so on.</p></li>
<li><p>open questions:</p></li>
<li><p>how to handle the tagging of the released (BTS'd) files? Will tagging with
<code>$package/$version/$bug</code> be too much?</p></li>
<li><p>how to handle the Mail-Followup-To header for the second kind of scripts?
Sounds like not that possible, after all.</p></li>
</ul>
Setting up ikiwikihttp://mraw.org/blog/2007/07/10/Setting_up_ikiwiki/2013-12-17T02:11:28Z2007-07-09T22:00:00Z
<p>Summary of my setup</p>
<ol>
<li><p>Install ikiwiki</p></li>
<li><p>Choose a hierarchy for the blog entries. It is
<code>blog/$year/$month/$day/$title.mdwn</code> right now, and tags are stored under
<code>tags/</code>.</p></li>
<li><p>Enable some plugins. Currently:</p></li>
<li><p><a href="http://ikiwiki.info/plugins/sidebar/">sidebar</a>: integrate a menu bar on
each page;</p></li>
<li><p><a href="http://ikiwiki.info/plugins/tag">tag</a>: ease the creation of tags and links;</p></li>
<li><p><a href="http://ikiwiki.info/plugins/pagestats">pagestats</a>: needed to generate
automatically the list of the tags;</p></li>
<li><p><a href="http://ikiwiki.info/plugins/prettydate">prettydate</a>: specify a string
format for the Posted/Last edited dates;</p></li>
<li><p><a href="http://ikiwiki.info/plugins/shortcut">shortcut</a>: enable many interesting
shortcuts like <code>[[debbug NNNNNN]]</code> or <code>[[debpkg package]]</code>.</p></li>
<li><p>Create some placeholders:</p></li>
<li><p><code>index.mdwn</code>;</p></li>
<li><code>tags.mdwn</code>;</li>
<li><p><code>tags/*.mdwn</code> (one for each tag),</p></li>
<li><p>Write a configuration file: <code>ikiwiki.setup</code>, enabling these plugins, and
containing some basic information like origin and target directories.</p></li>
<li><p>To do:</p></li>
<li><p>learn the <a href="http://ikiwiki.info/helponformatting/">syntax</a> for real;</p></li>
<li>automate the creation of <code>index.mdwn</code> placeholders under <code>blog/$year</code>,
<code>blog/$year/$month</code>, and so on. Extend a module to do so?</li>
<li>poke the author of the <a href="http://ikiwiki.info/patchqueue/calendar_--_archive_browsing_via_a_calendar_frontend/">calendar
plugin</a>
so as to get the code;</li>
<li>report that shortcuts containing slashes aren't working;</li>
<li>integrate it in git.</li>
</ol>