Posts tagged with: command-line

Subversion: Merging a Branch to Trunk

Merging a Subversion Branch Back to Trunk

So, you’ve successfully branched code and have a great new feature set you need to get back to trunk, but how? Easy!

Get the latest revision number of the branch you want to merge

If you already have the branch checked out, cd to that directory and svn update it.

Alternatively, if you don’t have (or don’t want to have) the branch checked out locally, you can do it remotely.

The last line returned contains the first revision of that branch, it’ll look something like this:

Check out trunk

Alternatively, you can just update trunk if you have it checked out

Change to the trunk working directory and do the following:

You should see output like this:

This will update your copy of trunk to the most recent version and tell you the revision you are at. Make note of that number as well (should say “At revision YYYY”; where YYYY is the second number you’ll need to remember).

Perform the merge

Now you’ve got the details you need; the revision at which the branch started and the most current revision.

Change directory to the trunk

Check in the results:

Final thoughts

Described above is how to perform the act of merging a branch back to the trunk, there are however many things I didn’t cover. Before you perform this operation you should do a review of all the changes and potential conflicts if the trunk was also receiving active development.

In a team environment, this would be a great time for a peer/mentor code review as well as an approach review for the bugs/featured covered in the branch.

Encrypting a tar or gz (gzip) File with OpenSSL

When you have sensitive data that you need to transmit but want to make it easy to encrypt and decrypt it, use some standard tools to get the job done!

I recently had an issue where a client was using OS X laptops running an Admin panel written in PHP on MAMP in an environment that may or may not have an internet connection. The problem was that they needed to be able to dump their database data into an encrypted file so that they could send the data off when they get a connection (via email, upload, who knows). My initial response was to use gpg to encrypt the file and hand out the keys to the people who would eventually be reading the data.

Turns out, this was going to be a nightmare and I needed something ‘easier’. How about encrypting a tar file with OpenSSL? Bingo! This solution uses utilities that are already on the machine and no installations need to be performed. The reason this was such a big deal is because the laptops running this software will be all over the world with various levels of technical acumen and it will be a nightmare to make sure every single laptop has been updated correctly.

Encrypting Your File

tar and gzip the file, then encrypt it using des3 and a secret key.

That simple!

Decrypting Your File

Essentially, just call all the commands in the reverse order.

Download the Utility Scripts

Download them!

Install / Upgrade PHP 5.3 on CentOS 5 / RHEL 5

As I was setting up a staging VM (CentOS 5), I quickly realized I could only get PHP 5.1 from the standard repositories. Thanks to this blog post, I was able to quickly get up and running with PHP 5.3.

From the command line on your server, run the following:

This, of course, assumes that your LAMP stack is already installed. If not, you would want to replace ‘update’ with ‘install’.

Make sure that you run the last update command (if you’re running an update) as noted above. Not including one of the three packages will result in a bunch of file conflict errors.