better together

I first came across the idea of MultipleDesktops in this Martin Fowler post, and have been wanting to try it ever since. We added a Mac at home a few months ago, and I took the plunge. Now I can easily synchronize much of my work across different machines/OSes, all under Subversion's excellent revisioning. I only use it within my home LAN, but the idea extends easily to the internet by using a public Subversion server with encryption. There are gaps of course, notably my calendar and my RSS reader state, but overall this is a huge step forward.

I first started using MoinMoin for a PersonalWiki earlier this year, and it seems I finally have a good solution to keeping all kinds of personal stuff in one very low-friction hypertext place, with lots of good search functionality, and in a free and open tool with a great supporting community. Wiki fans can tell me "Duh!" now.

So now that all that stuff is in one place, I naturally want it to be in all of my places. Does PersonalWiki + MultipleDesktops work? Yes, rather well, if you're using MoinMoin and Subversion. It's early days for me for both of these things, but since it's been good so far, I thought I'd post my experience here and see if others have things to add.

double revisioning

I was initially uncomfortable with the fact that I would be revisioning everything twice, and even considered for a moment looking for a way to defeat MoinMoin's revisioning (also to dodge the new file profusion, which turns out to not be a problem). Fortunately I came to my senses: this two level revisioning is excellent. The combination of the two means that all of this is free:

general approach

First, a disclaimer: synchronizing personal wikis is admittedly a huge simplification, compared to synchronizing multi-user MoinMoin wikis; the latter poses some non-trivial problems for page edit conflicts. Since I can mostly only be in one place at a time, revisioning conflicts are minimized.

Note that this does not mean I need to strictly serialize the work on the different desktops; if I forget to commit one desktop before working in another, or forget to update a desktop before starting work there, I might have some merge conflicts -- but they are likely to be fairly simple to resolve (see below).

I further simplified the matter of synchronizing MoinMoin databases by excluding some items like data/plugins/, data/users/ and configuration files from what I carry under revision. In the end, I only revision this slice of MoinMoin's data/ database:

How does this work? Once the relevant MoinMoin installations are configured and their databases include Subversion "working copies" of the files in question, I simply svn update a machine before using it, and svn commit when I finish. Of course I can use any of the other Subversion commands as well.

wrinkles and ironing

lots of new files

MoinMoin has a nice, open database of text-on-disk. I was briefly concerned about the amount of new file creation that happens (one for every "save", and several for every new page), but it turns out I can systematically add all new files appearing under data/pages/ to Subversion.

This could be automated a number of ways, but it's also pretty easy to do manually with tools like TortoiseSVN so I haven't bothered. The "auto add" approach adds the data/pages/*/cache/ files to the repository, which could be excluded, but why add a special case?

conflicts

If I don't strictly keep my work on different machines in a svn update ... svn commit sandwich, I risk getting conflicts. So far, these are of two types:

  1. the edit-log and event-log files: these frequently conflict, but are trivial resolutions: remove the three marker lines, and sort the file. Could be automated, but easy enough in vi that I haven't bothered.

  2. conflicting page edits: this is slightly more complicated, but doesn't happen much. If I find myself with two data/pages/MyPage/revisions/00000042 files, I need to rename the newer one 00000043, merge in the changes, and fix the number in the current file. If I care about the wrong data in the logs, I can edit "42 => 43" in those too, but I haven't seen a real problem yet with just ignoring. I usually fix the page's edit-log for a clean "get info," but I sometimes ignore the wiki's overall edit-log; this is corruption that I can live with.

Binary attachments, generally being non-mergeable, are a potential problem. I don't anticipate this for myself, but if someday I have a file worth worrying about I could use Subversion's new lock mechanism.

data/pages/MyPage/edit-lock

It can happen that I get a wiki edit-lock into the repository, especially if I auto-add all new files under data/pages/. No worries, the wiki reminds me each time I hit that page until I simply svn delete it. In practice, I don't have the locks at commit-time, or I see them and exclude them when adding files.

log timestamps

This is a non-wrinkle: I use the same tz_offset for all my MoinMoin installs, I minimize being in two places at one time, and I sort-merge the logs.

page renames

When a page is renamed in MoinMoin, the change happens outside of Subversion; therefore MyPage is reported missing, and MyPageRenamed is reported as new (or "Nested" in the TortoiseSVN client).

A simple solution without side effects is to undo the rename of the page directory at the file system level (e.g. mv pages/MyPageRenamed pages/MyPage), then redo the rename with Subversion (e.g. svn mv pages/MyPage pages/MyPageRenamed).

This is an extra step, but the Subversion status effectively highlights the issue before I try to commit.

moinmoin packages

Without having necessarily set out to make my life complicated, I find myself with three different MoinMoin packages; fortunately, they all use the same database, and I've not yet had a stick of trouble. (is it bad luck to say that?)

Here are some notes.

  1. MoinMoin + apache: since I had already started a team MoinMoin wiki at work, this was the easiest configuration to use for my PersonalWiki. I considered other WikiEngines, notably instiki, but MoinMoin's text-on-disk kept me here. When I later created a Subversion repository on my Mac and started using MultipleDesktops, I added my PersonalWiki to it like this:

     cd c:\data\perswiki\data
     # import just the revision portion of data/ into svn
     svn import -m"adding perswiki" edit-log  %SVN.REP%/trunk/perswiki/data/edit-log
     svn import -m"adding perswiki" event-log %SVN.REP%/trunk/perswiki/data/event-log
     svn import -m"adding perswiki" pages     %SVN.REP%/trunk/perswiki/data/pages  
     # overlay same files with a svn working copy, to put under revision control
     svn checkout %SVN.REP%/trunk/perswiki/data   
  2. MoinX: this was the obvious installation for the Mac; it is a very clean, well-done package. To overlay the default wiki data with my own PersonalWiki files, I just went to the default location in ~/Library/Application Support/MoinX/Instance/data and did the same checkout as above, then registered the working copy location with my central update/checkout scripts (these allow me to easily manage my MultipleDesktop as arbitrary chunks of my revision tree in distributed working copies on my disk).

  3. DesktopEdition: today I wanted to use my PersonalWiki from another PC in the house, and took the opportunity to install this package. It also went in very easily and is working without surprises. Since I wanted to use a different data_dir and because I'm only revisioning a slice of data/, I had to create an appropriate wikiconfig.py with data_dir set accordingly, and then:

     cp -R mmde\wiki\data svn.root\perswiki\data
     svn checkout %SVN.REP%/trunk/perswiki/data svn.root\perswiki\data  

A nice PersonalWiki default in both MoinX and DesktopEdition is that they bind localhost; by default, the wiki server will not accept external requests.

Now, I can use my PersonalWiki on any of these three machines, and keep things in sync with Subversion's update and commit, and occasionally some relatively simple conflict cleanup.

--

wiki keywords for notification: personal, desktop, multiple, moinx, pim

MoinMoin: DaveFrey/PersonalWiki/MultipleDesktops (last edited 2008-07-18 08:37:17 by ThomasWaldmann)