views:

15

answers:

1

I have a typical Subversion set-up:

/trunk
/branches/client-one
/branches/client-two
/branches/client-three

Trunk holds main development and branches hold client customizations. Now I then, I port changes from trunk into branches and viceversa:

[+] /trunk/readme-trunk.txt
[port] /trunk/readme-trunk.txt -> /branches/client-one/readme-trunk.txt
[port] /trunk/readme-trunk.txt -> /branches/client-two/readme-trunk.txt
[port] /trunk/readme-trunk.txt -> /branches/client-three/readme-trunk.txt

It works pretty flawlessly, except when I need to rename a file. Now matter how I do it, I always get tree conflicts and, depending on the steps I take, I lose local modifications or I can no longer port future changes.

Is it possible to rename a file and still be able to port changes back and forth?

[rename] /trunk/readme-trunk.txt -> /trunk/readme.txt
[port] /trunk/readme.txt -> /branches/client-one/readme.txt
[port] /trunk/readme.txt -> /branches/client-two/readme.txt
[port] /trunk/readme.txt -> /branches/client-three/readme.txt

[edit] /trunk/readme.txt
[port] /trunk/readme.txt -> /branches/client-one/readme.txt
[port] /trunk/readme.txt -> /branches/client-two/readme.txt
[port] /trunk/readme.txt -> /branches/client-three/readme.txt

(Most documentation on the subject implies that tree conflicts happen when two developers modify the same file; this is not the case since I'm the sole developer.)

+1  A: 

I've been reading a lot since I asked the question and it appears that file renaming is the weak point of most source control systems. As about Subversion, it's one of those things that just can't be done (like merges before 1.5).

This is the workaround that seems to work best:

  1. Perform regular rename (copy+delete) in trunk. Commit.
  2. For each branch:
    • Tag revision from #1 as merged, e.g., svn merge --record-only (command line) or [X] Only record the merge (TortoiseSVN).
    • Perform a regular rename (copy+delete).

You get no tree conflicts and, the best part, both files are still regarded as related, so you can still port and backport between branches.

(Not really tested on directories, just plain files. Comments welcome.)

Álvaro G. Vicario