Esempio n. 1
0
def am_txns(ctx):
    "transactions"
    cur = ctx.txns_db.cursor()
    try:
        print("next-key: %s" % ctx.txns_db['next-key'])
        length = 1
        found_some = True
        while found_some:
            found_some = False
            rec = cur.first()
            while rec:
                if rec[0] != 'next-key' and len(rec[0]) == length:
                    found_some = True
                    txn = skel.Txn(rec[1])
                    if txn.kind == "committed":
                        label = "r%s" % txn.rev
                        ok(ctx.txn2rev[rec[0]] == int(txn.rev),
                           'Txn->rev not <-txn')
                    else:
                        label = "%s based-on %s" % (txn.kind, txn.basenode)
                    print("txn %s: %s root-node %s props %d copies %s" %
                          (rec[0], label, txn.rootnode, len(txn.proplist) / 2,
                           ",".join(txn.copies)))
                rec = cur.next()
            length += 1
    finally:
        cur.close()
Esempio n. 2
0
def main():
    progname = os.path.basename(sys.argv[0])
    if len(sys.argv) >= 3:
        dbhome = os.path.join(sys.argv[1], 'db')
        if not os.path.exists(dbhome):
            sys.stderr.write("%s: '%s' is not a valid svn repository\n" %
                             (sys.argv[0], dbhome))
            sys.stderr.flush()
            sys.exit(1)
        rep_ids = sys.argv[2:]
    else:
        sys.stderr.write("Usage: %s <svn-repository> <rep-id>...\n" % progname)
        sys.stderr.flush()
        sys.exit(1)

    print("%s running on repository '%s'" % (progname, dbhome))
    print("")
    rep_ids = dict.fromkeys(rep_ids)
    ctx = svnfs.Ctx(dbhome)
    try:
        cur = ctx.nodes_db.cursor()
        try:
            rec = cur.first()
            while rec:
                if rec[0] != 'next-key':
                    nid, cid, tid = rec[0].split(".")
                    nd = skel.Node(rec[1])
                    if nd.datarep in rep_ids:
                        rev = skel.Txn(ctx.txns_db[tid]).rev
                        print("%s: data of '%s%s' in r%s" %
                              (nd.datarep, nd.createpath, {
                                  "dir": '/',
                                  "file": ''
                              }[nd.kind], rev))
                    if nd.proprep in rep_ids:
                        rev = skel.Txn(ctx.txns_db[tid]).rev
                        print("%s: properties of '%s%s' in r%s" %
                              (nd.datarep, nd.createpath, {
                                  "dir": '/',
                                  "file": ''
                              }[nd.kind], rev))
                rec = cur.next()
        finally:
            cur.close()
    finally:
        ctx.close()