views:

118

answers:

4

Is it possible (or even practical) to copy directory from one SVN repository location to another, retaining tho old one and keep history for each individual file in both places? So far I see SVN import which copies the directory but looses the history or SVN move which relocates the directory. Here's a brief example:

  • COPY SVN_ROOT/projects/branches/release1.0/myproj TO SVN_ROOT/rad/trunk/myproj
  • Retain history in both locations
A: 
  • You are correct: svn import is not perfect, as addressed in the SVN FAQ and in SVN Issue 1328.
  • You may also be looking for svn move.

  • Also, see this thread (related question with similar suggestions).

pianoman
svn move as far as I can tell will remove the original location
DroidIn.net
Doh! Then I agree with Jason below, since 'svn move' = 'svn copy' + 'svn delete'
pianoman
+4  A: 

Would using svn copy work?

Jason Musgrove
I'm wondering that myself. It seems to operate on files so I don't know if history is retained
DroidIn.net
Yes, history is retained: http://svn.haxx.se/users/archive-2005-01/1857.shtml
pianoman
+3  A: 

Are you looking for the equivalent of a Unix link, where the files are updated simultaneously? Or are you looking to copy them and let them diverge? I think that svndump and svnfilter (or hand-editing) could probably do the latter.

However, I'd suggest taking some time to think about why you're doing this, as it seems to me to lead to maintenance headaches. If you're trying to keep two files that update simultaneously, a better solution is to extract them into a new module that is linked with the code that uses it. If you're trying to let them diverge ... well, to be honest, history doesn't make a lot of sense there, and could give a false view of the way the repository looked at a point in time.

kdgregory
Agreed. The whole point of a code repository is to maintain a single source of truth for your project.
pianoman
The old branch will stay there for legacy sake. Trust me I'm not the one who comes up with that requirement :) I'm on the other hand interested with history of files I will inherit
DroidIn.net
+1  A: 

I think plain old SVN copy does this, and then allows you to diverge. It's the same as branching/tagging.

If you want something like a link without diverging code, look into using an externals definition, as described in the SVN book:

http://svnbook.red-bean.com/en/1.5/svn.advanced.externals.html

CodeGoat