{"thread":{"id":"18530","subject":"[TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies","startedAt":"2009-03-25T10:35:41Z","lastAt":"2009-03-25T11:24:40Z","messageCount":4,"participants":["Bert Wesarg","Uwe Kleine-König"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"109333","messageId":"1237977341-32173-1-git-send-email-bert.wesarg@googlemail.com","threadId":"18530","inReplyTo":null,"subject":"[TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-03-25T10:35:41Z","receivedAt":"2009-03-25T10:35:41Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This uses the tred(1) and gvpr(1) program from the graphviz package to reduce\nthe dependencies of the given TopGit branch.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n .gitignore |    2 ++\n README     |   22 ++++++++++++++++++++++\n tg-tred.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 71 insertions(+), 0 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex eb56446..1061d93 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -13,6 +13,8 @@\n /tg-patch.txt\n /tg-summary\n /tg-summary.txt\n+/tg-tred\n+/tg-tred.txt\n /tg-update\n /tg-update.txt\n /tg-export\ndiff --git a/README b/README\nindex d2f095d..a941cb6 100644\n--- a/README\n+++ b/README\n@@ -480,6 +480,28 @@ tg update\n \n \tTODO: tg update -a for updating all topic branches\n \n+tg tred\n+~~~~~~~\n+\tPrints the transitive reduction of the dependecies for the current\n+\tor named TopGit branch.\n+\n+\tTo actually use this reduced dependencies list, feed the output into\n+\tthe .topdeps file, commit and run tg update, like:\n+\n+\t$ tg tred > .topdeps\n+\t$ tg add -f .topdeps\n+\t$ git commit -m \"transitive reduce TopGit dependencies\"\n+\t$ tg update\n+\n+\tIf you want to see the differences to the current dependencies, run\n+\tthis:\n+\n+\t$ diff -u -L current -L tred <(git show :.topdeps) <(tg tred)\n+\n+\tTODO: tg tred -a for reducing all branches\n+\tTODO: tg tred -r for reducing recursive all from the current/named\n+\t      branch\n+\n TODO: tg rename\n \n \ndiff --git a/tg-tred.sh b/tg-tred.sh\nnew file mode 100644\nindex 0000000..f41e051\n--- /dev/null\n+++ b/tg-tred.sh\n@@ -0,0 +1,47 @@\n+#!/bin/sh\n+# TopGit - A different patch queue manager\n+# (c) Petr Baudis <pasky@suse.cz>              2008\n+# (c) Bert Wesarg <bert.wesarg@googlemail.com> 2009\n+# GPLv2\n+\n+name=\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-*)\n+\t\techo \"Usage: tg [...] tred [NAME]\" >&2\n+\t\texit 1;;\n+\t*)\n+\t\t[ -z \"$name\" ] || die \"name already specified ($name)\"\n+\t\tname=\"$arg\";;\n+\tesac\n+done\n+\n+[ -n \"$name\" ] || name=\"$(git symbolic-ref HEAD | sed 's#^refs/\\(heads\\|top-bases\\)/##')\"\n+base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\" ||\n+\tdie \"not a TopGit-controlled branch\"\n+\n+type tred >/dev/null 2>&1 ||\n+\tdie \"need the tred(1) tool from the graphviz package\"\n+type gvpr >/dev/null 2>&1 ||\n+\tdie \"need the gvpr(1) tool from the graphviz package\"\n+\n+$tg summary --graphviz |\n+\ttred |\n+\tgvpr -a \"\\\"${name}\\\"\" '\n+BEG_G {\n+    node_t  ctr;\n+    edge_t  e;\n+\n+    ctr = isNode($, ARGV[0]);\n+    for (e = fstedge(ctr); e; e = nxtedge(e,ctr)) {\n+        if (e.head.name != ARGV[0])\n+            printf(\"%s\\n\", e.head.name);\n+    }\n+    exit(0);\n+}\n+'\n-- \ntg: (fcb488d..) bw/tred (depends on: master)\n"},{"id":"109335","messageId":"20090325105841.GB27803@pengutronix.de","threadId":"18530","inReplyTo":"1237977341-32173-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-03-25T10:58:41Z","receivedAt":"2009-03-25T10:58:41Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nOn Wed, Mar 25, 2009 at 11:35:41AM +0100, Bert Wesarg wrote:\n> +$tg summary --graphviz |\n> +\ttred |\n> +\tgvpr -a \"\\\"${name}\\\"\" '\n> +BEG_G {\n> +    node_t  ctr;\n> +    edge_t  e;\n> +\n> +    ctr = isNode($, ARGV[0]);\n> +    for (e = fstedge(ctr); e; e = nxtedge(e,ctr)) {\n> +        if (e.head.name != ARGV[0])\n> +            printf(\"%s\\n\", e.head.name);\n> +    }\n> +    exit(0);\n> +}\nI don't know tred and gvpr, just looked shortly over the manpages.\nAnyhow what I consider important is that the order of .topdeps is\nstable.  That is\n\n\tt/topic1\n\tmaster\n\tt/topic2\n\nmust not be rewritten to\n\n\tt/topic2\n\tt/topic1\n\nif master is redundant.  Is this asserted?\n\nMoreover I wonder if the gvpr program could be optimized when E is used\ninstead of BEG_G, but as I said above, I don't know how gvpr works.\n\nAnd note that I intend to change the semantic of tg summary s.t. it only\nrecurses on the current branch instead of all branches.  I think this\ndoesn't hurt here, though.\n\nBest regards and thanks for your contribution,\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"109338","messageId":"36ca99e90903250420l42a46718x91263b4adb7da45f@mail.gmail.com","threadId":"18530","inReplyTo":"20090325105841.GB27803@pengutronix.de","subject":"Re: [TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-03-25T11:20:53Z","receivedAt":"2009-03-25T11:20:53Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2009/3/25 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hello,\n>\n> On Wed, Mar 25, 2009 at 11:35:41AM +0100, Bert Wesarg wrote:\n>> +$tg summary --graphviz |\n>> +     tred |\n>> +     gvpr -a \"\\\"${name}\\\"\" '\n>> +BEG_G {\n>> +    node_t  ctr;\n>> +    edge_t  e;\n>> +\n>> +    ctr = isNode($, ARGV[0]);\n>> +    for (e = fstedge(ctr); e; e = nxtedge(e,ctr)) {\n>> +        if (e.head.name != ARGV[0])\n>> +            printf(\"%s\\n\", e.head.name);\n>> +    }\n>> +    exit(0);\n>> +}\n> I don't know tred and gvpr, just looked shortly over the manpages.\n> Anyhow what I consider important is that the order of .topdeps is\n> stable.  That is\n>\n>        t/topic1\n>        master\n>        t/topic2\n>\n> must not be rewritten to\n>\n>        t/topic2\n>        t/topic1\n>\n> if master is redundant.  Is this asserted?\nI asked this myself, I haven't looked very deeply but I think it is\nstable. And some tests showed this.\n\n>\n> And note that I intend to change the semantic of tg summary s.t. it only\n> recurses on the current branch instead of all branches.  I think this\n> doesn't hurt here, though.\nI don't understand and can't confirm this. tg summary calls 'git\nfor-each-ref refs/top-bases' so all TopGit controlled branches should\nbe reached.\n\nWhile I was adding a 'reduce' subcommand to tg-depend (which calls\ntg-tred and updates .topdeps) I saw that it is immposible to add a\nnone TopGit controlled branch to the dependency list, which looks\nwrong. Dependencies don't need to be TopGit controlled, like master.\n\nBert\n\n>\n> Best regards and thanks for your contribution,\n> Uwe\n"},{"id":"109339","messageId":"36ca99e90903250424l534bde1frcd11f1c453c02534@mail.gmail.com","threadId":"18530","inReplyTo":"36ca99e90903250420l42a46718x91263b4adb7da45f@mail.gmail.com","subject":"Re: [TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2009-03-25T11:24:40Z","receivedAt":"2009-03-25T11:24:40Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":">> if master is redundant.  Is this asserted?\n> I asked this myself, I haven't looked very deeply but I think it is\n> stable. And some tests showed this.\nBTW: Because of this uncertainty I implemented it so, that it just\nshows the reduced dep list not alter the current one. Anyway, you can\nalways check what changed with my diff example.\n"}]}