Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syncing library/project subversion respositories

I'm developing a library alongside several projects that use it, and I've found myself frequently modifying the library at the same time as a project (e.g., adding a function to the library and immediately using it in the project).
As a result, the project would no longer compile with previous versions of the library.

So if I need to rollback a change or test a previous version of the project, I'd like to know what version of the library was used at check-in.
I suppose I could do this manually (by just writing the version number in the log file), but it would be great if this could happen automatically.

like image 453
Jesse Beder Avatar asked Sep 21 '26 00:09

Jesse Beder


2 Answers

An option that might work for you is to use an svn:external reference to the library. When tagging the project, you can do one of two things:

  • Update the svn:external to refer to a specific revision of the library; OR
  • Update the svn:external to refer to a new tag that you make on the library.

Since the svn:external metadata will be part of the main project's commit history, you can always get the tag on the main project and it will refer to the correct version of the library. We do it and it works very well. It also comes in handy when you want to freeze the version of the library code that you depend on in preparation for a release.

like image 76
denis phillips Avatar answered Sep 22 '26 17:09

denis phillips


I think if I were going to do this, I would use tags. It would be pretty easy to write a script that would tag both repositories with the same ID each time you upgraded the library and used it in the project. Then, if you need to roll back to a previous version, you just see what its most recent tag was, and roll the library back to that version.

UPDATE: Sorry, I've been in Mercurial land for a while, and forgot that subversion doesn't directly support tagging. Assuming you use the usual subversion directory structure

/
  /trunk
  /tags
  /branches

you just need to run

svn copy trunk/ tags/TagName

on both repos, with the same tag name. Subversion is pretty good about smart copies, so you don't need to worry about disk space.

like image 44
tghw Avatar answered Sep 22 '26 16:09

tghw



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!