svk sync smerge

Bsag has made some changes and released Tracks 1.03, so I figured it was a good time to try out the smerge process with svk. This article has a good description of thesvk workflow process this involves.

Unfortunately it is a difficult merge due to whitespace formating changes. So it hides any of the real code changes that might have occured. In fact after the merge I had to unrevert some of the changes I made in my local trunk. svk smerge doesn’t seem to be able to view conflicts on a line by line base.

I have svk sync running on crontab, so to mirror branch in the local svk repository is pretty much constantly up to date. Star merging these changes into the local svk development branch and then onto my svn and svk working copies is the next job.


[nic@shell:~/tmp/shlg-tracks] svk smerge -C /tracks/mirror/trunk/tracks /tracks/local/shlg-tracks/
Auto-merging (102, 109) /mirror/trunk/tracks to /local/shlg-tracks (base /mirror/trunk/tracks:102).
U app/helpers/application_helper.rb
U app/helpers/feed_helper.rb
U app/helpers/todo_helper.rb
U app/helpers/login_helper.rb
C app/models/todo.rb
C app/controllers/application.rb
G app/controllers/feed_controller.rb
C app/controllers/context_controller.rb
C app/controllers/todo_controller.rb
C app/controllers/project_controller.rb
U app/views/layouts/standard.rhtml
U app/views/context/_show_items.rhtml
U app/views/context/show.rhtml
C app/views/todo/list.rhtml
U app/views/todo/_show_items.rhtml
U app/views/todo/_action_edit_form.rhtml
U app/views/project/_show_items.rhtml
U app/views/project/show.rhtml
U README_FIRST.txt
U Rakefile
A doc/README_FOR_APP
A doc/CHANGELOG
D doc/CHANGENOTES.txt
D doc/README.txt
U public/javascripts/prototype.js
U public/javascripts/calendar-setup.js
U public/javascripts/calendar.js
U public/javascripts/toggle_notes.js
U public/stylesheets/standard.css
D README_LOGIN
New merge ticket: a4c988fc-2ded-0310-b66e-134b36920a42:/trunk/tracks:103
Empty merge.
6 conflicts found.

svk seems to use the same status codes for smerge as svn status. Note, ‘G’ is documented here. In summary from svk help up:

A Added
D Deleted
U Updated
C Conflict
G Merged
g Merged without actual change

Next step is to actually merge the changes from the mirror. svk smerge -l smerges the updates from the mirror “using the logs of merged revisions as commit message”. If there is a conflict, you are given the option of chosing your or their revisions.


[nic@shell:~/tmp/shlg-tracks] svk smerge -l /tracks/mirror/trunk/tracks /tracks/local/shlg-tracks/
Auto-merging (102, 109) /mirror/trunk/tracks to /local/shlg-tracks (base /mirror/trunk/tracks:102).
Waiting for editor...
Log message not modified: a)bort, e)dit, c)ommit?c
U app/helpers/application_helper.rb
U app/helpers/feed_helper.rb
U app/helpers/todo_helper.rb
U app/helpers/login_helper.rb
Conflict found in app/models/todo.rb:
e)dit, d)iff, m)erge, s)kip, t)heirs, y)ours, h)elp? [e] d
--- app/models/todo.rb (YOURS)
+++ app/models/todo.rb (MERGED)
...
Conflict found in app/models/todo.rb:
e)dit, d)iff, m)erge, s)kip, t)heirs, y)ours, h)elp? [e] t
G app/models/todo.rb
Conflict found in app/controllers/application.rb:
e)dit, d)iff, m)erge, s)kip, t)heirs, y)ours, h)elp? [e] d
...
New merge ticket: a4c988fc-2ded-0310-b66e-134b36920a42:/trunk/tracks:103
Committed revision 111.

Followed by an update to my working copy.


nic@rails:~/devel/tracks-dev$ svn info
Path: .
URL: https://svn.plumtree.co.nz/repos/tracks/local/shlg-tracks
Repository UUID: 3080eda5-12f9-0310-a60c-bfd680f1e508
Revision: 112
Node Kind: directory
Schedule: normal
Last Changed Author: nic
Last Changed Rev: 112
Last Changed Date: 2005-06-12 13:08:16 +1200 (Sun, 12 Jun 2005)
Properties Last Updated: 2005-06-12 12:53:20 +1200 (Sun, 12 Jun 2005)
nic@rails:~/devel/tracks-dev$ svn up
U app/helpers/application_helper.rb
U app/helpers/feed_helper.rb
U app/helpers/todo_helper.rb
U app/helpers/login_helper.rb
U app/models/todo.rb
U app/controllers/application.rb
U app/controllers/feed_controller.rb
U app/controllers/context_controller.rb
U app/controllers/todo_controller.rb
U app/controllers/project_controller.rb
U app/views/layouts/standard.rhtml
U app/views/context/_show_items.rhtml
U app/views/context/show.rhtml
U app/views/todo/list.rhtml
U app/views/todo/_show_items.rhtml
U app/views/todo/_action_edit_form.rhtml
U app/views/project/_show_items.rhtml
U app/views/project/show.rhtml
U README_FIRST.txt
U Rakefile
A doc/README_FOR_APP
A doc/CHANGELOG
D doc/README.txt
D doc/CHANGENOTES.txt
U public/javascripts/prototype.js
U public/javascripts/calendar-setup.js
U public/javascripts/calendar.js
U public/javascripts/toggle_notes.js
U public/stylesheets/standard.css
D README_LOGIN
U .
Updated to revision 111.

There was only one manual corrections I needed to make were svk smerge got confused by the whitespace updates from the mirror, plus one bit were I had to revert the changes back to the version I had made locally.

9 Comments

  1. Kim Said,

    August 11, 2009 @ 3:09 pm

    Hi,

    I hope this will reach you, I didn't know how to contact you via email.

    I am using svk to mirror repository in a different server for trac.
    I've been trying to setup cronjob to sync it with the repo forever but it is not working.
    The script I have is:
    ———
    #!/bin/bash
    PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin
    sudo sh
    svk sync //mirror
    ——
    crontab:
    PATH=/usr/sbin:/usr/bin:/bin:/sbin
    00 * * * * /path/to/script/svkcron > /home/akim/cron.log
    echo "update complete: $(date)"
    ———

    and the output is
    ——–
    Starting to synchronize //mirror
    Syncincg svn://path.to.rep/dev
    update complete: Tue Aug 11 11:00:00 EDT 2009

    I got it until it says "Syncing svn.." but it isn't retrieving any information.
    I am running it from the root's crontab with out the sudo command in a different script but that only output
    "Repository doesn't exist, create? (y/n)"
    and i can't create mirror as the root. (I read it somewhere on svk hp)

    If you can help me please do, any help is extremely appreciated…

    Thank you,

  2. Nicholas_Lee Said,

    August 11, 2009 @ 3:51 pm

    I'm mostly using git now. Not sure I can help you, but the basic principle of any cron script is to make sure it runs on the command line first.

  3. Kim Said,

    August 11, 2009 @ 4:54 pm

    thank you so much for the quick reply.
    I think the problem is having sudo in there. It works completely fine on cmd.

    I've noticed that many svk users have moved to git. Is git compatible with trac?

    Thanks so much

  4. Nicholas_Lee Said,

    August 11, 2009 @ 5:00 pm

    Yes git will work with Trac. See google for the plugin.

    sudo might be causing the problem.

  5. Kim Said,

    August 11, 2009 @ 6:26 pm

    Ok the reason why I had to get SVK was cause we had repository in a remote server and trac wouldn't work with that. Would GIT allow me to user a remote repository?
    I'm reading http://trac-hacks.org/wiki/GitPlugin but it says point trac to your local git repository.

    Yeah I'm trying to get rid of sudo to call svk sync. If i don't have to do that things are cron would work.

    Thanks again for your help

  6. Kim Said,

    August 11, 2009 @ 7:35 pm

    Ok the reason why I had to get SVK was cause we had repository in a remote server and trac wouldn't work with that. Would GIT allow me to user a remote repository?

    Everything got tangled up because when I first set up svk, I moved the .svk or svk depot path to somewhere I don't have permission and that's why it requires me to sudo to sync, and that's why cron doesnt work.
    So I un-installed svk and re-installed it to start all over but,,, hopefully things will work out.

    If nothing works my last resort is git so I was wondering if it works with remote repo.

    Thanks a lot for the fast reply

  7. Nicholas_Lee Said,

    August 11, 2009 @ 9:40 pm

    Yes git allows multiple remote repositories.

    If you need to run the cron job as root. Then add it to the root crontab: "sudo crontab -e -u root".

    If you need to run it as another user, run it as root and use sudo -u USER.

    If you run a script with sudo and if requires a password, then it will just fail.

  8. Krishna Pothula Said,

    September 1, 2009 @ 6:24 pm

    Hi Nicholas,

    I am trying out Git. Our requirement is to have a Central Repository and multiple remote repositories. Do you know of a way to auto sync Central with remote repositories using Git?

    Thanks

  9. Nicholas Lee Said,

    September 2, 2009 @ 9:54 am

    What exact do you mean by “auto sync”. auto merge or auto commit?

    If you use cron you can set up either a git pull or git push command in a script – but merging will still need to be done by a developer.

RSS feed for comments on this post