1

Instead of making a branch I started a big refactoring, including a completely different backend implementation for a project, in the trunk. Then I found out I really want to keep an older revision. Reasons:

  • refactor is far from done
  • we did some test-runs with the old revision, and we will do more, it helps elucidate further requirements
  • because of the above, i want to keep both source-code and binaries or the older revision

So I checked out the revision I want to a new project, lets cal it project-X-Original. My plan is to have two separate projects, work on the new one, see if it gets me the same results as the old one (but much faster).

Can i do somehow commit project-X-original to a new svn location on the remote, so that i really have two seperate projects?

Ivana
  • 643
  • 10
  • 27

1 Answers1

1

So I checked out the revision I want to a new project, lets cal it project-X-Original. <…>

Can i do somehow commit project-X-original to a new svn location on the remote, so that i really have two seperate projects?

Yes, this is done by plain svn copy:

  1. Determine the revision at which you'd like "project-X-Original" to be forked off (what you have checked out).
  2. Do

    svn copy ^/trunk@that_rev ^/branches/x-original
    

The result will be a new branch ^/branches/x-original forked off ^/trunk at revision that_rev.

See this (and other Subversion dosc) for the description ^/PATH@REV syntax.

kostix
  • 51,517
  • 14
  • 93
  • 176
  • Thanks kostix. Your solution also fixes the I-forgot-to-branch' problem. However, i dont have a 'trunk directory in the project either. The eclipse svn context menu offers the option of 'disconnect', could i use this on my instead of copying the project? – Ivana Jun 26 '18 at 14:14
  • 1) that's not really copying — this is the way Subversion deals with branching, so fear not. 2) I see no reason being fixated on whatever dumbed down solution Eclipse provides: just install official Subversion client for Windows and use it for tasks more complex than committing. – kostix Jun 26 '18 at 21:35
  • …after creating a branch you should be able to "switch" your checkout to it (that's an official Subversion parlance; it even has `svn switch` for this). I have no idea what Eclipse provides for this, if any, but this would be a separate question (about Eclipse, not Subversion). – kostix Jun 26 '18 at 21:39
  • Since i dont have a trunk/branches structure, can i do >svn copy ^/that_rev local/new/path? And then do an initial commit? Or should i do this on the remote? – Ivana Jun 29 '18 at 10:00
  • @Ivana, please study the output of `svn help copy` closely. Among other things, it will tell you that it's possibly to copy the working copy (essentially, the `BASE` revision) to the specified URL—and since it assumes the repository has to be modified, this action will create a commit on the remote. Afterwards, it should be possible for you to switch your working copy to that new URL (or to check it out somewhere else). – kostix Jun 29 '18 at 10:51
  • I will try to perform the copy on the server, because i want to start a new project. (https://stackoverflow.com/questions/2331841/svn-how-to-create-a-branch-from-certain-revision-of-trunk) However we are currently having problems at the side of the remote so i cannot try that yet. – Ivana Jun 29 '18 at 11:59
  • What do you mean by saying "copy on the server"? Since Subversion is a *centralized* VCS, it's impossible to copy anything "not on the server". If/when you're using your work copy in an `svn copy` invocation, it merely means to Subversion something like "take the URL and revision for the «left part» of the copy from the metadata of my working copy". – kostix Jun 29 '18 at 12:05
  • Just to be clear: i thought "svn copy -r 123 ^ ^/branches/original" means: copy revision 123 to a new local folder "branches/original" wheareas "copy -r 123 https://projectpath https://projectpath-original" means copy revision 123 to a new project on the remote repository. – Ivana Jun 29 '18 at 12:42
  • OK, I see. I still suggest reading `svn help copy`: it indeed allows copying locally but it will record addition of this "folder" staged to be committed the next time you run `svn commit`. So in the end, it does not matter how you run `svn copy` provided you understand what you're doing. – kostix Jun 29 '18 at 12:47
  • Maybe I should stress that in Subversion, all branching "is a policy thing" which means you pick what "folders" designate which branches. And then you do branching by mere copying/moving folders around. "The trick" is that these operations are able to refers at particular folders _as recorded at particular revision._ – kostix Jun 29 '18 at 12:49
  • I want to copy to a new project folder, ie to a folder that is not inside another version controlled folder. This means that it is not yet attached to a repository, right? Btw, in my comment 'projectpath' is preceded by 'htth://' – Ivana Jun 29 '18 at 16:11
  • I think I'm lost. You've asked: «Can i do somehow commit project-X-original to a new svn location on the remote, so that i really have two seperate projects?» so I've explained to you how you can copy a path at the specified revision to another path so that you have two version-controlled *but separate* lines of development. Now you tell me you want to have just grab the state of the `URL@rev` and _not_ version control it, right? If yes, it's simple: merely check out `URL` at `rev` and them copy the checked out files to some other folder while omitting the folder named ".svn" at the top level. – kostix Jun 30 '18 at 14:36
  • If the question is really that you want to copy `URL@rev` to a _different repository_ — as opposed to merely creating a new line of development (in the form of a branch) in _the same_ repository, then the answer depends on whether you need to preserve the history. If yes, do [this](https://stackoverflow.com/a/14796490/720999), if no, just check out `URL@rev` and copy its files over (as explained in my previous comment) and then add+commit the resulting folder to a new repository. Next time, please be _way more specific_ right from the start. – kostix Jun 30 '18 at 14:40