You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by v4r4n <co...@gmail.com> on 2004/10/25 23:40:33 UTC

color coded diff viewer

Is anyone out there using an editor (like emacs) to view svn diff
output from a file in a color coded format so that it is easier to
tell what was added from what was subtracted when faced many lines of
'diff' data?

I know my emacs, by default, recognizes c, c++, php, etc. so what
would I need to add to my .emacs file to have it recognize a .diff
file and format it according to a color scheme?

[I've tried and failed at doing stuff like this in the past, which is
why I'm posting the question to the users group.]

~Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Max Bowsher <ma...@ukf.net>.
v4r4n wrote:
> Is anyone out there using an editor (like emacs) to view svn diff
> output from a file in a color coded format so that it is easier to
> tell what was added from what was subtracted when faced many lines of
> 'diff' data?
> 
> I know my emacs, by default, recognizes c, c++, php, etc. so what
> would I need to add to my .emacs file to have it recognize a .diff
> file and format it according to a color scheme?
> 
> [I've tried and failed at doing stuff like this in the past, which is
> why I'm posting the question to the users group.]

Does emacs really not just do this already?

In vim, all I have to do is turn on syntax highlighting.

Max.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Duncan Murdoch <mu...@stats.uwo.ca>.
On Fri, 29 Oct 2004 17:40:13 -0400, Matt Pounsett
<ma...@cira.ca> wrote:

>
>On Oct 26, 2004, at 18:24, v4r4n wrote:
>
>> I guess no one has bothered to 'colorize' their diff output??
>
>svn diff foo.c | vim -R -
>
>works for me.. I get nicely syntax-highlighted diff output.
>
>Note that this requires that you're using a colour-capable term type, 
>and that your editor of choice recognizes that term type and does 
>colour syntax highlighting.  This should work equally well on a Windows 
>machine with win32 vim installed, as it uses the same syntax rules 
>everywhere.

Sorry if I'm jumping in a bit late here, but for Windows users who
aren't using Emacs, a very nice diff utility is Beyond Compare.  It's
shareware (see www.scootersoftware.com), but cheap ($30) and very
good. 

I've defined a bash script in Cygwin to run BC on my working copy,
comparing it to the repository, and it does a great job.  The script
is really simple:

>#!/bin/sh
>svn cat $* >.repos
>until [ $# -le 1 ]
>do
>  shift
>done
>"/cygdrive/F/Program files/Beyond Compare 2/BC2.exe" .repos $1
>rm .repos

and it gets BC to do a side-by-side colorized comparison of the two
files, showing me all the changes I've made, as a check before I
commit.  BC can do lots of other comparison operations too.  

Duncan Murdoch

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Matt Pounsett <ma...@cira.ca>.
On Oct 29, 2004, at 18:35, v4r4n wrote:

>> svn diff foo.c | vim -R -
>
> While I like those colors better than the emacs 'greys', keywords like
> 'int' 'static' 'if' 'else', function names, strings, and comments
> still aren't recognized and color coded as if I was viewing a plain .c
> file.

That's because you aren't viewing a C file.. you're viewing a diff.  
The syntax highlighting is geared towards that.  If you want to combine 
them, you'd have to somehow write a syntax definition that can identify 
when you're looking at a diff of C code, and highlight appropriately.  
Probably not worth the effort, but that's up to you.


Matt Pounsett                   Canadian Internet Registration Authority
Technical Support Programmer               350 Sparks Street, Suite 1110
matt.pounsett@cira.ca                            Ottawa, Ontario, Canada
613.237.5335 ext. 231                                 http://www.cira.ca


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by v4r4n <co...@gmail.com>.
> svn diff foo.c | vim -R -

While I like those colors better than the emacs 'greys', keywords like
'int' 'static' 'if' 'else', function names, strings, and comments
still aren't recognized and color coded as if I was viewing a plain .c
file.

When I rename the diff output as a .c file keywords are recognized,
but the new and old code isn't highlighted.

It is probably asking for too much, but, there should be enough colors
to do both at the same time.


On Fri, 29 Oct 2004 17:40:13 -0400, Matt Pounsett <ma...@cira.ca> wrote:
> 
> On Oct 26, 2004, at 18:24, v4r4n wrote:
> 
> > I guess no one has bothered to 'colorize' their diff output??
> 
> svn diff foo.c | vim -R -
> 
> works for me.. I get nicely syntax-highlighted diff output.
> 
> Note that this requires that you're using a colour-capable term type,
> and that your editor of choice recognizes that term type and does
> colour syntax highlighting.  This should work equally well on a Windows
> machine with win32 vim installed, as it uses the same syntax rules
> everywhere.
> 
> --
> Matt Pounsett                   Canadian Internet Registration Authority
> Technical Support Programmer               350 Sparks Street, Suite 1110
> matt.pounsett@cira.ca                            Ottawa, Ontario, Canada
> 613.237.5335 ext. 231                                 http://www.cira.ca
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Matt Pounsett <ma...@cira.ca>.
On Oct 26, 2004, at 18:24, v4r4n wrote:

> I guess no one has bothered to 'colorize' their diff output??

svn diff foo.c | vim -R -

works for me.. I get nicely syntax-highlighted diff output.

Note that this requires that you're using a colour-capable term type, 
and that your editor of choice recognizes that term type and does 
colour syntax highlighting.  This should work equally well on a Windows 
machine with win32 vim installed, as it uses the same syntax rules 
everywhere.


--
Matt Pounsett                   Canadian Internet Registration Authority
Technical Support Programmer               350 Sparks Street, Suite 1110
matt.pounsett@cira.ca                            Ottawa, Ontario, Canada
613.237.5335 ext. 231                                 http://www.cira.ca


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Martin Ginkel <mg...@mpi-magdeburg.mpg.de>.
Niels Skou Olsen wrote:
>>"M-x ediff-buffers or ediff-files" is something I'll try to remember
>>but it also looks like something I would have used if I was using CVS
>>or something other than SVN that actually kept duplicate hard copies
>>of everything.

No. for Emacs there is psvn. This has diff-viewing options,
that actually download the repos-version and compare it to your working 
copy. (M-x svn-status and E on the file in question)
This does syntax-higlighting according to the current language mode.

I guess, you can tweak it to show other diffs too.

	CU
	Martin

-- 
+-[Martin Ginkel]-------------[mailto:mginkel(at)mpi-magdeburg.mpg.de]-+
| MPI Magdeburg, Zi S2.09    Sandtorstr. 1, D-39106 Magdeburg, Germany |
| Start a download. Get a coffee. Multitasking.                        |
|                                                                      |
+-[tel/fax: +49 391 6110 482/529]----[http://www.mpi-magdeburg.mpg.de]-+


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Niels Skou Olsen <ns...@manbw.dk>.
v4r4n <co...@gmail.com> writes:

[...]

>> > Emacs ediff also wasn't adding actuall color to the code, just tints of grey.
>> 
>> What version of Emacs/ediff are you using? Ediff gives me both colorized
>> code lines *and* diff markings. This works on a windows machine with either
>> Emacs 21.3.1 or the current CVS version 21.3.50.1.

[...]

> Ya, I'm using 21.2.1 still.  I guess the easiest thing to do would be
> to upgrade my Emacs.

If you go for the CVS version you will have the added convenience of the VC
package with (basic) Subversion support, including the wonderfully
convenient `ediff-revision'. 

Another interesting item is the psvn.el, which provides access to more
Subversion specific functionality. Download the latest revision here:

  http://svn.collab.net/viewcvs/svn/trunk/contrib/client-side/psvn/psvn.el

Best regards,

Niels
-- 
Niels Skou Olsen, M.Sc.
Intelligent Engine, R&D
MAN B&W Diesel A/S

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by v4r4n <co...@gmail.com>.
Ya, I'm using 21.2.1 still.  I guess the easiest thing to do would be
to upgrade my Emacs.

~Thanks


On Tue, 02 Nov 2004 15:23:58 +0100, Niels Skou Olsen <ns...@manbw.dk> wrote:
> v4r4n <co...@gmail.com> writes:
> 
> [...]
> 
> > "M-x ediff-buffers or ediff-files" is something I'll try to remember
> > but it also looks like something I would have used if I was using CVS
> > or something other than SVN that actually kept duplicate hard copies
> > of everything.
> >
> > Emacs ediff also wasn't adding actuall color to the code, just tints of grey.
> 
> What version of Emacs/ediff are you using? Ediff gives me both colorized
> code lines *and* diff markings. This works on a windows machine with either
> Emacs 21.3.1 or the current CVS version 21.3.50.1.
> 
> Are you sure have a color monitor? ;-)
> 
> Best regards,
> Niels
> --
> Niels Skou Olsen, M.Sc.
> Intelligent Engine, R&D
> MAN B&W Diesel A/S
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by Niels Skou Olsen <ns...@manbw.dk>.
v4r4n <co...@gmail.com> writes:

[...]

> "M-x ediff-buffers or ediff-files" is something I'll try to remember
> but it also looks like something I would have used if I was using CVS
> or something other than SVN that actually kept duplicate hard copies
> of everything.
>
> Emacs ediff also wasn't adding actuall color to the code, just tints of grey.

What version of Emacs/ediff are you using? Ediff gives me both colorized
code lines *and* diff markings. This works on a windows machine with either
Emacs 21.3.1 or the current CVS version 21.3.50.1.

Are you sure have a color monitor? ;-)

Best regards,
Niels
-- 
Niels Skou Olsen, M.Sc.
Intelligent Engine, R&D
MAN B&W Diesel A/S

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: color coded diff viewer

Posted by v4r4n <co...@gmail.com>.
Sorry, I actually asked this from a windows machine before testing it
on the linux system.

The current system I'm using does add tints of grey to highlight
changes, but it doesn't attempt to recognize the actual code, so I'm
still staring at lots of black text.

Both *.dif and *.diff are recognized as something other than the diff
output of svn.  The menu provides options to "jump to source" - which
of course doesn't work.

"M-x ediff-buffers or ediff-files" is something I'll try to remember
but it also looks like something I would have used if I was using CVS
or something other than SVN that actually kept duplicate hard copies
of everything.

Emacs ediff also wasn't adding actuall color to the code, just tints of grey.

I guess no one has bothered to 'colorize' their diff output??

~Thanks

On Tue, 26 Oct 2004 08:11:38 +0200, Martin Ginkel
<mg...@mpi-magdeburg.mpg.de> wrote:
> v4r4n wrote:
> > Is anyone out there using an editor (like emacs) to view svn diff
> > output from a file in a color coded format so that it is easier to
> > tell what was added from what was subtracted when faced many lines of
> > 'diff' data?
> 
> Ever tried M-x ediff-buffers or ediff-files?
> Emacs needs the 2 plain text versions and shows you everything in
> colored diff regions.
> 
>         HTH
>         Martin
> 
> --
> +-[Martin Ginkel]-------------[mailto:mginkel(at)mpi-magdeburg.mpg.de]-+
> | MPI Magdeburg, Zi S2.09    Sandtorstr. 1, D-39106 Magdeburg, Germany |
> | It could be that the purpose of life is serving as warning to others |
> |                                                                      |
> +-[tel/fax: +49 391 6110 482/529]----[http://www.mpi-magdeburg.mpg.de]-+
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org