{"thread":{"id":"14968","subject":"[TopGit TOY PATCH] tg-graft: forge tip--base--<deps...> history for a subcommand","startedAt":"2008-08-12T21:10:16Z","lastAt":"2008-08-13T07:11:15Z","messageCount":3,"participants":["Thomas Rast","Bert Wesarg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"86972","messageId":"1218575416-16711-1-git-send-email-trast@student.ethz.ch","threadId":"14968","inReplyTo":null,"subject":"[TopGit TOY PATCH] tg-graft: forge tip--base--<deps...> history for a subcommand","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2008-08-12T21:10:16Z","receivedAt":"2008-08-12T21:10:16Z","isPatch":true,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"Adds a command 'tg graft <command>' that evaluates <command> with a\nspecial GIT_GRAFT_FILE: the parent of each patch head is its patch\nbase, and the parents of the patch base are the dependencies of the\npatch.\n\nTry, for example, 'tg graft \"gitk --all\"'.\n\nSigned-off-by: Thomas Rast <trast@student.ethz.ch>\n---\n\nMainly sending this so someone can turn it into a useful feature, and\nmaybe build a few subcommands on top of it (that might call gitk or\n'git log --graph', for example).\n\nThe one big issue with the resulting history is that the commit\nmessages at the tip aren't very interesting and may even be completely\nirrelevant (for a base merge).  I don't see a good solution for that.\n\n Makefile    |    2 +-\n tg-graft.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 48 insertions(+), 1 deletions(-)\n create mode 100755 tg-graft.sh\n\ndiff --git a/Makefile b/Makefile\nindex 6eade1e..57745c0 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -6,7 +6,7 @@ sharedir = $(PREFIX)/share/topgit\n hooksdir = $(cmddir)/hooks\n \n \n-commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh\n+commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh tg-graft.sh\n hooks_in = hooks/pre-commit.sh\n \n commands_out = $(patsubst %.sh,%,$(commands_in))\ndiff --git a/tg-graft.sh b/tg-graft.sh\nnew file mode 100755\nindex 0000000..b6d0458\n--- /dev/null\n+++ b/tg-graft.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+# GPLv2\n+\n+if [ -z \"$1\" -o -n \"$2\" ]; then\n+\techo \"Usage: tg graft <command>\" >&2\n+\texit 1\n+fi\n+\n+mkdir -p \"$git_dir\"/info\n+\n+grafts_file=\"$(mktemp)\"\n+\n+if [ -f \"$git_dir\"/info/grafts ]; then\n+\tcp \"$git_dir\"/info/grafts \"$grafts_file\"\n+fi\n+\n+mapdir=\"$(mktemp -d)\"\n+\n+git for-each-ref refs/top-bases |\n+\twhile read rev name ref; do\n+\t\tname=\"${ref#refs/top-bases/}\"\n+\t\ttip=$(git rev-parse \"$name\")\n+\t\tbase=$(git rev-parse \"$ref\")\n+\t\tif [ \"$tip\" != \"$base\" ]; then\n+\t\t\techo $base >> \"$mapdir\"/$tip\n+\t\tfi\n+\t\tgit cat-file blob \"$name:.topdeps\" |\n+\t\t\twhile read dep; do\n+\t\t\t\tif git rev-parse --verify \"$dep\" >/dev/null 2>&1; then\n+\t\t\t\t\trev=$(git rev-parse \"$dep\")\n+\t\t\t\t\t[ $rev != $base ] && echo $rev >> \"$mapdir\"/$base\n+\t\t\t\tfi\n+\t\t\tdone\n+\tdone\n+\n+for sha in $(cd \"$mapdir\" && ls); do\n+\techo $sha $(cat \"$mapdir\"/$sha | sort -u) >> \"$grafts_file\"\n+done\n+\n+rm -rf \"$mapdir\"\n+\n+export GIT_GRAFT_FILE=\"$grafts_file\"\n+eval \"$1\"\n+\n+rm \"$grafts_file\"\n-- \n1.6.0.rc2.53.gfa6b9\n"},{"id":"87017","messageId":"36ca99e90808130010w226a8947y1e1c59e5f5d57989@mail.gmail.com","threadId":"14968","inReplyTo":"1218575416-16711-1-git-send-email-trast@student.ethz.ch","subject":"Re: [TopGit TOY PATCH] tg-graft: forge tip--base--<deps...> history for a subcommand","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2008-08-13T07:10:40Z","receivedAt":"2008-08-13T07:10:40Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Tue, Aug 12, 2008 at 23:10, Thomas Rast <trast@student.ethz.ch> wrote:\n> Adds a command 'tg graft <command>' that evaluates <command> with a\n> special GIT_GRAFT_FILE: the parent of each patch head is its patch\n> base, and the parents of the patch base are the dependencies of the\n> patch.\n>\n> Try, for example, 'tg graft \"gitk --all\"'.\n>\n> Signed-off-by: Thomas Rast <trast@student.ethz.ch>\n> ---\n>\n> Mainly sending this so someone can turn it into a useful feature, and\n> maybe build a few subcommands on top of it (that might call gitk or\n> 'git log --graph', for example).\n>\n> The one big issue with the resulting history is that the commit\n> messages at the tip aren't very interesting and may even be completely\n> irrelevant (for a base merge).  I don't see a good solution for that.\n>\n>  Makefile    |    2 +-\n>  tg-graft.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++\n>  2 files changed, 48 insertions(+), 1 deletions(-)\n>  create mode 100755 tg-graft.sh\n>\n> diff --git a/Makefile b/Makefile\n> index 6eade1e..57745c0 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -6,7 +6,7 @@ sharedir = $(PREFIX)/share/topgit\n>  hooksdir = $(cmddir)/hooks\n>\n>\n> -commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh\n> +commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh tg-graft.sh\nPetr, maybe we should use a wildcard here, to prevent merge conflicts\nwhile adding new commands.\n\nI will send a patch.\n\n>  hooks_in = hooks/pre-commit.sh\n>\n>  commands_out = $(patsubst %.sh,%,$(commands_in))\n> diff --git a/tg-graft.sh b/tg-graft.sh\n> new file mode 100755\n> index 0000000..b6d0458\n> --- /dev/null\n> +++ b/tg-graft.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> +# GPLv2\n> +\n> +if [ -z \"$1\" -o -n \"$2\" ]; then\n> +       echo \"Usage: tg graft <command>\" >&2\n> +       exit 1\n> +fi\n> +\n> +mkdir -p \"$git_dir\"/info\nThis shouldn't be needed, the info dir is created by git init.\n"},{"id":"87018","messageId":"1218611475-12960-1-git-send-email-bert.wesarg@googlemail.com","threadId":"14968","inReplyTo":"36ca99e90808130010w226a8947y1e1c59e5f5d57989@mail.gmail.com","subject":"[TopGit PATCH] Makefile: Use $(wildcard) for commands_in","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2008-08-13T07:11:15Z","receivedAt":"2008-08-13T07:11:15Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"To prevent merge conflicts while adding new commands, use a wildcard for\nthe command list.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n Makefile |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 6eade1e..2c4a67c 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -6,7 +6,7 @@ sharedir = $(PREFIX)/share/topgit\n hooksdir = $(cmddir)/hooks\n \n \n-commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh\n+commands_in = $(wildcard tg-*.sh)\n hooks_in = hooks/pre-commit.sh\n \n commands_out = $(patsubst %.sh,%,$(commands_in))\n-- \ntg: (f27e693..) t/use-wildcard-for-commands_in (depends on: master)\n"}]}