KAYAK2U

December 30, 2007

Well, that was fun…

Ten days ago I downloaded my first copy of WordPress’s suite of blogging-software files, and threw them out onto the server. Immediately I began tweaking them in little ways. It always annoys me when I look at someone else’s code and find typos in the comments, or one line of code that’s indented differently than the rest, or output code that mixes up tabs and spaces or neglects newlines in some places. And so it was with the WordPress code, and where ever I went in it I took to trying to neaten it up.

And then last night comes the alert of an “urgent security release”, involving changes in more than a dozen files. When I looked into how to go about upgrading, it turned out not to be as straightforward as, say, installing the latest release of Opera. In fact, upgrading WordPress borders on the annoyingly tedious. The first thing is, they don’t offer a .zip file of the few files that have changed, but want you to download the entire suite. They do have a nice list of the files that have changed, and even highlights of the particular changed lines, but the average person is just supposed to unzip the whole package and send it wholesale out to the server. Except that the average person is supposed to delete all the files on the server, first. Except for the files that the average person is not supposed to delete.

And then there were those few files that I’d diddled, and probably couldn’t even find right away again.

But the WordPress pages kept referring to a piece of Software called Subversion, and I slowly gathered that it was the tool to do the job of comparing files, and merging, or facilitating the merging of the files with the smallest of differences in them. So, I went to the Subversion web site and started poking around, and, after writing my server provider, found out that installing Subversion on the server would likely get me into trouble, as in: Verboten. Then I noticed a link to something called Tortoise SVN, a Windows Subversion Client. I downloaded the thing, and installed it on my laptop, but had the sneaking suspicion I would also still need the regular Subversion (cuz Tortoise is just the client, right?) and possibly an Apache server, too, for the laptop, to make the whole thing run out there on Internet.

After playing around with Tortoise SVN for a couple hours, it turned out to be just the thing, and I didn’t need the regular Subversion or any server software.

And here’s how ya do it (so I can read my own post the next time I need to do a big merge). Most of the following has now been set up on my machines, but for those who are just starting out here’s what you do after TortoiseSVN is installed and the computer rebooted. TortoiseSVN is utilized exclusively via Windows Explorer, so pop the Explorer open (I have it running all the time, anyway). My local setup is that I keep and work on an exact mirror image of my web site on my hard drive, so basically, that’s going to become the working folder that I will eventually merge all WordPress changes into.

Create a new folder that is going to become your Repository. Right click on that folder and in the TortoiseSVN sub menu choose “Create repository here…”. “Native filesystem (FSFS)” is good. Click “OK”. In a different, empty folder create three sub folders called “trunk”, “branches”, and “tags”. Right click on the parent folder (now containing the three you just created) and in the TortoiseSVN sub menu select “Import”. Browse to the Repository folder and select it. Let it work, and click “OK”. Then right click on the folder that holds your blog files and again go to the TortoiseSVN sub menu and select Import. Fill in the path to the Repository *trunk* folder and let ‘er rip. After it’s done, click “OK”. You now have your blog files in the Repository trunk. In order to start tracking changes as you edit the files you need the Check them Out of the Repository into a new working folder. Either rename the old blog directory and create an empty one with the original name, or delete everything in the original one. When that’s done, right click on the folder where you want your working files and select “SVN Checkout…”. Fill in, as usual, the path to the Repository *trunk*, and let fly. Click “OK”. Now you have a working folder of all your blogging files, which should be the same as your original folder, with a few (possibly hidden) special .svn folders in them. Edit the .php files as you normally would. At any time you can “Commit” them back to the Repository, at which time you’ll be given a chance to review the differences between files, with appropriate options for action.

Now, when WordPress floats a new version, download the .zip file, open it up, and drag or extract the files on top of the files in your working subdirectory (don’t mess that up!) TortoiseSVN should immediately find all the files with differences in them and give you a chance to review and massage before committing the changes to the Repository and setting your working directory in updated order. After everything is satisfactory, you can upload as you please to the server.

Carry on, eh?

MikeSoja - December 30, 2007 -- 09:52 pm    Filed in: Programming  
« Remember to comment that code…
Confused in their bias… »
As Happy As A Clam

Kayak2U.com

msoja RSS 2.0

Other's Pages









Search

Archive

November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  


  • Books4Sale



    Soja's GoodReads Books4Sale Cheap

  • Category Cloud


  • Tag Cloud