Skip to contentSkip to conversation

tg-tred: Print the transitive reduction of the dependecies

PATCH In review Bert Wesarg 2 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tg-tred: Print the transitive reduction of the dependecies

This uses the tred(1) and gvpr(1) program from the graphviz package to reduce the dependencies of the given TopGit branch.

---
 .gitignore |    2 ++
 README     |   22 ++++++++++++++++++++++
 tg-tred.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 0 deletions(-)
.gitignore +2 -0
index eb56446..1061d93 100644
@@ -13,6 +13,8 @@
 /tg-patch.txt
 /tg-summary
 /tg-summary.txt
+/tg-tred
+/tg-tred.txt
 /tg-update
 /tg-update.txt
 /tg-export
README +22 -0
index d2f095d..a941cb6 100644
@@ -480,6 +480,28 @@ tg update
 
 	TODO: tg update -a for updating all topic branches
 
+tg tred
+~~~~~~~
+	Prints the transitive reduction of the dependecies for the current
+	or named TopGit branch.
+
+	To actually use this reduced dependencies list, feed the output into
+	the .topdeps file, commit and run tg update, like:
+
+	$ tg tred > .topdeps
+	$ tg add -f .topdeps
+	$ git commit -m "transitive reduce TopGit dependencies"
+	$ tg update
+
+	If you want to see the differences to the current dependencies, run
+	this:
+
+	$ diff -u -L current -L tred <(git show :.topdeps) <(tg tred)
+
+	TODO: tg tred -a for reducing all branches
+	TODO: tg tred -r for reducing recursive all from the current/named
+	      branch
+
 TODO: tg rename
 
 
tg-tred.sh new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
tg: (fcb488d..) bw/tred (depends on: master)
#1 lore raw

Hello,

Quoted 4 lines · Bert Wesarg

+$tg summary --graphviz |

tg-tred.sh new file +3 -0
+	tred |
+	gvpr -a "\"${name}\"" '
+BEG_G {

tg-tred.sh line 46

Quoted 10 lines
tg-tred.sh new file +10 -0
+    node_t  ctr;
+    edge_t  e;
+
+    ctr = isNode($, ARGV[0]);
+    for (e = fstedge(ctr); e; e = nxtedge(e,ctr)) {
+        if (e.head.name != ARGV[0])
+            printf("%s\n", e.head.name);
+    }
+    exit(0);
+}

I don't know tred and gvpr, just looked shortly over the manpages. Anyhow what I consider important is that the order of .topdeps is stable. That is

t/topic1
master
t/topic2

must not be rewritten to

t/topic2
t/topic1

if master is redundant. Is this asserted?

Moreover I wonder if the gvpr program could be optimized when E is used instead of BEG_G, but as I said above, I don't know how gvpr works.

And note that I intend to change the semantic of tg summary s.t. it only recurses on the current branch instead of all branches. I think this doesn't hurt here, though.

Best regards and thanks for your contribution,
Uwe

Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
#2 lore raw

2009/3/25 Uwe Kleine-König <[email protected]>:

Quoted 25 lines

Hello,

Quoted 4 lines · Bert Wesarg

+$tg summary --graphviz |
+     tred |
+     gvpr -a "\"${name}\"" '

tg-tred.sh new file +1 -0
+BEG_G {

tg-tred.sh line 46

Quoted 10 lines
tg-tred.sh new file +10 -0
+    node_t  ctr;
+    edge_t  e;
+
+    ctr = isNode($, ARGV[0]);
+    for (e = fstedge(ctr); e; e = nxtedge(e,ctr)) {
+        if (e.head.name != ARGV[0])
+            printf("%s\n", e.head.name);
+    }
+    exit(0);
+}

I don't know tred and gvpr, just looked shortly over the manpages. Anyhow what I consider important is that the order of .topdeps is stable.  That is

       t/topic1
       master
       t/topic2

Quoted 6 lines

must not be rewritten to

       t/topic2
       t/topic1

if master is redundant.  Is this asserted?

I asked this myself, I haven't looked very deeply but I think it is stable. And some tests showed this.

Quoted 4 lines

And note that I intend to change the semantic of tg summary s.t. it only recurses on the current branch instead of all branches.  I think this doesn't hurt here, though.

I don't understand and can't confirm this. tg summary calls 'git for-each-ref refs/top-bases' so all TopGit controlled branches should be reached.

While I was adding a 'reduce' subcommand to tg-depend (which calls tg-tred and updates .topdeps) I saw that it is immposible to add a none TopGit controlled branch to the dependency list, which looks wrong. Dependencies don't need to be TopGit controlled, like master.

Bert

Quoted 3 lines

Best regards and thanks for your contribution,
Uwe

#3 lore raw
Quoted 3 lines
Quoted 1 line

if master is redundant.  Is this asserted?

I asked this myself, I haven't looked very deeply but I think it is stable. And some tests showed this.

BTW: Because of this uncertainty I implemented it so, that it just shows the reduced dep list not alter the current one. Anyway, you can always check what changed with my diff example.