However, CVS does not seem to have a nice compact command for displaying the status of files in a checkout like SVN or git do. cvs status is way too verbose, and the network latency makes it slow.
Portage has a nice little module called "cvstree" that it uses to parse the CVS/Entries files directly and generates a convenient data structure in memory.
So, I wrote a little wrapper that produces output in the style of the svn status command:
cvs-status#!/usr/bin/env python
from __future__ import print_function
from portage import cvstree
myentries = cvstree.getentries(mydir=".", recursive=1)
mynew = cvstree.findnew(entries=myentries, recursive=1)
mychanged = cvstree.findchanged(entries=myentries, recursive=1)
mymissing = cvstree.findmissing(entries=myentries, recursive=1)
myunadded = cvstree.findunadded(entries=myentries, recursive=1)
myremoved = cvstree.findremoved(entries=myentries, recursive=1)
for x in mynew:
print('A ', x)
for x in mychanged:
print('M ', x)
for x in mymissing:
print('! ', x)
for x in myunadded:
print('? ', x)
for x in myremoved:
print('D ', x)This produces output like this:
floppym@naomi gentoo-x86 % cvs-status ! net-p2p/freenet/files/freenet.old ? .ebuild.x ? metadata/herds.xml ? profiles/use.local.desc
That first entry is actually a small bug in the cvstree module: it does not handle the case where an ignored file is actually under version control.
Maybe some of my fellow devs will find this useful.
Oh you were so right, thanks for the script.
ReplyDeletejustin