I am a fan of Linux based OS. I love Ubuntu a lot. In fact I started my programming in Redhat. So from the beginning I am comfortable using Linux than Windows. The only reason I use windows is to check IE browser compatability.

Recently I attended Drupal Sprint India 2009. I want to attend the sprint, so I need one Laptop to go there and work. My company provided me Laptop with Windows. So I need to work on drupal core issues in windows. Hmm it looks very hard for me to work in Windows. I want to have following things in my Windows machine.

Cygwin to get the linux like terminal, so that I can see paths with forward slash.

Xampp Lite to get Apache, Mysql, PHP.

cvs, I am going to work on drupal core so I need it

I should able to create patches, apply patches.

I want to use Drupal Drush module, which provides some command line utilities

Emacs. I am more comfortable with this editor. It is very hard to work with other editors once we are comfortable with Emacs

To be able create patches and apply patches I installed unxutils from http://sourceforge.net/projects/unxutils/ . With this unxutils I got most of the Linux commands. The commands like ls, mkdir, wget, diff, patch, tar, zip etc… are working. I am very happy after installing unixutils.
Installing UnxUtils is nothing but setting the path variable in Windows. I extracted the unixutils directory in C folder and Add C:\unixutils\usr\local\wbin path to the Path variable. In Windows XP we can set the Path variable by going to control panel > System > Advanced > Environment Variables. Select the Path and click Edit and add your path to the existing path.

Installing Drush

There is a documentation about installing Drush in Windows http://drupal.org/node/594744 . This document explain Drush installation by using GnuWin32. But I already installed UnxUtils so I don’t require GnuWin32. So first 3 steps in the http://drupal.org/node/594744 can be ignored. I extracted drush in C folder. As specified in the step 4 of http://drupal.org/node/594744 I edited drush.bat with the path of php.exe and path of drush.php. I added following statement in drush.bat file @E:\xampplite\php\php.exe C:\drush\drush.php %1 %2 %3 %4 %5 %6 %7 %8 %9

Because I used xampplite to install php, php is there at path E:\xampplite\php\php.exe.Now I executed drush command from the windows terminal by specifying -r and -l attributes.
After that I got an idea why can’t I keep this php, drush paths also in path so that I can directly drush.bat file as it is. Yes I added php, drush, mysql paths in Windows Path variable. The everything works file.

Today I am doing patch review of drupal7. I tested one patch, Now I want to remove this patch and go back to previous latest version of drupal. Unfortunately there is no cvs revert command which revert the files like in svn, bazaar, git etc..

I used same patch command to revert the applied patch.

I used following command to revert.

patch -p0 -R < patch_file_path.patch

In the above command -R option Assume patches were created with old and new files swapped. So it do the reverse operation of patch.