aboutsummaryrefslogtreecommitdiff
path: root/examples/redis-unstable/utils/graphs
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:52:54 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2026-01-21 22:52:54 +0100
commitdcacc00e3750300617ba6e16eb346713f91a783a (patch)
tree38e2d4fb5ed9d119711d4295c6eda4b014af73fd /examples/redis-unstable/utils/graphs
parent58dac10aeb8f5a041c46bddbeaf4c7966a99b998 (diff)
downloadcrep-dcacc00e3750300617ba6e16eb346713f91a783a.tar.gz
Remove testing data
Diffstat (limited to 'examples/redis-unstable/utils/graphs')
-rw-r--r--examples/redis-unstable/utils/graphs/commits-over-time/README.md16
-rwxr-xr-xexamples/redis-unstable/utils/graphs/commits-over-time/genhtml.tcl96
2 files changed, 0 insertions, 112 deletions
diff --git a/examples/redis-unstable/utils/graphs/commits-over-time/README.md b/examples/redis-unstable/utils/graphs/commits-over-time/README.md
deleted file mode 100644
index b28019e..0000000
--- a/examples/redis-unstable/utils/graphs/commits-over-time/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
1This Tcl script is what I used in order to generate the graph you
2can find at http://antirez.com/news/98. It's really quick & dirty, more
3a trow away program than anything else, but probably could be reused or
4modified in the future in order to visualize other similar data or an
5updated version of the same data.
6
7The usage is trivial:
8
9 ./genhtml.tcl > output.html
10
11The generated HTML is quite broken but good enough to grab a screenshot
12from the browser. Feel free to improve it if you got time / interest.
13
14Note that the code filtering the tags, and the hardcoded branch name, does
15not make the script, as it is, able to analyze a different repository.
16However the changes needed are trivial.
diff --git a/examples/redis-unstable/utils/graphs/commits-over-time/genhtml.tcl b/examples/redis-unstable/utils/graphs/commits-over-time/genhtml.tcl
deleted file mode 100755
index c4b4e09..0000000
--- a/examples/redis-unstable/utils/graphs/commits-over-time/genhtml.tcl
+++ /dev/null
@@ -1,96 +0,0 @@
1#!/usr/bin/env tclsh
2
3# Load commits history as "sha1 unixtime".
4set commits [exec git log unstable {--pretty="%H %at"}]
5set raw_tags [exec git tag]
6
7# Load all the tags that are about stable releases.
8foreach tag $raw_tags {
9 if {[string match v*-stable $tag]} {
10 set tag [string range $tag 1 end-7]
11 puts $tag
12 }
13 if {[regexp {^[0-9]+.[0-9]+.[0-9]+$} $tag]} {
14 lappend tags $tag
15 }
16}
17
18# For each tag, create a list of "name unixtime"
19foreach tag $tags {
20 set taginfo [exec git log $tag -n 1 "--pretty=\"$tag %at\""]
21 set taginfo [string trim $taginfo {"}]
22 lappend labels $taginfo
23}
24
25# For each commit, check the amount of code changed and create an array
26# mapping the commit to the number of lines affected.
27foreach c $commits {
28 set stat [exec git show --oneline --numstat [lindex $c 0]]
29 set linenum 0
30 set affected 0
31 foreach line [split $stat "\n"] {
32 incr linenum
33 if {$linenum == 1 || [string match *deps/* $line]} continue
34 if {[catch {llength $line} numfields]} continue
35 if {$numfields == 0} continue
36 catch {
37 incr affected [lindex $line 0]
38 incr affected [lindex $line 1]
39 }
40 }
41 set commit_to_affected([lindex $c 0]) $affected
42}
43
44set base_time [lindex [lindex $commits end] 1]
45puts [clock format $base_time]
46
47# Generate a graph made of HTML DIVs.
48puts {<html>
49<style>
50.box {
51 position:absolute;
52 width:10px;
53 height:5px;
54 border:1px black solid;
55 background-color:#44aa33;
56 opacity: 0.04;
57}
58.label {
59 position:absolute;
60 background-color:#dddddd;
61 font-family:helvetica;
62 font-size:12px;
63 padding:2px;
64 color:#666;
65 border:1px #aaa solid;
66 border-radius: 5px;
67}
68#outer {
69 position:relative;
70 width:1500;
71 height:500;
72 border:1px #aaa solid;
73}
74</style>
75<div id="outer">
76}
77foreach c $commits {
78 set sha [lindex $c 0]
79 set t [expr {([lindex $c 1]-$base_time)/(3600*24*2)}]
80 set affected [expr $commit_to_affected($sha)]
81 set left $t
82 set height [expr {log($affected)*20}]
83 puts "<div class=\"box\" style=\"left:$left; bottom:0; height:$height\"></div>"
84}
85
86set bottom -30
87foreach l $labels {
88 set name [lindex $l 0]
89 set t [expr {([lindex $l 1]-$base_time)/(3600*24*2)}]
90 set left $t
91 if {$left < 0} continue
92 incr bottom -20
93 if {$bottom == -210} {set bottom -30}
94 puts "<div class=\"label\" style=\"left:$left; bottom:$bottom\">$name</div>"
95}
96puts {</div></html>}