Skip to contentSkip to conversation

cs-bisection-step: Linky linky revision graph

PATCH In review Ian Jackson 3 participants 10 messages Oct 23, 2015 – Nov 2, 2015

lore
Share & tools
lore
#0 lore raw

cover cs-bisection-step: Linky linky revision graph

These three patches contrive to produce (in a rather ugly way) an SVG version of the revision graph in which the revisions and (most usefully) the flights are hyperlinks.

#1 lore raw

PATCH 1/3 cs-bisection-step: Generate an SVG graph too

This is going to let us provide a version with hyperlinks.

---
 cs-bisection-step |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
cs-bisection-step +3 -2
index 7a97b10..bd5a27e 100755
@@ -1026,7 +1026,7 @@ END
         or die "$!";
 
     if (eval {
-        foreach my $fmt (qw(ps png)) {
+        foreach my $fmt (qw(ps png svg)) {
             system_checked("dot", "-T$fmt", "-o$graphfile.$fmt",
 			   "$graphfile.dot");
         }
@@ -1045,11 +1045,12 @@ END
 <h2>Revision graph overview</h2>
 <img src="$href.mini.png">
 <h2>Revision graph</h2>
+<a href="$href.svg">SVG</h2><br>
 <a href="$href.ps">PostScript</a><p>
 <img src="$href.png">
 </body></html>
 END
-        print STDERR "Revision graph left in $graphfile.{dot,ps,png,html}.\n";
+        print STDERR "Revision graph left in $graphfile.{dot,ps,png,html,svg}.\n";
     } else {
         my $emsg= encode_entities($@);
         print HTML <<END or die $!;
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 2/3 cs-bisection-step: Make hyperlinks in SVG revision graph

In reply to Ian Jackson

Make various elements in the output into hyperlinks and hence document that the SVG version of the graph is best to use.

AFAICT dot does not provide a way to put literal SVG elements into its output. So we postprocess it. Luckily we produced the input to dot so we know a lot about what the output will look like.

In theory it would be better to feed the SVG into an XML parser and do this editing at the ESIS level, via XSLT. However, I don't understand XSLT, and this regexp-based version will work until the authors of dot decide to change the output syntax. If they do, the hyperlinking will go away, but everything else will still work. I think this approach will be less effort overall. This is particularly true as even using XSLT would involve us knowing how dot's output is structured, and changes to the syntax of the dot output are not very likely unless the dot authors also change the semantics.

---
 README.bisection  |    5 +++++
 cs-bisection-step |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
README.bisection +5 -0
index ca3405c..8ea3d3e 100644
@@ -137,6 +137,11 @@ Revision Graph
 The revision graph page shows the osstest bisector's view of the
 situation.
 
+The SVG version of the graph is best if your browser supports it.  In
+that graph the individual revisions and flight result notations are
+hyperlinks (even though they may not be marked as such in your
+browser).
+
 Each node in the graph corresponds to a tuple of revisions: one
 revision for each of the relevant trees.  Each edge changes the
 revision of one of the trees.  (osstest has constructed this graph by
cs-bisection-step +36 -0
index bd5a27e..841a46a 100755
@@ -1030,6 +1030,42 @@ END
             system_checked("dot", "-T$fmt", "-o$graphfile.$fmt",
 			   "$graphfile.dot");
         }
+	open SVGI, "$graphfile.svg" or die "$graphfile.svg $!";
+	open SVGO, ">", "$graphfile.svg.new" or die "$graphfile.svg.new $!";
+	while (<SVGI>) {
+	    if (m/^\<text/) {
+		if (m/(?<=\>)[0-9a-f]{12}(?:,[0-9a-f]{12})*(?=\<)/) {
+		    my ($l,$r) = ($`,$'); #');
+		    my @commits = split /\,/, $&;
+		    my @ocommits;
+		    for (my $i=0; $i<@commits; $i++) {
+			my $url = "$treeinfos[$i]{Url}#$commits[$i]";
+			push @ocommits, "<a xlink:href=\"".
+			    encode_entities($url).
+			    "\">".
+			    $commits[$i].
+			    "</a>";
+		    }
+		    $_ = $l.(join ",", @ocommits).$r;
+		} elsif (m/(?<=\>)\d+:[-a-z]+(?: \d+:[-a-z]+)*(?=\<)/) {
+		    my ($l,$r) = ($`,$'); #');
+		    my @flights = split / /, $&;
+		    foreach my $f (@flights) {
+			$f =~ m/^\d+(?=:)/;
+			$f = "<a xlink:href=\"".
+			    encode_entities("$c{ReportHtmlPubBaseUrl}/$&").
+			    "\">".
+			    $f."</a>";
+		    }
+		    $_ = $l.(join " ", @flights).$r;
+		}
+	    }
+	    print SVGO or die $!;
+	}
+	close SVGO or die $!;
+	rename "$graphfile.svg.new", "$graphfile.svg"
+	    or die "$graphfile.svg $!";
+
         1;
     }) {
 	my $gsize = $c{BisectionRevisonGraphSize};
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH 3/3 cs-bisection-step: Mark which revision(s) changed in each node

In reply to Ian Jackson

We compare the revision rtuple elements with each of the parents, and mark changes by surrounding the revision id with *asterisks*.

In the SVG output, we have to strip these when generating the URL, and we can show this by emboldening the relevant revision instead. This involves changing the ther output to be of normal weight by deleting the emboldening output by dot.

---
 README.bisection  |    3 +++
 cs-bisection-step |   27 +++++++++++++++++++++------
 2 files changed, 24 insertions(+), 6 deletions(-)
README.bisection +3 -0
index 8ea3d3e..ae8a1aa 100644
@@ -159,6 +159,9 @@ revision) or blue (if the attempt with that particular revision tuple
 was inconclusive because the test step being bisected was blocked by
 an earlier failure).
 
+The revision(s) which changed compared to the parent(s) are marked
+with asterisks, or in bold.
+
 The revision being fingered (or, when the bisector is running, the
 next revision to test) is highlighed with a double boundary.
 
cs-bisection-step +21 -6
index 841a46a..e51babd 100755
@@ -928,9 +928,18 @@ END
 sub gnodename ($) {
     my ($n) = @_;
 
-    my $lab= $n->{Rtuple};
-    $lab =~ s/(\S{12})\S+/$1/g;
-    $lab =~ s/ /,/g;
+    my @lab = split / /, $n->{Rtuple};
+    foreach (my $i=0; $i<@lab; $i++) {
+	my $lab = $lab[$i];
+	$lab = substr $lab, 0, 12;
+	$lab = "*$lab*"
+	    if grep {
+		my @ptuple = split / /, $_->{Rtuple};
+		$ptuple[$i] ne $lab[$i];
+	    } @{ $n->{Parents} };
+	$lab[$i] = $lab;
+    }
+    my $lab = join ",", @lab;
 
     my $fs= $n->{Flights};
     if ($fs) {
@@ -1034,18 +1043,24 @@ END
 	open SVGO, ">", "$graphfile.svg.new" or die "$graphfile.svg.new $!";
 	while (<SVGI>) {
 	    if (m/^\<text/) {
-		if (m/(?<=\>)[0-9a-f]{12}(?:,[0-9a-f]{12})*(?=\<)/) {
+		if (m/(?<=\>)\*?[0-9a-f]{12}\*?(?:,\*?[0-9a-f]{12}\*?)*(?=\<)/) {
 		    my ($l,$r) = ($`,$'); #');
 		    my @commits = split /\,/, $&;
 		    my @ocommits;
 		    for (my $i=0; $i<@commits; $i++) {
-			my $url = "$treeinfos[$i]{Url}#$commits[$i]";
+			my $commit = $commits[$i];
+			$commit =~ s#\*##g;
+			my $url = "$treeinfos[$i]{Url}#$commit";
+			my $show = $commits[$i];
+			$show =~ s#^\*#<tspan font-weight="bolder">#;
+			$show =~ s#\*$#</tspan>#;
 			push @ocommits, "<a xlink:href=\"".
 			    encode_entities($url).
 			    "\">".
-			    $commits[$i].
+			    $show.
 			    "</a>";
 		    }
+		    $l =~ s# font-weight="bold" # #;
 		    $_ = $l.(join ",", @ocommits).$r;
 		} elsif (m/(?<=\>)\d+:[-a-z]+(?: \d+:[-a-z]+)*(?=\<)/) {
 		    my ($l,$r) = ($`,$'); #');
Signature · 1 line
1.7.10.4
#5 lore raw
Quoted 8 lines · Ian Jackson

Ian Jackson writes ("[OSSTEST PATCH 0/3] cs-bisection-step: Linky linky revision graph"):

Quoted 3 lines

These three patches contrive to produce (in a rather ugly way) an SVG version of the revision graph in which the revisions and (most usefully) the flights are hyperlinks.

Example of the output:

http://xenbits.xen.org/people/iwj/2015/bisection-svg/t.html
http://xenbits.xen.org/people/iwj/2015/bisection-svg/t.svg

I get "The address wasn't understood" from my browser.

It appears that it is using the git:// URLs

e.g. git://xenbits.xen.org/linux-pvops.git#1230ae0e99e0

Shouldn't the HTTP links be used?

~Andrew

#6 lore raw

Andrew Cooper writes ("Re: [Xen-devel] [OSSTEST PATCH 0/3] cs-bisection-step: Linky linky revision graph"):

Quoted 10 lines · Ian Jackson
Quoted 4 lines

Example of the output:

http://xenbits.xen.org/people/iwj/2015/bisection-svg/t.html
http://xenbits.xen.org/people/iwj/2015/bisection-svg/t.svg

I get "The address wasn't understood" from my browser.

It appears that it is using the git:// URLs e.g. git://xenbits.xen.org/linux-pvops.git#1230ae0e99e0

Yes, indeed. It appears that your browser is rather poor :-). (Most are...)

Quoted 1 line

Shouldn't the HTTP links be used?

They aren't available.

The information here comes from the flights database, which contains the URLs used to clone the code, but not any corresponding links suitable for use in a browser.[1]

In fact, osstest doesn't handle or know of such browseable links for any of the trees it deals with. In the general case such browseable links may not even exist.

[1] It is true that in some cases, for some trees, there are links that can be used for both; but we prefer to have osstest use git://
urls because they cache well, with our git caching proxy.

Ian.

#7 lore raw
Quoted 4 lines · Ian Jackson

Andrew Cooper writes ("Re: [Xen-devel] [OSSTEST PATCH 0/3] cs-bisection-step: Linky linky revision graph"):

Quoted 3 lines · Ian Jackson
Quoted 2 lines

Example of the output:

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

http://xenbits.xen.org/people/iwj/2015/bisection-svg/t.html
http://xenbits.xen.org/people/iwj/2015/bisection-svg/t.svg

I get "The address wasn't understood" from my browser.

It appears that it is using the git:// URLs e.g. git://xenbits.xen.org/linux-pvops.git#1230ae0e99e0

Yes, indeed. It appears that your browser is rather poor :-). (Most are...)

How is yours configured then, to do something sensible with a git:// uri ?

~Andrew

#8 lore raw

Andrew Cooper writes ("Re: [Xen-devel] [OSSTEST PATCH 0/3] cs-bisection-step: Linky linky revision graph"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

Yes, indeed. It appears that your browser is rather poor :-). (Most are...)

How is yours configured then, to do something sensible with a git:// uri ?

I did say most browsers were poor :-).

ISTM that this information is better than nothing.

Ian.

#9 lore raw
Quoted 6 lines · Ian Jackson

Andrew Cooper writes ("Re: [Xen-devel] [OSSTEST PATCH 0/3] cs-bisection -step: Linky linky revision graph"):

Quoted 4 lines · Ian Jackson
Quoted 2 lines

Yes, indeed. It appears that your browser is rather poor :-). (Most are...)

Quoted 6 lines
Quoted 2 lines

How is yours configured then, to do something sensible with a git://
uri ?

I did say most browsers were poor :-).

ISTM that this information is better than nothing.

For reasons best known to itself my version of firefox doesn't offer me the "copy link location" option when right clicking these :-(

Otherwise I would suggest that the correct format would be "<URL> <REVISION>" such that after copying the URL "git fetch <PASTE>" just does the right thing(tm).

But the fact I can now highlight and copy the rev from the graph is very valuable IMHO.

I'd be minded to suggest that the default HTML ought to include the SVG by default.

Ian.