To find out what userland version you're running, you can do cat /etc/release.

On a daily snapshot of NetBSD 4.0 BETA2, that results in the following for example:

$ cat /etc/release
NetBSD 4.0_BETA2/amd64

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

Build settings:
          Build date   Sun Aug 26 03:02:56 UTC 2007
            Built by   builds@wb28

           BSDOBJDIR = '/usr/obj'
           BSDSRCDIR = '/usr/src'
             BUILDID = '200708250002Z'
             DESTDIR = '/home/builds/ab/netbsd-4/amd64/200708250002Z-dest'
  EXTERNAL_TOOLCHAIN = (undefined)
            HAVE_GCC = '4'
            HAVE_GDB = '5'
     INSTALLWORLDDIR = (undefined)
         KERNARCHDIR = 'arch/amd64'
         KERNCONFDIR = '/home/builds/ab/netbsd-4/src/sys/arch/amd64/conf'
          KERNOBJDIR = '/home/builds/ab/netbsd-4/amd64/200708250002Z-obj/home/builds/ab/netbsd-4/src/sys/arch/amd64/compile'
          KERNSRCDIR = '/home/builds/ab/netbsd-4/src/sys'
             MACHINE = 'amd64'
        MACHINE_ARCH = 'x86_64'
                MAKE = '/home/builds/ab/netbsd-4/amd64/200708250002Z-tools/bin/nbmake'
            MAKECONF = '/home/builds/etc/make.conf'
           MAKEFLAGS = ' -d e -m /home/builds/ab/netbsd-4/src/share/mk 
-d e -m /home/builds/ab/netbsd-4/src/share/mk -j 1 
-J 15,16 HOST_OSTYPE=NetBSD-4.0_BETA2-i386 MKOBJDIRS=yes
 NOPOSTINSTALL=1 USETOOLS=yes _SRC_TOP_=/home/builds/ab/netbsd-4/src 
_SRC_TOP_OBJ_=/home/builds/ab/netbsd-4/amd64/200708250002Z-obj/home/builds/ab/netbsd-4/src _THISDIR_=etc/'
          MAKEOBJDIR = (undefined)
    MAKEOBJDIRPREFIX = '/home/builds/ab/netbsd-4/amd64/200708250002Z-obj'
         MAKEVERBOSE = '0'
               MKBFD = 'yes'
          MKCATPAGES = 'yes'
            MKCRYPTO = 'yes'
       MKCRYPTO_IDEA = 'no'
       MKCRYPTO_MDC2 = 'no'
        MKCRYPTO_RC5 = 'no'
               MKCVS = 'yes'
             MKDEBUG = 'no'
          MKDEBUGLIB = 'no'
               MKDOC = 'yes'
       MKDYNAMICROOT = 'yes'
               MKGCC = 'yes'
           MKGCCCMDS = 'yes'
               MKGDB = 'yes'
            MKHESIOD = 'yes'
           MKHOSTOBJ = (undefined)
              MKHTML = 'yes'
            MKIEEEFP = 'yes'
             MKINET6 = 'yes'
              MKINFO = 'yes'
          MKIPFILTER = 'yes'
          MKKERBEROS = 'yes'
           MKLINKLIB = 'yes'
              MKLINT = 'yes'
               MKMAN = 'yes'
              MKMANZ = 'no'
               MKNLS = 'yes'
               MKOBJ = 'yes'
           MKOBJDIRS = 'yes'
               MKPAM = 'yes'
                MKPF = 'yes'
               MKPIC = 'yes'
        MKPICINSTALL = 'yes'
            MKPICLIB = 'yes'
           MKPOSTFIX = 'yes'
           MKPROFILE = 'yes'
             MKSHARE = 'yes'
              MKSKEY = 'yes'
         MKSOFTFLOAT = 'no'
         MKSTATICLIB = 'yes'
          MKUNPRIVED = 'yes'
            MKUPDATE = 'yes'
              MKUUCP = (undefined)
               MKX11 = 'yes'
                MKYP = 'yes'
          NBUILDJOBS = (undefined)
        NETBSDSRCDIR = '/home/builds/ab/netbsd-4/src'
          NOCLEANDIR = (undefined)
       NODISTRIBDIRS = (undefined)
          NOINCLUDES = (undefined)
          OBJMACHINE = (undefined)
          RELEASEDIR = '/home/builds/ab/netbsd-4/amd64/200708250002Z-rlse'
   TOOLCHAIN_MISSING = 'no'
             TOOLDIR = '/home/builds/ab/netbsd-4/amd64/200708250002Z-tools'
            USETOOLS = 'yes'
      USR_OBJMACHINE = (undefined)
           X11SRCDIR = '/home/builds/ab/netbsd-4/xsrc'

If you're running a mix and match of userland, kernel, and individual userland apps with cherry-picked CVS revisions, the ?ident program may be used to find the revisions of the individual source files a binary was composed of:

$ ident `which which`                      
/usr/bin/which:
     $ NetBSD: crt0.c,v 1.4 2004/08/26 21:23:06 thorpej Exp $
     $ NetBSD: whereis.c,v 1.18 2006/07/30 11:50:29 martin Exp $