A Useful CVS Status Checker

cvs status 2>/dev/null | grep Status: | grep -v "to-date"

That’s what I use on the command line to see which files aren’t up to date within my CVS tree at work (at home I use SVN, which in my opinion is a lot nicer).

If you’re interested, here’s what each bit of that command does:

  1. cvs status just does the normal CVS command to tell you the status of each file
  2. 2>/dev/null pushes any “error” messages out to /dev/null so that you don’t see them. In this case, that includes things like telling you which directory you’re traversing into. For me, this is extraneous data that I don’t want, but your mileage may vary.
  3. | grep Status pipes the previous ouput through grep and only leaves lines which contain the text “Status:”, so we’re only left with lines with status information on them.
  4. | grep -v "to date" pipes the remaining output through grep, inverts the way grep works (-v) and throws away any lines that say they’re up to date.
  5. So, we’re simply left with lines that contain status information but aren’t about files that are up to date. This can include files that need to be patched, merged or committed.

UPDATE:

cvs -q status | grep ^[?F] | grep -v "to-date"

This does the same job in a few less bytes, and it shows up files which haven’t yet been added to the repository.

Mac users might also like to add the following to their ~/.cvsignore files to ignore those pesky files that OS X seems so intent on creating:

._*
.DS_Store

permalink | View blog reactions

other relevant pages

about wwm

workingwith.me.uk is a resource for web developers created by Neil Crosby, a web developer who lives and works in London, England. More about the site.

Neil Crosby now blogs at The Code Train and also runs NeilCrosby.com, The Ten Word Review and Everything is Rubbish.