Handling "Third-Party" code w/Source Control (Subversion)

Status
Not open for further replies.
Hey all --

I'm struggling to come up with a process (let alone a policy) to integrate what I'll call third-party code (we have an engineer writing a PL/SQL-based prototype that we're trying to integrate into a prototype system. Its a cast-iron mess, but its what I have right now.)

Periodically, $engineer say ready to integrate. One of us will take an export $engineer's dev database using SQL Developer, sneaker-net it to the development network (don't ask) and we're then responsible for "integrating" it.

I want to use source control as that's what the build process currently depends on. We're using Subversion.

How do I manage these changes with respect to subversion? If I simply copy stuff from the export directory structure into a working copy, I'll have a bunch of orphaned files/objects that I have to clean out manually (error-prone.) If I simply do a svn rm on the working copy, copy the export into the working copy, then do a svn add, I lose the capability to actually track changes from version to version.

I'm wondering if anyone out there does something similarly and how you handle it.

Thanks,

Brad
 

petard

Ars Scholae Palatinae
1,379
Subscriptor++
I've used mercurial for similar. It's nice because I can just copy the third party repository over, metadata and all, using, say a USB drive or a zip file that's emailed.

Then once I've got it, I can run on my local copy

hg pull <path to the copy I got from the third party>
hg merge
hg push

The first command pulls the change history in from his repository to mine. The second merges the changesets since last time. The third lets me push back to my central repository after I've tested/reviewed, etc.

If I needed to tackle this with svn, I think I'd do it a similar way, using the HgSubversion extension.

The steps look roughly like

<install hgsubversion>
hg clone <subversion repository>
hg init <path to new local path I want to export to him>
hg push <path to new local path I want to export to him>

He takes a zip of that, usb drive, whatever, and works on it using normal hg commands. When he's ready to integrate it, he gets me the zip/thumbdrive/whatever with his repository and the workflow becomes

hg pull <path to the copy I got from him>
hg merge (if I've been working on the tree) or
hg update
hg push <url to subversion repository>

**disclaimer** I haven't tried the "with subversion" part above. I have tried the hg-only way. But it's my first thought on how I'd tackle this problem, which seems really well suited to this kind of approach.
 
It would be nice to get $engineer to USE source control. Doesn't. Everything is captured in $engineer's DB schema. No external sources.

$engineer's version of version control is asking the DBA to make a new schema to play in, copy all the stuff over from schema(n-1) to schema(n) then get to work.

We're currently on schema3; I think $engineer's bouncing back and forth between schema2 and schema3 now... so as to not have to gather the ire (or ridicule) of us and/or the DBA.

(Daily WTF here I come?)
 

petard

Ars Scholae Palatinae
1,379
Subscriptor++
[url=http:/civis/viewtopic.php?p=32255869#p32255869:3i3ib72h said:
zelmak[/url]":3i3ib72h]It would be nice to get the engineer to USE source control. He doesn't. Everything is captured in his schema. No external sources.

His version control is asking the DBA to make him a new schema to play in, copy all his stuff over from schema(n-1) to schema(n) then get to work.

We're currently on schema3; I think he's bouncing back and forth between schema2 and schema3 now... so as to not have to gather the ire (or ridicule) of us and/or the DBA.

(Daily WTF here I come?)


Ha. My suggestion involved getting him to use hg and gave you a way to translate that to svn. Can you not just put using source control in his requirements?
 
[url=http:/civis/viewtopic.php?p=32256829#p32256829:313im167 said:
petard[/url]":313im167]
[url=http:/civis/viewtopic.php?p=32255869#p32255869:313im167 said:
zelmak[/url]":313im167]It would be nice to get the engineer to USE source control. He doesn't. Everything is captured in his schema. No external sources.

His version control is asking the DBA to make him a new schema to play in, copy all his stuff over from schema(n-1) to schema(n) then get to work.

We're currently on schema3; I think he's bouncing back and forth between schema2 and schema3 now... so as to not have to gather the ire (or ridicule) of us and/or the DBA.

(Daily WTF here I come?)


Ha. My suggestion involved getting him to use hg and gave you a way to translate that to svn. Can you not just put using source control in his requirements?

Well, hopefully, once this pilot/prototype is fully working, $engineer will actually be out of the picture and we can get on with translating the requirements $engineer's developed for (and probably some of $engineer's PL/SQL code -- heaven help us) into less kludgy actual code.

At that point, we'll be able to "patch around" $engineer. ;)
 

andrewd18

Ars Scholae Palatinae
1,140
Subscriptor++
If I were in your shoes I'd lean on him to use Subversion, then manage your integrations through SVN Externals. His code becomes a folder in your repository, pegged at a specific revision. When you want to integrate his new code, you get his new revision #, change the rev for the external, svn update, and start integrating.

Note, due to major iterations on externals in SVN 1.5, you'll want SVN 1.5 or newer for this to work best.
 
[url=http:/civis/viewtopic.php?p=32253621#p32253621:2umnmomr said:
zelmak[/url]":2umnmomr]How do I manage his changes with respect to subversion? If I simply copy stuff from his directory into a working copy, I'll have a bunch of orphaned files/objects that I have to clean out manually (error-prone.)
How so? "svn status" tells you exactly which files are added / deleted / modified. So something like:
Code:
$ svn status | grep '^!'  | tr -s ' ' | cut -d ' ' -f 2 | xargs svn rm  # deletes missing files
$ svn status | grep '^\?' | tr -s ' ' | cut -d ' ' -f 2 | xargs svn add # adds untracked files
should be fairly reliable (modified files are already tracked, so you don't need to do anything). Maybe replace tr and cut with awk / sed / perl if you have to deal with filenames w/ spaces or something.

[url=http:/civis/viewtopic.php?p=32253621#p32253621:2umnmomr said:
zelmak[/url]":2umnmomr]
If I simply do a svn rm on the working copy, copy the export into the working copy, then do a svn add, I lose the capability to actually track changes from version to version.
Alternatively, instead of replacing, do as Korov suggested and put the new version in a separate directory. subversion since 1.7 (?) can diff arbitrary paths. So:
Code:
$ svn diff ^/third_party/schema2 ^/third_party/schema3         # diff two remote paths
$ cd wc/third_party/schema2 && svn diff ^/third_party/schema3  # diff working copy with remote path
$ # ...etc
will work just fine. Of course, you lose a bit of flexibility as commands like "svn blame" wouldn't work.
 

andrewd18

Ars Scholae Palatinae
1,140
Subscriptor++
[url=http:/civis/viewtopic.php?p=32267465#p32267465:27wie51y said:
LoneGumMan[/url]":27wie51y]
[url=http:/civis/viewtopic.php?p=32257563#p32257563:27wie51y said:
andrewd18[/url]":27wie51y]
Note, due to major iterations on externals in SVN 1.5, you'll want SVN 1.5 or newer for this to work best.
Serious? People still use 1.4/1.5? o_O it's not like 1.8 is new by any measure.
When the change management lead's unstated policy is "manage change by preventing change", then yes, you still run old versions of software. :scared: :rolleyes: :(

I quit that job, but they still run SVN 1.5.
 
Status
Not open for further replies.