git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git-Mediawiki : Question about Jeff King's import script

From
Jeff King <peff@peff.net>
Date
May 26, 2011, 15:42 UTC
Message-ID
<20110526154214.GA4049@sigill.intra.peff.net>
In-Reply-To
<BANLkTi=nLZV_QCyKT8LOhzkJYoJD6J4wPA@mail.gmail.com>
On Thu, May 26, 2011 at 05:18:11PM +0200, Claire Fousse wrote:
Show 9 quoted lines
> We based our script on what you called a few months ago the "quick and
> dirty perl script" for the import part and have a few questions about
> it.
> First of all, just in case, here is your original script :
> http://article.gmane.org/gmane.comp.version-control.git/167560
> 
> It seems like you first used a hashmap for it to be transformed later
> into a flat list / array. What is the reasoning behind this ? Why not
> create an array right away ?

The hashmap is actually backed by an on-disk key/value database. The purpose of this was to allow resuming an import that had failed in the middle (since even for a moderate-sized wiki like the git wiki, the import was quite slow).

So the hashmap is indexed by page id, and each value contains an array of revisions for that page. If we see a page id that we've already done, we can skip importing it.

If you wanted to do it all at once, yes, you could build a flat array of revisions, with each revision mentioning the page that it came from, and just keep appending to the array as you read more data from the wiki. And then at the end, sort that array based on timestamp to get the chronological ordering of changes.

Hope that helps, -Peff

Previous: Claire FousseNext: Claire Fousse
Message 2 of 4 in “Git-Mediawiki : Question about Jeff King's import script”
  1. Claire FousseMay 26, 2011
  2. Jeff KingMay 26, 2011
  3. Claire FousseMay 27, 2011
  4. Alexandre DulaunoyMay 27, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.