Tuesday, March 31, 2009

Upgrading an SVN Vendor Branch

The dojo toolkit just announced the final 1.3.0 release of their toolkit today, which is great news for us, as we've been waiting on some 1.3.0-specific functionalities to deploy in our site.

In our SVN repository, we've got a "vendor" branch set up according to the instructions laid out in the Vendor Branches Section of the Branching and Merging Chapter of the SVN Book. In it, of course, we have a /dojo directory.

So the deal now was to follow the instructions from the SVN Book and upgrade to 1.3.0 release.

Much to my dismay, I got hung up on the very first stage:

To perform this upgrade, we check out a copy of our vendor branch and replace the code in the current directory with the new libcomplex 1.1 source code. We quite literally copy new files on top of existing files, perhaps exploding the libcomplex 1.1 release tarball atop our existing files and directories. The goal here is to make our current directory contain only the libcomplex 1.1 code and to ensure that all that code is under version control. Oh, and we want to do this with as little version control history disturbance as possible.

What I did was

  • download the latest release
  • unzip it into a local checkout of /vendor/dojo as /vendor/dojo/1.3.0-release
  • mv /vendor/dojo/1.3.0-release /vendor/dojo/current
But then when I did 'svn stat', instead of showing me a list of all the changed and new files, it just said:

    ~current

and svn stat help tells us:

    '~' versioned item obstructed by some item of a different kind

...which makes sense, but unfortunately didn't really help. It said to "copy new files on top of existing files", and that's what I was doing.

Obviously, the problem is that by just copying the directory over, all the special .svn information was getting blown away. What I needed was a way to copy all the *files* into that /current directory... without destroying the existing directory structure.

Well, after a lot of searching, I finally found the answer in a video on the gotdrupal.com website. In a nutshell, it is a very detailed, patient walk through of the "Vendor Branches" section from the SVN book (see above).

Turns out, the trick (or at least one of them) to getting those files to overwrite without confusing SVN is to download a tarball of the release and then un-tar it right into the /current directory, but using a special --strip-components=1 flag.

If you are curious about the "right" way to set up a vendor branch, I highly recommend reading the Vendor Branches Section of the SVN Book and then watching this great video.


No comments:

Post a Comment