How do you keep modified theme up-to-date?
mattyoung - May 29, 2009 - 00:01
I modified the style.css, page.tpl.php, template.php and some other files I don't remember. Now there is a new release of the theme and I need to somehow merge the new version files with all my modifications. What is the best way to approach this?

Subtheming and/or use source control
Nothing is completely foolproof, but here are a couple of ideas...
If you are going to modify a theme, the best way is to make a new subtheme that uses the starting theme as a base theme.
Then you just override the stuff you want in the subtheme, and the base theme stays unchanged. You'll be able to update the base theme without overwriting your changes.
Note: be aware that if you override a whole template though, changes to the overridden template in the base theme won't be reflected in the subtheme. But for other stuff like CSS and template.php stuff, it will work well.
Aother option is to get your contrib theme via CVS so that updates can be merged into your modified files. Note: things may get a little complicated resolving conflicts if future CVS updates overlap with your own edits. Or if you want to get even more elaborate, you could use subversions technique for "vendor drops", or even use a distributed source control system for merging changes.
Or you might even use both approaches:
eg install the contrib theme via CVS, but still use a subtheme to override it. That way you can use CVS diff commands to merge template changes into your subtheme templates.
--
Anton
Thank you for your advice. I
Thank you for your advice.
I end up using WinMerge to hand merge all my changes to the new version. WinMerge directory compare helps me remember what files I've changed, then I go into each file and do the merge. I click through each conflict, ignore all except the ones involve my hacks.
I was going to go the CVS route. But I am not sure how to do it. I was on version '6.x-3.0', the new version is '6.x-3.2'. So should I check out using the '6.x-3.0' tag, copy my change into it, then update to the '6.x-3.2' tag?
Also, if I check out from CVS, the .info file have no version id in it. So the update module cannot track new release.
-Drupal Notebook-
CVS (I'm no expert)
For updating your checkout directory to a new version in CVS goes something like:
cvs update -dP -r DRUPAL-6--3-2I'm not sure how CVS (I use subversion a lot more) handles that when you have customisations in your working copy though.
You might need something like
cvs update -dP -j DRUPAL-6--3-2the -j tells CVS to merge in changes between the current working directories rev and the one specified.
Or possibly even (I don't think you'd need this, but...):
cvs co -j DRUPAL-6--3-0 -j DRUPAL-6--3-0 moduledirwhich tells cvs to merge changes between the two revs into a working dir.
You'd probably want to test this though. I tend to just use the plain checkouts, then use subversion to handle the merging etc. We only use CVS to grab and update code from the Drupal repo - any custom changes get made in svn.
The cvs_deploy module was created to solve that problem.
It's all a bit involved though, and if WinMerge works for you then who am I to argue :)
--
Anton