*edited 23-10-2008* : merging from trunk to branch requires [trunk_url] too : Thanks you, Michael.

I assumed that you have read my (Branching & merging in Subversion 1.0)

This post will emphasis you only the different between 1.0 and 1.5. Both functions were improved in 1.5 is much more easier. If you’re using older version : “It’s worth to switch to 1.5 !!”

  1. Keeping a Branch in sync (No manually tracking any more!!)
    • From trunk to branch : $branch_wc$ svn merge [trunk_url]
    • Subversion automatically track which version has been merged into the branch. You don’t have to specify the revisions range (changeset) anymore !!
    • From feature branch to trunk : $trunk_wc$ svn merge –reintegrate [branch_url]
    • As mentioned in last post, your branch contains some part of the trunk’s code from merging
    • –reintegrate option tell Subversion to carefully replicate only those changes unique to your branch.
    • When the branch is already reintegrated, it can’t continue developing on this code line. You should use “svn delete [branch_url]‘. Don’t worry the history of branch is still existed.
    • Again, don’t forget to commit !!
  2. Mergeinfo
    • In your branch working copy, type “svn prpget svn:info”
    • You’ll see output like this “/trunk 341-390″. It specified which revision has been merged and from which development line.
    • try “svn mergeinfo [trunk_url]” This will show you which revision you have merged in to the branch.
    • “svn mergeinfo [trunk_url] –show-revs eligible” will tell you the opposite info, which revision in trunk that hasn’t been merged to branch. (Eligible to merge)
  3. Common usages
    1. Undo change
      • In version 1.0 “svn merge -r 303:302″
      • Now, You can use “svn merge -c -303″ too
    2. Resurrecting deleted item
      • In version 1.0 “svn copy –-revision [rev_no] [url] [wc]“
      • Now you can use “svn copy [file_url]@[rev_no] [wc]/[filename]“
      • For example, “svn copy http://svn.example.com/repos/calc/trunk/real.c@807 ./real.c”
      • you can change [wc] (working copy dir) to url, like this “svn copy http://svn.example.com/repos/calc/trunk/real.c@807 http://svn.example.com/repos/calc/trunk/”

Since my senior project will closely relate to Subversion. I’ll record the short list here for further reference.

If you’re looking for more complete list, I suggest you to follow here

Checking that Subversion is installed

  1. svn –version

Creating repository and import your project

  1. mkdir /home/jemmy/svn-repos
  2. svnadmin create /home/jemmy/svn-repos
  3. create files for the first version of your project at /home/jemmy/tmp
  4. tmp> svn import -m “Put your log message here” . file:///home/jemmy/svn-repos/proj-name/trunk

Daily commands

  1. Check out svn co /home/jemmy/svn-repos/proj-name/trunk working-dir
  2. Status working-dir> svn status file.txt
  3. Diff working files and files in repository working-dir> svn diff [-rHEAD] file.txt (to specify your own diff program, use –diff-cmd. Argument -r1, -r2, .. -rHEAD tells the versions of file in repository.)
  4. Commit working-dir> svn commit -m “Put your log message here”
  5. Check log working-dir> svn log [--verbose] [file.txt] (–verbose will give you exactly all changes in each revision. Using svn log without filename will produce a log for current dir & subdir)
  6. Update working-dir> svn update -u
Follow

Get every new post delivered to your Inbox.