Scott Hanselman

Using a Windows version of GNU Patch.exe with CVS and Diff Files

June 18, 2005 Comment on this post [4] Posted in DasBlog
Sponsored By

All this is likely old hat for *nix folks, but some Windows people might care.

As you know I work on DasBlog and SourceForge uses CVS for Source Control.

If you want to get the LATEST source for DasBlog and compile it yourself on Windows:

  • Download TortoiseCVS and install it.
  • Make a folder for DasBlog (C:\dev\dasblog) and right click on the folder and select "CVS Checkout"
  • In the CVSROOT text box, enter in this:
    and in the Module text box enter "source"
  • Hit OK. You'll get all of DasBlog.
  • There's a file called CreateDasBlogVdir.vbs that will setup DasBlog in IIS, etc. Then compiled and play.
  • NOTE: When you do this you are implicitly getting a label in source control called "HEAD." That's the latest stuff that Omar and I and the devs (and now you) run. If you don't want the latest unreleased stuff, go to the Revision Tab before you hit OK and select "Choose branch or tag" and enter in "dasblog-1-7-5016-2" to get the last released version.

If you aren't a dev with check in privileges, but you want contribute a patched file:

  • Make your changes to you files locally. Note that with CVS you don't have to "reserve" a file for check out. Just make the change. The file's overlay indicator will change to tell you it's been edited.
  • Save the .patch file using the format <modifedfile>.patch and mail it to Omar or I. For example, if you're patching LoginBox.ascx.cs the patch should be LoginBox.ascx.cs.patch.

If you're me, and you want to apply a patch file: (or if you're not me and you just want to apply a standard DIFF/PATCH file on Windows without pulling your hair out)

  • Use Notepad2. Why? Because it's one better than Notepad.
  • Open the patch file in Notepad2 and revel in the fact that Notepad2 already has the syntax highlighting setup to help you visualize the patch differences.
  • Download the GNU version of Patch.exe for Windows and put it in your path (or in your C:\Utils, if you're me)
  • Now, make a Patch.bat file that looks like this below:
    @echo off
    patch < %1
  • Now, right click on the <modifiedfile>.patch file and click "Open With" and associate it with your new patch.bat (not the patch.exe)
  • Now copy the <modifiedfile>.patch to the same folder as the original. Double click on the <modifiedfile>.patch and you'll get:

Now you can use CVS on Windows and play with CVS patches/diffs, making and patching with ease and grace. Enjoy.

FYI, If you want to get deeper into DasBlog development and start including patches, you'll want to subscribe to the checkin mail for DasBlog's CVS so you'll know what's changing when.

Now playing: Akon - Trouble Nobody

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
June 18, 2005 18:01
This is the best follow up post to the open source cliche "If you don't like it, fix it!" Kudos, Scott.
June 18, 2005 21:05
Great instruction, Scott! I want to contribute to dasBlog when I can take a breathe from my work! (Very busy right now...)
June 18, 2005 23:24
Thanks, this is one thing I hadn't played around with when writing up my Quickstart guide to CVS (and SourceForge) for windows developers ( I'll be sure to include it!
June 20, 2005 19:10
Thanks, Scott!

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.