Author Topic: Diff current buffer versus SCM version of the file  (Read 4736 times)

sevenofeights

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Diff current buffer versus SCM version of the file
« on: October 27, 2011, 03:15:01 AM »
At work I am often asked to do code reviews.  Many times people will send me modified files for review with no base files to compare them against.  To perform the review, I have to determine the base revision of the file they modified and pull it down from the SCM repository so I can see the changes that they made.  This macro simplifies that procedure. 

The macro takes no arguments.  It scans the current buffer for the RCS keyword '$Header:$' and finds the base revision of the file.  It grabs the base revision of the file and copies it to the TEMP directory.  It then uses the SlickEdit diff tool to compare the current buffer to the base revision of the file in the TEMP directory.

To do the requested code review, I load all the modified files for review in SlickEdit and run the macro on each buffer.  The base revision is automatically detected and retrieved and the diff is performed.  What used to take me several minutes per file now takes seconds.

The macro has been verified on SlickEdit v16.  It is currently configured for Perforce and requires p4.exe to be in the PATH.  It also requires that RCS keyword expansion is enabled for the file in question.


sevenofeights

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Diff current buffer versus SCM version of the file
« Reply #1 on: October 28, 2011, 12:14:58 AM »
I opened the macro in a different text editor prior to submitting, which mangled it.  Please use the attached macro.

lclevesy

  • Guest
Re: Diff current buffer versus SCM version of the file
« Reply #2 on: October 28, 2011, 01:37:30 PM »
Thank you for your submission. It is in the running for the iPad!

The winner will be announced via our Facebook page https://www.facebook.com/slickedit, Twitter page http://www.twitter.com/slickedit, and on this forum under the main SlickEdit October Macros Challenge Rules & How to Enter post http://community.slickedit.com/index.php/topic,7327.0.html on November 7, 2011.

lclevesy

  • Guest
Re: Diff current buffer versus SCM version of the file
« Reply #3 on: November 01, 2011, 03:09:47 PM »
We'll be announcing the winner of the iPad 2 on November 7th. Until then, your submission has earned a SlickEdit t-shirt! Email your size and address to marketing@slickedit.com to receive one. 

Phileosophos

  • Community Member
  • Posts: 37
  • Hero Points: 0
Re: Diff current buffer versus SCM version of the file
« Reply #4 on: November 07, 2011, 09:34:56 PM »
First, thanks to sevenofeights for posting almost exactly the macro I needed to make my life easier at my day job. Second, I've tweaked it for my particular case, in which separate separate file and revision tags are used instead of the header tag. I'm attaching the tweaked version to this post in case it will be of use to anyone. Cheers!