Summary: Advanced Merging in Subversion 1.5

I summarized this from here.

Yes, I read and summarize these stuff all day – -” I hope it’d be useful in the future (for myself). And I’d be very glad if you find it useful.

  1. Merge from a specific change (CherryPicking)
    • When you don’t want to merge a range of change, such as merging specific bug fix.
    • svn merge -c [version] [url]
  2. Full syntax merges commands (Merge Syntax : Full Disclosure)
    • svn merge [url]@[rev] [url]@[rev] [wc]  (Notice that two ‘url’ can be different)
    • svn merge -r [start_rev]:[end_rev] [wc]
  3. Merge with out Mergeinfo
    • There are 4 cases that “svn:mergeinfo” isn’t updated from merging
      1. Merging unrelated source url (as you see in #2)
      2. Merging from foreign repositry (svn 1.5 doens’t support this)
      3. –ignore -ancestry
      4. reverse merge (like svn merge -r 303:302)
  4. Differences between merge and update conflict (More on Merge Conflict)
    • Merging is very similar to update, except it that the source urls can be different (the first command in #2)
    • Skipped Target (I am still confusing about this)
    • It is possible to have conflict even if your local copy isn’t changed from HEAD revision.
    • When there’s a conflict, the file will be rename to  x.working, x.left, x.right (in update it’d be x.mine x.r[old] x.r[new]
  5. How to edit merge info properties (Blocking Change)
    • “svn propget svn:mergeinfo” will show merge info.
    • svn merge -c [rev] –record-only [trunk_url]
    • Can be used to block specific change from range merging . Ex. you want to merge rev 300 to 400 from trunk but except revision 350. You can fire the command above to make svn:mergeinfo record 350 (but no merging occurs really) and then issue normal merging command.
    • Don’t change the svn:mergeinfo  property yourself. It’s more complicated than you think, read this
  6. Seeing logs from merged code(Merge-Sensitive Logs and Annotation)
    • “svn log -v” does include commit log of changes from merging. But it doesn’t really contain the *real* changes those happen from the code to be merged.
    • “svn log -v -r [rev] -g (or –use-merge-history)” Show things behind the scene.
    • so are “svn blame”. You may think that the merger is the one to blame !!. In fact, it’s the one who commit the code that’s merged.
  7. Ancestry
    • It’s the same concept as in previos post.
    • You can use –ignore-ancestry for merge
    • You can use –notice-ancestry for diff
  8. Refactoring /renaming files in a branch (Merges & Moves)
    • uppose that you have a file name “integer.c” in your module
    • you make a branch to refactor this module
    • “integer.c” is renamed to “whole.c”
    • Meanwhile, the trunk is developed by another programmer, “integer.c” got some new methods and bug fix.
    • you reintegrate the branch
    • Subversion isn’t smart enough to track that “whole.c” is actually “integer.c”. So it delete “integer.c” and add the *new* file called “whole.c”
    • Yes, the new methods and bug fix, developed before intrunk, will disappear.
  9. Incompatibility with pre 1.5 clients (Blocking Merge)
    • Since v 1.5 use mergeinfo property, using pre 1.5 client may cause unexpected problem.
    • In some IDE, you may be able to config this.

, , , , , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: