monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Re: Syncing databases without using a network?


From: Tom Koelman
Subject: [Monotone-devel] Re: Syncing databases without using a network?
Date: Thu, 26 Jan 2006 19:44:09 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (windows-nt)

Jeronimo Pellegrini <address@hidden> writes:

> Hi.
>
> On Wed, Jan 25, 2006 at 05:31:10PM +0100, Tom Koelman wrote:
>> Jeronimo Pellegrini  writes:
>> 
>> > Since I keep several copies of a database in different places (laptop,
>> > desktop, USB stick, etc), I usually want to sync them -- but not
>> > necessarily over a network. I don't know of any tool that would
>> > sync two databases accessing the filesystem directly, and perhaps
>> > it would be a nice thing to have shipped with monotone?
>> > Something like:
>> >
>> > monotone-sync databaseA.db databaseB.db
>> >
>> > I thought that could also be useful to others...
>> 
>> I wrote a perl tool to do that. Would you be interested in that? In
>> that case I'll look it up, polish it a bit and post it.
>
> Yes, asbolutely -- that would be great! (Thanks!)
> J.

Hi Jeronimo,

here's the script. It's a bit on the fragile side, it's lightly
tested, but I'm sure it won't overwrite anything. It needs file access
to both databases, so it'll never be quicker than netsync.  This is
how it works:

- Put all three files (MonotoneNodes, MonotonePacket and
  mt-sync-databases) in the same directory.
- Make sure monotone is in your path
- Run mt-sync-databases <db1.db> <db2.db>
- It will spit out some lines on stdout:
   r>99a7e6f2a19fd0f4c23f87de75a7bf34b93bad2f
  means revision 99a is in db1.db but not in db2.db and
   r>99a7e6f2a19fd0f4c23f87de75a7bf34b93bad2f
  means revision 99a is in db2 but not in db1.db.
   c>f87de75a7bf34b93bad2f99a7e6f2a19fd0f4c23
  means certificate f87 is in db1.db but not in db2.db and
   r>f87de75a7bf34b93bad2f99a7e6f2a19fd0f4c23
  means certificate f87 is in db2 but not in db1.db.

When it's done, it has created two files, namely db1.db.import and
db2.db.import. To actually make changes to the databases you run
monotone --db=db1.db read < db1.db.import
monotone --db=db2.db read < db2.db.import

And you're done.

I only used this incidentally myself, but I'm pretty sure it works.

Regards,
Tom

Attachment: MonotoneNodes.pm
Description: Binary data

Attachment: MonotonePacket.pm
Description: Binary data

Attachment: mt-sync-databases
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]