Annoyance, colored diffs in perforce
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.
Comments
4 Responses to “Annoyance, colored diffs in perforce”
Leave a Reply
About the author
Lee Hinman is a software developer for a large storage company. Feel free to email me at lee [at] writequit [dot] org. If you do contact me, I highly recommend that you use some sort of encryption.
I enjoy doing software development, security research and writing tools and libraries (mostly in Clojure or Ruby).-
My links on del.icio.us
Tumblr
Look me up on Twitter
Get a copy of my gpg public key
AIM: thnetos
Yahoo: okenezak
Join me on irc in #rawpacket on Freenode! Pages
Recent Comments
- » links for 2010-09-01 (Dhananjay Nene) on How I develop Clojure with Vim
- How I develop Clojure with Vim : :wq – blog on Automatically fold Clojure methods in Vim
- Arnaud Meuret on How to run FastRI on Ruby 1.9.1
- Arnaud Meuret on How to run FastRI on Ruby 1.9.1
- Leonardo Valeri Manera on How to run FastRI on Ruby 1.9.1
Twitter feed:- thnetos: @technomancy The interesting parts of your setup are on Amazon? Is that the right link?
- thnetos: @fiftyfootshadow minor bug report for youdisappear.net, http://i.imgur.com/JOGw0.png
- thnetos: @stuartsierra GNU Screen? :)
- thnetos: @fogus Yea, I was underwhelmed by it also.
- thnetos: Consider me... SO TROLLED: http://pastie.org/1110154 /sarcasm. Warning: minor language.
On Tumblr
Latest del.icio.us links:
Recet last.fm tracksArchives
- August 2010
- April 2010
- March 2010
- February 2010
- December 2009
- October 2009
- August 2009
- July 2009
- June 2009
- May 2009
- March 2009
- January 2009
- December 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
Blog categories
- 0.6
- 1.0.3
- 1.9
- 1.9.1
- 1280×800
- 2.0
- about
- account
- aim
- aimsnarf
- analysis
- apple
- appspot
- apr-gdbm
- argus
- arp
- arpwatch
- ars technica
- asm
- assembly
- asus
- author
- automation
- backdoor
- backup
- base64
- bash
- benchmark
- binary
- blade
- blog
- blogging
- book
- books
- bootstrap
- bridge
- bro-ids
- browser
- bsd
- bsddb
- business
- calendar
- capinfos
- catalyst
- cbench
- cell
- cell phones
- cert
- challenge
- chaosreader
- checkip
- christianity
- christmas
- ciosim
- cisco
- clamav
- clamscan
- clariion
- clojure
- collaboration
- color
- column
- compile
- compiling
- configuration
- console
- crash
- creative commons
- csv
- ctf
- customer
- cvs
- db42
- dc303
- decode
- defcon
- deobfuscation
- desktop
- development
- disass
- disassemble
- disassembly
- dns
- dotfiles
- download
- drbd
- dsniff
- dump
- easytimeline
- eatables
- eclim
- eee
- eeepc
- encode
- engineering
- error
- estraier
- ettercap
- exploit
- failover
- family
- fastri
- fetchmail
- fink
- firefox
- firewall
- fix
- fl0p
- flash
- flow
- flowtag
- flowtime
- fluxbox
- folding
- foremost
- forensic
- forensics
- forkify
- framework
- free
- freebsd
- fri
- fud
- fun
- fuzzymatch
- gcal
- geek00l
- geekery
- gem
- git
- github
- gmail
- greader
- gtalk
- gtd
- gvim
- gzip
- hacking
- hardware
- harimau
- hash
- heartbeat
- hex
- honeypot
- honeysnap
- hosting
- hyperestraier
- ical
- ida
- ide
- ids
- iframe
- im
- imprec
- index
- infosec
- install
- internet
- ip
- ip2asn
- ipfw
- iploc
- ipv6
- irc
- iscsi
- iso
- issa
- java
- javascript
- jonathan
- js
- kernel
- keyboard
- kiddie
- laptop
- leopard
- lgpl
- licensing
- lighttpd
- links
- linux
- livecd
- locality
- location
- locator
- log
- logfile
- lordpe
- mac
- macbook
- macports
- makefile
- malware
- mantis
- md5
- meetup
- microsoft110.exe
- module
- moleskine
- monitoring
- monkey
- monkeypatch
- mov
- mutt
- muttator
- mvc
- mysql
- netbook
- network
- networking
- newsbeuter
- ngrep
- nlp
- nmap
- non-technical
- nsm
- nsm console
- obfuscation
- oep
- ollydbg
- opennlp
- opensource
- osx
- p0f
- package
- packages
- packet
- panic
- paper
- parallels
- part 1
- passive
- patch
- pcap
- peid
- perforce
- perl
- phfos
- phishing
- phone
- php
- plot
- ploticus
- plugin
- plugins
- poisoning
- port
- privacy
- programming
- publish
- python
- qri
- quicksilver
- ra
- racount
- ragator
- rahosts
- raid
- rails
- rawpacket
- rebuild
- redhat
- reference
- release
- remind
- repl
- repne
- research
- resolution
- reverse
- review
- rinda
- roundup
- rss
- ruby
- rules
- safari
- sans
- scanning
- scasb
- scholar
- screen
- screencast
- script
- scroogle
- search
- security
- sequence
- sequential
- sha256
- shane claiborne
- shell
- sigint
- skiddie
- slicehost
- smp
- sniff
- sniffing
- snort
- software
- solaris
- source
- spaces
- spatial
- spoofing
- ssh
- stack
- stock
- stream
- stress
- strlen
- submission
- sun
- sup
- supertab
- svm
- svn
- switch
- sysadmin
- tap
- tcp
- tcpdstat
- tcpdump
- tcpflow
- tcpick
- tcptrace
- tcpxtract
- temporal
- terminal
- thread
- threads
- threats
- thunderbird
- timeline
- todo
- toolsmith
- trac
- trace-summary
- traffic
- trap
- tshark
- tuplespace
- tutorials
- ubuntu
- ubuntu-eee
- Uncategorized
- unix
- unpack
- upack
- upx
- urlescape
- vacation
- video
- vim
- vimperator
- vimrc
- virtualization
- visualization
- vm
- vmware
- wave
- web server
- website
- wget
- whitepaper
- window manager
- windows
- winupack
- wireshark
- wm
- wmii
- work
- wyrd
- x11
- xhide
- xorg
- xorg.conf
- yahoo
- yahsnarf
- yousif
- zfs
- zoomgo
- zsh



> 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.
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
If you want it even closer to a git diff, use unified mode:
p4 diff -du
Set the P4DIFF ennvironment variable to colordiff… a tool which colorizes diff output. For example:
export P4DIFF=colordiff; p4 diff -dU 5