0

I wonder if it is possible to set up an SVN subversion system (btw, i'm on Ubuntu 11.10) for particular folder with two different sources and track changes simultaneously?

The situation is the following:

  1. There is an Open Source project which is regularly updated (from svn://...). I use that as a basis to add some features I need. I don't have a right to submit my changes or do branching or anything else like that at the developers svn.

  2. Modifying my code I keep track of what I modified via local svn (file:///usr/...)

What I would like to do is from time to time merge my version with official updates but still keep my personal local svn. How do I set it up?

Or would it be easier to have SVN (for official subversion) + some other system like Git?

p/s/ I work on the code myself only in Eclipse with Subclipse plug-in.

UPDATE1:

going through the SVN book, that's how I should probably make a branch in my case:

Initial import:

svn import /path/to/3rd-party-code \
          file:///usr/.../vendor/name/current \
          -m "importing initial 1.0 vendor drop"

Tag it:

svn copy file:///usr/.../vendor/name/current  \
         file:///usr/.../vendor/name/1.0      \
         -m "tagging name-1.0"

Bring to trunk:

svn copy file:///usr/.../vendor/name/1.0  \
         file:///usr/.../trunk/        \
       -m "bringing name-1.0 into the trunk"

And then checkout from trunk and start modification. So, how things change with "externals" ?

Update 2:

Is this how everything should be don from scratch:

svnadmin create /usr/.../svnrepo

svn import svn://path/to/3rd-party-code \
     file:///usr/.../svnrepo/name/branch/official \
     -m "importing initial XXXX rev. vendor drop"

svn copy file:///usr/.../svnrepo/name/branch/official  \
         file:///usr/.../svnrepo/name/trunk      \
         -m "bringing rev XXXX into the trunk"

svn propedit svn:externals svn://path/to/3rd-party-code name/branch/official

Merging:

svn merge -r XXXX:HEAD name/branch/official
svn ci -m "Merged YYYY official revision to trunk"

UPDATE 3:

svnadmin create /usr/.../svnrepo

svn mkdir -m "Create folders" \
          file:///usr/../svnrepo/name/branches \
          file:///usr/../svnrepo/name/branches/official \
          file:///usr/../svnrepo/name/trunk

Externals:

svn propedit svn:externals file:///usr/.../svnrepo/name/branches/official

(input "svn://path/to/3rd-party-code")

svn copy file:///usr/.../svnrepo/name/branches/official  \
         file:///usr/.../svnrepo/name/trunk      \
         -m "bringing rev XXXX into the trunk"    

Now, the problem is when I "co" trunk, I get the following structure:

official/svn:externals/folder1/file1

Which is something I don't want for sure :)

Merging:

svn merge name/branches/official
svn ci -m "Merged YYYY official revision to trunk"
Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
Denis
  • 1,526
  • 6
  • 24
  • 40

2 Answers2

0

Your situation is described in the SVN book in the chapter about vendor branches. If the open source project also uses an SVN repository you can in addition take advantage of the externals functionality.

AndreKR
  • 32,613
  • 18
  • 106
  • 168
  • so do I start with importing current 3rd party code into my local SVN (as 1 revison), then making a branch and somehow giving it an "external"? Probably after that I apply my changes in trunk? Can you help with particular commands to accomplish that? – Denis Jan 18 '12 at 17:56
0

folder with two different sources and track changes simultaneously?

It's not doable with SVN - WC have one path for one repo

But you task can be covered with svn:externals and "Vendor Branches" strategy:

  • separate branch for external project defined as svn:externals (without using PEG-revision in URL)
  • your development happens in trunk
  • branch (after updates with new revisions) periodically merged to trunk
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
  • Can you please say which SVN commands do I use to accomplish that? Do I need to create a folder in my local SVN repository where I put a 3d party code and then make it external? I'm just a bit confused on particular steps to do that. – Denis Jan 18 '12 at 14:23
  • Update 2 is *almost correct*, except one detail: with svn:externals you haven't import code to vendor branch before propedit. **Empty** folder with externals property will work the same way if you have local copy of 3-rd party code. And if server (>=1.6) supports mergeinfo, you can omit revisions range - consecutive merges will merge ony unmerged (new) revisions to trunk in you Working Copy – Lazy Badger Jan 19 '12 at 10:46
  • you mean I don't have to import code, just set up an external and then copy it to trunk? (please, see new update). – Denis Jan 19 '12 at 10:56
  • @Denis - yes, but AFAICR you have to create folder name/branch/official by hand **before** propedit (at least I done it this way all times). I.e for **physical folder** you define *virtual content* – Lazy Badger Jan 19 '12 at 11:03
  • svn mkdir -m "Create a branch folder" file:///usr/../svnrepo/name/branch/official ? – Denis Jan 19 '12 at 12:04
  • another thing, is that I don't actually have a working copy yet, so where from I run commands after creating a local SVN repository? – Denis Jan 19 '12 at 12:08
  • `svn propget svn:externals official`, pls. And, AFAIK, versioned property *externals* can be defined only in WC, not in repository (TBT!) – Lazy Badger Jan 19 '12 at 14:46
  • (input) `$svn propget svn:externals official` (output) `svn:externals svn://svn..../trunk` – Denis Jan 19 '12 at 14:51
  • ok... wrong in format definition. First parameter must be **relative local path** – Lazy Badger Jan 19 '12 at 14:56
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/6856/discussion-between-denis-and-lazy-badger) – Denis Jan 19 '12 at 15:12