Moving from Google Code to GitHub: Migrating the wiki

When moving your project repositories from Google Code to GitHub, the migration from SVN to Git is supported by a a rich toolset.

 

But what about the project wikis?

There’s this tutorial, that also contains a python tool to convert the syntax. I somehow didn’t manage to get it to work.

As I had only few pages to migrate, I pragmatically decided to do it manually.

Here are the steps that were performed

  1. On your github repo, create the first wiki page (which creates the wiki, effectively).
  2. Clone the wiki via git (it’s much more comfortable to work on a local copy):
    git clone https://github.com/<user>/<repo>.wiki.git
    
  3. Copy the Google Code wiki files into your local clone.
  4. Replace the file endings to .md
  5. If your Google Code wiki featured a sidebar, rename your sidebar file to _Sidebar.md. The links are converted later on.
  6. For each wiki page do the following steps
    1.  Convert bold words, replace the regex
      \*(.*)\*
      by
      **\1**
    2.  Convert italic words, replace
      _word_
      by
      *word*
    3. Replace headings for all levels
      1. = Heading1 = to * Heading1
      2. == Heading2 == to ** Heading2
      3.  And so on
    4. Convert links, by replacing the  regex
      \[([^\s]*) (.*?)]
      by
      [[\2|\1]]
      For anchors (starting with #) make all characters lowercase and replace underscores (_) by minus (-).
    5. Replace
      <code> or {{{
      by
      ``` java
      (replace java by any other available highlighter).
    6. Replace
      </code> or }}}
      by
      ```
      (make sure to always have the ``` in a new line).
    7. Remove #summary. Leave the text after it as is.
    8. Remove the line that starts with #sidebar on each page.
    9. Convert ordered lists: replace the remaining
      #
      by
      1.
    10. Convert unordered lists: Replace
      -
      by
      *
  7. Push the changes upstream.
  8. Manually compare each page of the old version with the new version.
  9. You might have to adjust the layout of the sidebar a bit.
  10. Delete the google code wiki from your source code repository

Note that these steps were sufficient for the paricular repo I moved over. Thus, this list is definitely not complete. You might recognize that more transformations might be necessary for you. That’s why step 7 is extra important!

Please comment on any rules I left out.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.