5

I think this may be something that is intentionally not allowed in SVN, but I wasn't able to get a definitive answer from my searching.

I am wondering if it is possible to move a path in the SVN repository to a new location and have the history moved in such a way that the repository behaves as if the content has always existed in this new location. The behavior of svn rename/mv is such that the content is moved to the new path for current and future revisions, but previous revisions still point to the old location.

As previously mentioned, I can see how this essentially breaks the validity of the repository history (and would require rewriting previous revisions), but it also seems like perhaps something that other users have been looking for and so might be possible. If I understand correctly, this is possible in git via rebase.

Update:

It appears that if I use svnadmin dump to dump the repo contents and svndumpfilter to filter into two separate dumps and then load those dumps into separate locations, the new location will still contain whatever leading paths were appended in the old repository path. To illustrate, if I have a path in my repo "/trunk/PathA" and I want to move it to "/trunk/PathB", and I follow the method found here for moving, it looks like it will go into "/trunk/PathB/trunk/PathA".

Community
  • 1
  • 1
Quinn Bailey
  • 200
  • 7
  • 1
    See the answer: http://stackoverflow.com/a/11598608/761095 – bahrep Oct 18 '12 at 14:03
  • 1
    possible duplicate of [Moving SVN repositories data with history as subfolders into another repository](http://stackoverflow.com/questions/11563031/moving-svn-repositories-data-with-history-as-subfolders-into-another-repository) – Marcos Placona Oct 18 '12 at 14:05
  • This looks good ... after posting I started to think along the lines of creating a dump file and reimporting the path I want to move into a different path via svndumpfilter. Let me look this over and see if it works the way I need it too. – Quinn Bailey Oct 18 '12 at 14:09
  • 1
    I think part of the reason it was difficult for to find this answer was that it is an obscure use case that from a search perspective is *very* similar to a common use case. – Quinn Bailey Oct 18 '12 at 14:11
  • @QuinnBailey you can also try the different approach that does not involve 'svndumpfilter': replicate the repository with 'svnsync' after configuring path-based authorization rules that deny read access to any paths that need to be filtered from history. Please also check the SVN FAQ: http://subversion.apache.org/faq.html#removal – bahrep Oct 18 '12 at 14:17
  • @bahrep Thanks for the options. Could you speak to my update regarding how to handle the paths? Or have I simply misunderstood how this would work? – Quinn Bailey Oct 18 '12 at 14:25
  • OK, hold that ... when I first looked, I thought you were using "svnadmin dump" to do the dump, but it looks like svnrdump allows you to dump from a path that is not the root of the repository. I think this should work, but then the question remains whether or not this is a tolerable abuse of the tool. :) – Quinn Bailey Oct 18 '12 at 14:28
  • 2
    Just out of interest, why do you want to do this? It seems a surprising thing to do. – Dughall Oct 18 '12 at 14:34
  • @QuinnBailey You can't use 'svnrdump' or 'svnadmin dump' to dump from a repo path that is not a root. Currently I can advise you to read the SVNBook chapter at http://svnbook.red-bean.com/en/1.7/svn.reposadmin.maint.html#svn.reposadmin.maint.filtering (it answers all of your questions, as far as I see) and to play with svndumpfilter before you move to real actions. Yes, I use 'svnadmin dump' first (to create a complete dump), then I filter the paths with 'svndumpfilter' tool. – bahrep Oct 18 '12 at 14:36
  • 1
    @Dughall Good question, since the scenario is broader than this specific use case. I am using the svn-importer tool (code.google.com/p/svnimporter) to export full version history from other version control tools in the svn format. This tool creates an svn dump file as the end result of its process. When loading the content of this dump into a new svn repository, I want to know if I can move certain folders of this repository into new locations. – Quinn Bailey Oct 18 '12 at 14:43
  • I appreciate all of the feedback on this ... I am rethinking this all now and am starting to think that what I want to do is simply not supported. @bahrep I had previously reviewed that section of the svn book but didn't see this scenario directly addressed (most likely because the tool is not intended to be used this way). – Quinn Bailey Oct 18 '12 at 14:47

1 Answers1

1

You can edit the dump file to change the path before you load it. Here is a perl script to do it. SVN-DumpReloc

maddoxej
  • 1,662
  • 13
  • 19