[clug] Does anyone have experience using Unison with source code repositories?

Carlo Hamalainen carlo.hamalainen at gmail.com
Wed Apr 3 03:15:44 MDT 2013


On 03/04/13 17:17, Paul C. Leopardi wrote:
> Hi all,
> After having almost lost work on the computer in my office at ANU, I am
> determined to keep at least part of its file system synched to my laptop. Both
> are running Kubuntu 12.04. After having also been burnt by using unmaintained
> parts of Krusader (e.g. the sync part) I have decided on using Unison.
>
> My problem is that I have lots of software build directories under CVS, SVN
> and Git, containg files produced by autotools and configure that differ
> between my two machines, and I also have directories containing TeX files with
> symlinks to files in other directoris on one of my machines and the
> correspoding directory on the other machine containing the file contents
> rather than a symlink. In other words, my first sync will be a diogs breakfast
> of conflicts.

So this sort of situation? In server1, 'f2' is a symlink to README, 
while in server2, f2 is an actual file:

✗ 07:07:57 carlo at r500 ~ $ ls -lR server1
server1:
total 4
lrwxrwxrwx 1 carlo carlo  6 Apr  3 19:06 f2 -> README
-rw-r--r-- 1 carlo carlo 33 Apr  3 19:07 README

✓ 07:08:00 carlo at r500 ~ $ ls -lR server2
server2:
total 8
-rw-r--r-- 1 carlo carlo 33 Apr  3 19:06 f2
-rw-r--r-- 1 carlo carlo 33 Apr  3 17:29 README

Unison will attempt to merge f2, as it notices that it's a symlink in 
one location and a file in the other:


✓ 07:08:02 carlo at r500 ~ $ unison -ui text server-1-2
Contacting server...
Connected [//r500//home/carlo/server1 -> //r500//home/carlo/server2]
Looking for changes
Reconciling changes

server1        server2
new link <-?-> new file   f2  []



So this may cause you some grief if you have lots of these.

The other thing that can cause grief is if you do work independently in 
two Git/Mercurial repositories and then attempt to Unison them. This 
will obviously lose work, so you have to merge the two repos, then rsync 
one to the other. At least that is my experience.

Overall, I've used Unison for years, syncing Mercurial and Git 
repositories. I sync between my laptop, a USB stick, a work laptop, and 
a Linode. I usually sync from a device to the Linode, using it as a 
master directory. Generally things have been fine.


-- Carlo


More information about the linux mailing list