RepliKate

Thursday, December 13, 2012 4 Comments

After accidentally cloning a sexy repository, two college grad students decide to educate the newly created script and turn it into the perfect Plastic SCM replication command. (Source: Repli-Kate)


CmdRunner background

Using the CmdRunner library we have created a small application for replicating a complete PlasticSCM repository. You can find the RepliKate code here.


What RepliKate does

You can use repliKate for two purposes:

  1. Replicate a complete repository from one server to another.
  2. Replicate all the changes done inside a repository in a period of time.

Replicate a repository from zero

You can use the following command to migrate all the source repository content into a new one, all your branches, changesets, permissions, labels and so on will be replicated to the destination repository.

"replikate srcrepos@srcserver dstrepos@dstserver"

Remember that if you are a GUI guy you can always use the "Sync view" to achieve the same result.


Keeping your repositories synced

Here is where RepliKate can help you more, let's work with an example.

I have my central code repository in my "OmicronPersei8" server and I want to push periodicaly my new changes to my "Amphibios9" server, in order to keep "Amphibios9" server as a mirror/backup server.

First I need to replicate all the "OmicronPersei8" code repository to the "Amphibios9" server using repliKate, just like we did up there.


Now that I have the repository synced I need to replicate everyday all the new changes made into the "Amphibios9" repository, it's easy using the "Sync view" but it's also too much manually.

With repliKate you can use a Windows scheduled task (or Linux cron) to issue the following command every night:

"replikate srcrepos@srcserver dstrepos@dstserver --syncdate=yesterday"

As you can imagine this command will replicate all the branches with changesets created since yesterday. Running this command everyday will keep my mirror server updated.

Instead of the "yesterday" key word you can use a certain initial date, for example:

"replikate srcrepos@srcserver dstrepos@dstserver --syncdate=initialdate(Month/Day/Year)"

Run "repliKate.exe" to get the full help.


RepliKate log

You can use this log4net configuration file to get the log info from the repliKate application, you need to place it in the same location as the replikate.exe file, it will generate a replicate.txt log file.

In a future blogpost I will explain you how to configure it to reveive email notifications when repliKate is not able to push the new changes.


Enjoy and customize it!

4 comments:

  1. When will you add this functionality to the cm command? Why should I need to build my own version of Replikate and CmdRunner to do this? This would be a great addition to the cm command already.

    ReplyDelete
  2. Hi Anon!

    good point, there is not an especial reason about having the repliKate as an external program.

    It's just a 1 hour coding session and a good example of how to use the CmdRunner library.

    I'm sure that in the future we will have a better command to do what the Sync view does.

    ReplyDelete
  3. I appreciate the Futurama reference...

    ReplyDelete
  4. I appreciate the Futurama reference...

    ReplyDelete