Quick one-off here, let’s begin.
Git has nice colored diffs, like this:
Perforce does not:
A simple script can remedy this:
Here’s the script:
Simply drop it somewhere in your $PATH and use it like so:
p4 diff | p4c.rb
You can find it in my one-offs directory (it’s called p4c.rb). We recently switched from subversion to perforce (definitely not my choice, I pushed for git), and so far it’s awful. I am definitely not a fan. This makes it a little better.
bartman wrote:
> We recently switched from subversion to perforce (definitely not my choice, I pushed for git).
Hehe… I had the same thing happen to me recently. My solution was to start using git-p4, as I had been using git-svn before. Give it a try, it’s actually pretty good… albeit slower then git-svn.
Link | February 1st, 2010 at 7:39 pm
bartman wrote:
Oh, one more thing.
Since your blog is titled :wq … I imagine you use vim. Why not let vim color your diffs?
p4 diff | vim -R –
I keep this handy shell function around:
v() { $@ | vim -R – ; }
So I can simplify the above as:
v p4 diff
… well, if I actually ever wanted to run p4 directly
Link | February 1st, 2010 at 7:41 pm
David wrote:
If you want it even closer to a git diff, use unified mode:
p4 diff -du
Link | March 12th, 2010 at 1:15 pm
Eric wrote:
Set the P4DIFF ennvironment variable to colordiff… a tool which colorizes diff output. For example:
export P4DIFF=colordiff; p4 diff -dU 5
Link | May 26th, 2010 at 11:43 am
tfi fridays wrote:
I am starting to take my feet on associate packages too, so this text is excellent place to begin! Shared it on Stumbleupon and submitted on Digg
Link | October 25th, 2011 at 12:47 am
Let vim colorize p4 diff | parseInt('010') wrote:
[…] to know this today from here. Share this:TwitterFacebookLinkedInLike this:LikeBe the first to like this post. This entry was […]
Link | February 2nd, 2012 at 11:32 am
Jason wrote:
Thanks, very handy.
Link | August 9th, 2013 at 8:11 am