In Adium 1.0, we'll have a number of external frameworks:
So whenever any of these frameworks changes — especially if it fixes a bug that we've been suffering from — we build the framework in our copy of their source code, and then we drop the new built framework into our source repo and commit it.
But I often see it done this way:
- svn rm Foo.framework
- svn ci Foo.framework
- cp -R ../../Foo/build/Release/Foo.framework Foo.framework
- svn add Foo.framework
- svn ci Foo.framework
This is wrong, for three reasons:
- Commit history for the framework is lost. svn doesn't relate the new framework to the old framework that previously occupied the same path.
- Much space and bandwidth is wasted as all of the files in the framework (including nibs, images, plists) are copied yet again, even those that were not changed.
- It takes two commits to do one job.
Here's a better way.
- pushd ../../Foo/build/Release
- tar cf Foo-framework.tar Foo.framework
- mv Foo-framework.tar $OLDPWD
- popd
- tar xf Foo-framework.tar && rm Foo-framework.tar
- svn ci Foo.framework
tar will overwrite every file in the framework, and of course any new ones will be created. A quick svn st will show you which files are new (unversioned) or modified; if there are any unversioned files, you should of course svn add them before committing. And then when you commit, the commit history of all the files is preserved, so you can do svn log (or the equivalent operation in Trac) later, and svn will apply its own smarts about exactly what should be copied.
The only downside to this approach is that any files that no longer exist in the old framework won't be removed. If you have reason to believe that any files were deleted, you should perform ls -R on both directories, diff -u the two results, and look for “-” lines. But most of the time, this isn't necessary; how often does anything ever get removed from a framework?
So, anyway, please use tar, for the sake of the commit history. ☺
UPDATE 11:55: If you want an example, here's Adium changeset number 18243, in which I did this to the LMX framework. See how small that changeset is?
UPDATE 14:08: Fixed SparklePlus link.