« Baby Einstein Colour KaleidoscopeThe Impasse »

Upgrading But Keeping Customizations

07/14/08

  12:06:32 am, by Nimble   , 608 words  
Categories: Thoughts, Programming

Upgrading But Keeping Customizations

Imagine this scenario: you have downloaded a particular project that has source code, and it's almost exactly what you want, but it's missing a few things, and it's not under version control (for example, the projects on SourceForge) So, you go off and make some updates to it.

Now a new version of the project comes out, and you would love to upgrade... but now there is the matter of those customizations that you did.

So what do you do?

Well, here is one approach that I used to keep my customizations to MWForum, which I used for my Cosmology forums, which fits the description of such a project.

I have made customizations to allow for named quoting and superscripts, etc., and I did not want to lose these. I did, however, want to upgrade from 2.10 to 2.15, and the project is certainly not under version control.

Now, there is a big, complicated part to this whole thing. It involves using Subversion, undoubtedly one of my favourite version control systems, to take advantage of its system of merging, on top of which, once you have done this operation, it is much easier to go off and make other changes to the project in confidence.

Note, though, that this technique only works as long as you have or can download the version of the project that you started modifying. Also, the technique will not work if there has been a complete reorganization of the target project in question! :)

If you are using Windows, you should also get TortoiseSVN, which is a fantastic shell extension for Subversion.

James Selvakumar's blog has a really good entry on installing and setting up both Subversion and TortoiseSVN.

Once you have everything installed and a repository created, here are the steps to follow:

  • Find an original installation of the version you have modified and put it in a directory (in my case, mwforum-2.10.1)
  • Import that version into Subversion (if you click the [...] in the dialog, you can create yourself a folder in the repository - do not sweat it too much - it could be as simple as the project name, or as complex as /projects/internet/software/forums/mwforum/trunk)
  • Create a directory for your custom version (e.g. C:\Sandbox\MWForum)
  • Do a Subversion Check Out of the project into that directory
  • Create a directory for the updates (e.g. C:\Sandbox\MWForumUpdates)
  • Do a Subversion Check Out of the project into that directory as well
  • Find the newer version of the project on the internet (in my case, mwforum-2.15.0), unpack it and copy the files on top of the files in the updates project (e.g. C:\Sandbox\MWForumUpdates)
  • Do a Subversion Check In of that project - make sure to add all files, not just the updated files (use the Select / deselect all check box near the bottom)
  • Find your own modified version of the project (in my case, my modified mwforum-2.10.1 version) and paste it onto the custom version directory (e.g. C:\Sandbox\MWForum)
  • Do a Subversion Update in the custom version directory
  • This is where the merges will happen.
  • If there are conflicts, you can right click on the file in the list that has the conflicts, and Edit Conflicts - the TortoiseMerge tool is a little complicated, but not terrible to figure out. Be sure to use the Resolved button up top
  • Now you can Check In the merged project - check in all files, except for perhaps temporary build files

(The process actually did work for me, by the way :)

Now, if I can find a decent FTP client that can skip the .svn directories on upload, I will be happy :)

3 comments

Comment from: Mike Petersen [Visitor]  
Mike Petersen

Try downloading Total Commander and checking out the FTP client within it. I find it very flexible.

http://www.ghisler.com

Regards,
Mike

07/16/08 @ 13:48
Comment from: mawic [Visitor]
mawic

Alternatively, you could use the official, slightly more elaborate “vendor branch” approach: http://svnbook.red-bean.com/en/1.4/svn.advanced.vendorbr.html

07/16/08 @ 14:50
Comment from: Nimble [Member]  
Nimble

Mike -> I might poke my nose in there and check it out; Total Commander, if I recall correctly, has been around forever and a day. Criminy, for them to even mention .ARJ format - I swear I remember that from 20 years ago :)

mawic -> It can be much simplified organizationally, given that it is not a “vendor drop” into an existing project (I am pretty enamoured of using svn:external for vendor pieces, but I do wish that they had a relative path format to reduce work when reorganizing :)

The vendor branch starts out with a fairly similar technique, but I must admit, I had not encountered the usage of “svn_load_dirs.pl” before. I was lucky with mwForum that things did not move around much, but I am also contemplating trying to perform the same magic on b2evolution here, and they sound like they have done a ton of stuff between the 1.8.1RC that we are running here and the 2.4.2 release. That could be bad news; if things have changed too much, I might just consider examining my changes (in this case, I don’t think that there are too many) and applying them manually ;)

Either that or I would possibly end up having to check in a few separate vendor versions in order to establish enough “waypoints” for the svn_load_dirs technique…?

Now you also have me wondering whether mwForum is in a private Subversion archive somewhere :) I was wondering where I had seen your name before; now I feel silly :)

07/18/08 @ 23:44