Megatest

Check-in [67a802fc2e]
Login
Overview
Comment:First pass on revtag tool
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.55
Files: files | file ages | folders
SHA1: 67a802fc2e87702793540a3e6d61f90321a04272
User & Date: mrwellan on 2013-09-05 17:36:51
Other Links: branch diff | manifest | tags
Context
2013-09-09
10:12
Fixed issue with run event_time being reset when test was rerun check-in: aaa8f2a3d5 user: mrwellan tags: v1.55
2013-09-05
17:36
First pass on revtag tool check-in: 67a802fc2e user: mrwellan tags: v1.55
00:30
Got title of zeroth column working, not all consequences handled yet (I suspect) check-in: be362b3b7e user: matt tags: v1.55
Changes

Modified Makefile from [bc20ab1870] to [269d99e807].

33
34
35
36
37
38
39



40
41
42
43
44
45
46
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49







+
+
+








dboard : $(OFILES) $(GOFILES) dashboard.scm
	csc $(OFILES) dashboard.scm $(GOFILES) -o dboard

newdboard : newdashboard.scm $(OFILES) $(GOFILES)
	csc $(OFILES) $(GOFILES) newdashboard.scm -o newdboard

$(PREFIX)/bin/revtagfsl : utils/revtagfsl.scm
	csc utils/revtagfsl.scm -o $(PREFIX)/bin/revtagfsl

deploytarg/libiupcd.so : $(CKPATH)/lib/libiupcd.so
	for i in iup im cd av call sqlite; do \
	  cp $(CKPATH)/lib/lib$$i* deploytarg/ ; \
	done
	cp $(CKPATH)/include/*.h deploytarg

# puts deployed megatest in directory "megatest"
120
121
122
123
124
125
126
127

128
129
130
131
132
133
134
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137







-
+







# install dashboard as dboard so wrapper script can be called dashboard
$(PREFIX)/bin/dboard : dboard $(FILES)
	$(INSTALL) dboard $(PREFIX)/bin/dboard
	utils/mk_wrapper $(PREFIX) dboard > $(PREFIX)/bin/dashboard
	chmod a+x $(PREFIX)/bin/dashboard

install : bin $(PREFIX)/bin/mtest $(PREFIX)/bin/megatest $(PREFIX)/bin/dboard $(PREFIX)/bin/dashboard $(HELPERS) $(PREFIX)/bin/nbfake \
          $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdboard $(PREFIX)/bin/refdb $(PREFIX)/bin/mt_xterm
          $(PREFIX)/bin/nbfind $(PREFIX)/bin/newdboard $(PREFIX)/bin/refdb $(PREFIX)/bin/mt_xterm $(PREFIX)/bin/revtagfsl

deploytarg/apropos.so : Makefile
	for i in apropos base64 canvas-draw csv-xml directory-utils dot-locking extras fmt format hostinfo http-client intarweb json md5 message-digest posix posix-extras readline regex regex-case s11n spiffy spiffy-request-vars sqlite3 srfi-1 srfi-18 srfi-69 tcp test uri-common check-errors synch matchable sql-null tcp-server rpc blob-utils string-utils variable-item defstruct uri-generic sendfile opensll openssl lookup-table list-utils stack; do \
	chicken-install -prefix deploytarg -deploy $$i;done

deploytarg/libsqlite3.so : 
	CSC_OPTIONS="-Ideploytarg -Ldeploytarg" $CHICKEN_INSTALL -prefix deploytarg -deploy sqlite3

Added utils/revtagfsl.scm version [b7c322220b].




















































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

;; Copyright 2006-2013, Matthew Welland.
;; 
;;  This program is made available under the GNU GPL version 2.0 or
;;  greater. See the accompanying file COPYING for details.
;; 
;;  This program is distributed WITHOUT ANY WARRANTY; without even the
;;  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;;  PURPOSE.

(use json regex posix)
(use srfi-69)

;; Add tags with node nums: trunk(12) 
(define fname #f)

(let ((parms (argv)))
  (if (> (length parms) 1)
      (set! fname (cadr parms))))

(if (not (and fname (file-exists? fname)))
    (begin
      (print "Usage: revtagfsl /path/to/fossilfile.fossil")
      (exit 1)))

(define (revtag:get-timeline fslfname limit)
  (let* ((cmd      (if (file-exists? fslfname)
		       (conc "fossil json timeline checkin --limit " limit " -R " fslfname)
		       (conc "fossil json timeline checkin --limit " limit))))
    (with-input-from-pipe cmd json-read)))
    

(define mt (vector->list (revtag:get-timeline fname 10000)))
(define tl (map vector->list (cdr (assoc "timeline" (vector->list (cdr (assoc "payload" mt)))))))

(define nodes    (make-hash-table)) ;; look up for the nodes
(define parents  (make-hash-table)) ;; node-uuid -> (list parent ...)
(define children (make-hash-table)) ;; node-uuid -> (list child ...)
(define tagged   (make-hash-table))
(define usedtags (make-hash-table))

(define noparents '())

(for-each (lambda (node)
	    (let ((uuid      (cdr (assoc "uuid" node)))
		  (myparents (assoc "parents" node)))
	      (hash-table-set! nodes uuid node)
	      (if myparents
		  (begin
		    (hash-table-set! parents uuid (cdr myparents))
		    (for-each (lambda (parent)
				(hash-table-set! children parent (cons uuid (hash-table-ref/default children parent '()))))
			      myparents))
		  (set! noparents (cons node noparents)))))
	  tl)

(define ord-tl (sort tl (lambda (a b)(let ((ta (cdr (assoc "timestamp" a)))(tb (cdr (assoc "timestamp" b))))(< ta tb)))))

(print "branch, uuid, newtag")
(let loop ((hed (car ord-tl))
	   (tal (cdr ord-tl)))
  (let* ((tags    (let ((t (assoc "tags" hed)))
		    (if t (cdr t) '())))
	 (uuid    (cdr (assoc "uuid" hed)))
	 (branch  (if (null? tags) "nobranch" (car tags)))
	 (nextnum (+ 1 (hash-table-ref/default tagged branch 0)))
	 (tagpatt (regexp (conc "^" branch "\\(\\d+\\)")))
	 (currtag (filter (lambda (x)(string-match tagpatt x)) tags))
	 (newtag  (conc branch "(" nextnum ")")))
    (if (and (not (equal? branch "nobranch"))
	     (null? currtag))
	(begin
	  (hash-table-set! tagged branch nextnum)
	  (print branch ", " uuid ", " newtag)
	  (system (conc "fossil tag add \"" newtag "\" " uuid " -R " fname)) ;; ?--raw? ?--propagate? TAGNAME CHECK-IN ?VALUE?
	  (hash-table-set! usedtags currtag #t))
	(for-each (lambda (t)
		    (hash-table-set! usedtags t #t))
		  currtag))
    (if (not (null? tal))
	(loop (car tal)(cdr tal)))))