query tool for cvs

The problem is cvs doesn't support changesets very well. So if you want to back out a change or review a patch after the fact, it can involve chasing down all the individual files' revs one by one. This is a little tool to help with that. Download

It works off a sqlite database that I've built by reconstructing changesets. There's a few basic commands.

cvsinfo search will search commit messages for the text entered after and print out the 15 latest changesets that match. You can also restrict the search by using author:, file: (exact match), or path: (substring match).

cvsinfo patch takes either a changeset ID or a filename and revision. It prints out the entirety of the patch for all the files. CVS keyword expansion is suppressed so the diff applies cleanly to more revisions.

cvsinfo unpatch prints out the reverse patch for a changeset, making it easy to revert changes. It looks like a patch, with the word "Backout!" prepended.

There is also an info command, which is like patch but only prints the same basic info as a search does.

None of the commands alter any files locally.

The patch and unpatch commands shell out to cvs, which will hit the cvs server, but searching is done entirely locally against the database.

cvsinfo looks for cvsinfo.db in the current directory, and assumes it is run from the top of the source tree. I have two prebuilt databases, one for src and one for sys.

cvsinfo is written in Lua. You also need LuaDBI and my luatil library.

DBs to download (unzip before using):

Updated 2010/12/19

Examples:

~/src> cvsinfo search clang
===========================================================================
Changeset: 770675e61d3004c049cda60da2182310474c56de2c0333c8278bffd53be39f5e
Author: krw
Date: 2010/03/29 23:33

Initialize various uninitialized variables. Found by jsg@ via Clang.

Feedback from miod@ and kettenis@.

ok beck@

sys/dev/ic/cac.c                                            1.36
sys/dev/ic/gdt_common.c                                     1.49
sys/dev/ic/pgt.c                                            1.57
sys/dev/ic/twe.c                                            1.35
sys/msdosfs/msdosfs_denode.c                                1.38
sys/nfs/nfs_serv.c                                          1.90
sys/nfs/nfs_vnops.c                                         1.128
sys/ufs/ffs/ffs_softdep.c                                   1.102
...
===========================================================================
Changeset: f6d00d6e7483f571c827bcb5dd41a1a2ce6e7417b786793be1f8ca195442ca0c
Author: martinh
Date: 2010/07/01 03:47

Fix two possible null pointer assignments in the error path.
found by clang static analyzer

usr.sbin/ldapd/schema.c                                     1.4

~/src/sys> cvsinfo patch dev/acpi/acpi.c 1.171
Changeset: 3d4d10609df7502b59780b7921c06d5be33551c49d4a12dbc0ade8bef1d0f59a
Author: deraadt
Date: 2010/07/06 20:14

Don't use a workq to do the suspend, because it races aginst the acpi
thread.  Instead, just tell the acpi thread to do the suspend for us.
This makes apmd & zzz work correctly.  While here, have acpithinkpad
attempt to post the event to apm before prompting the suspend itself.
ok kettenis marco mlarkin

Index: dev/acpi/acpi.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/acpi/acpi.c,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -u -r1.170 -r1.171
--- dev/acpi/acpi.c     5 Jul 2010 05:59:01 -0000       1.170
+++ dev/acpi/acpi.c     6 Jul 2010 20:14:17 -0000       1.171
...
Index: dev/acpi/acpithinkpad.c
...
Index: dev/acpi/acpivar.h
===================================================================
RCS file: /home/tedu/cvs/src/sys/dev/acpi/acpivar.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -u -r1.57 -r1.58
--- dev/acpi/acpivar.h  7 Apr 2010 06:33:06 -0000       1.57
+++ dev/acpi/acpivar.h  6 Jul 2010 20:14:17 -0000       1.58
@@ -207,6 +207,8 @@
        int                     sc_powerbtn;
        int                     sc_sleepbtn;

+       int                     sc_sleepmode;
+
...

~/src/sys> cvsinfo unpatch 75d250639e6eddbda5596e5d9845f6de5b34f8f0b9ac484f3d6815726cd8a963
Backout!
Changeset: 75d250639e6eddbda5596e5d9845f6de5b34f8f0b9ac484f3d6815726cd8a963
Author: miod
Date: 2010/07/03 20:28

Be sure to initialize b_bq member of struct buf not allocated through the
regular buf routines; and now we can swap again.

Index: uvm/uvm_swap.c
===================================================================
RCS file: /home/tedu/cvs/src/sys/uvm/uvm_swap.c,v
retrieving revision 1.94
retrieving revision 1.93
diff -u -u -r1.94 -r1.93
--- uvm/uvm_swap.c      3 Jul 2010 20:28:51 -0000       1.94
+++ uvm/uvm_swap.c      1 Jul 2010 19:48:05 -0000       1.93
@@ -1336,7 +1336,6 @@
                nbp->vb_buf.b_bufsize  = sz;
                nbp->vb_buf.b_error    = 0;
                nbp->vb_buf.b_data     = addr;
-               nbp->vb_buf.b_bq       = NULL;
                nbp->vb_buf.b_blkno    = nbn + btodb(off);
                nbp->vb_buf.b_proc     = bp->b_proc;
                nbp->vb_buf.b_iodone   = sw_reg_iodone;
@@ -1950,7 +1949,6 @@
                bp->b_data = (caddr_t)bouncekva;
        else
                bp->b_data = (caddr_t)kva;
-       bp->b_bq = NULL;
        bp->b_blkno = startblk;
        LIST_INIT(&bp->b_dep);
        s = splbio();
That's all.