vimdiff is fantastic. Follow these instructions to make subversion use vimdiff when you run svn diff
.
Get this diffwrap.sh script and save it anywhere. I saved mine in my $HOME/bin directory. Make sure to make it executable! I’m showing it below:
#!/bin/sh
# Configure your favorite diff program here.
DIFF="/usr/bin/vimdiff"
# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}
# Call the diff command (change the following line to make sense for
# your merge program).
$DIFF $LEFT $RIGHT
# Return an errorcode of 0 if no differences were detected, 1 if some were.
# Any other errorcode will be treated as fatal.
Then change your $HOME/.subversion/config file to point at that script:
[helpers]
diff-cmd = /home/matt/bin/diffwrap.sh
Then go diff a file!
See this section of the svn book for all the details.
Pingback: lojic.com » Blog Archive » Use vimdiff to display subversion diffs
Just what I was looking for – thanks for the tip!
great, but, any ideas on how to get the right pane to save changes over the top of your file if you move something from the repository version into your version? :\
Hi Joel, Yeah, I’ve wondered that myself too. I have no suggestions other than using :w to write out stuff to the file you want.
Let me know if you figure it out!
Thanks
i added this to my article site.
Thanks
kailis
______________________________________________
Colorado home loan | maui lodging | best e-cigarette
I think a few pictures might help this blog
regards
marshel
______________________________________________
debt consolidation firm | Prada Purses | Photo to portrait
Hello Mate, I would like to know more on this when is the next post comming
regards
harsel gibs
______________________________________________
Provo Homes | best bangkok hotel | medical billing software
I subscribed to your blog when is the next post
respect
poly banger
______________________________________________
Polywood | dog stroller | easy candy recipe
I posted your blog to my facebook group
Thanks
Davin saha
______________________________________________
Thanks for taking the time to discuss this,would you mind updating your blog with additional information? It is extremely helpful for me.
I've made an improved version of this wrapper script, which gives friendly names to the Vim buffers, and also makes Vim's syntax highlighting work (it breaks because the temporary files “svn diff” creates do not have the appropriate extension).
http://carlo-notes.blogspot.co…
Wow — nice work!
Oh thanks, i appriciate that!
Nice post! One question: how can I stop viewing diff files without the need for “:qa” until the last file changed? Thanks.
You're asking how to quit out of vim without having to close every single buffer, one by one?
I think you can use the :qall! thing to jump out quick. Not really sure about that. I have my F5 key mapped to :bd (buffer delete) so I just bang on F5 until I'm out.
Thanks for the feedback!
Thanks man! I changed /usr/bin/vimdiff to /usr/bin/env vimdiff because I compiled vim locally.
Glad to hear it helped!
Awesome! I was able to set it up without any hiccups, it works like a charm. Thanks!
That’s great! Glad it helped.
Thanks you man. It helped. All I want to add that inside ~/.subversion/config file character `~` is not expanded to $HOME. It is recommended to pass the full path of the script or to keep the script in $PATH.
Is there a way to make this automatically switch to the old spew-the-diff-to-the-terminal mode when piping or redirecting the output to a file? That’d be really nice for patch creation (rather than having to do `svn diff –diff-cmd=…` every time for that).
I ran into that problem plenty too! I created these two aliases in my ~/.bashrc file:
alias boringdiff=’svn diff –diff-cmd=/usr/bin/diff’
alias prettydiff=’svn diff –diff-cmd=$HOME/bin/diffwrap.sh’
Then I commented out the line in the .subversion/config file.
I hope that helps!
The right side of the diff is the not the editable file but some temp file . Need help !!