{"thread":{"id":"25320","subject":"planning a new topgit release","startedAt":"2010-10-03T19:15:32Z","lastAt":"2010-10-06T06:11:58Z","messageCount":39,"participants":["Uwe Kleine-König","Bert Wesarg","Ævar Arnfjörð Bjarmason","Štěpán Němec"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"152376","messageId":"20101003191532.GA28679@pengutronix.de","threadId":"25320","inReplyTo":null,"subject":"planning a new topgit release","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-03T19:15:32Z","receivedAt":"2010-10-03T19:15:32Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nIn the last few days I got two mails about the status of topgit and was\nasked about a new release.\n\nI'm willing to create a release as 0.8 was done quite some time ago and\nthere were several patches merged since then---mostly bugfixes.\n\nI'm sure I missed questions and patches in the recent past, so I ask you\nto resend anything you still have pending to me to get it included in\n0.9.\n\nThanks\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152410","messageId":"AANLkTim3gnU+_krD2QM0BAMf9DZi2_4hva6dq4WXcatH@mail.gmail.com","threadId":"25320","inReplyTo":"20101003191532.GA28679@pengutronix.de","subject":"Re: planning a new topgit release","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:21:42Z","receivedAt":"2010-10-03T21:21:42Z","isPatch":false,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Hey,\n\n2010/10/3 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hello,\n>\n> In the last few days I got two mails about the status of topgit and was\n> asked about a new release.\n>\n> I'm willing to create a release as 0.8 was done quite some time ago and\n> there were several patches merged since then---mostly bugfixes.\n>\n> I'm sure I missed questions and patches in the recent past, so I ask you\n> to resend anything you still have pending to me to get it included in\n> 0.9.\n\nThanks for the heads-up. I will send my low and long hanging fruits in\nreply to this message. I haven't followed master recently. The missing\nimportant patch is the tg-graph one (which is probably my most used\ncommand these days). Which Per may find interesting, Maybe I find the\ntime this week to update and send this out.\n\nBert\n\n>\n> Thanks\n> Uwe\n"},{"id":"152411","messageId":"1286141157-30422-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"AANLkTim3gnU+_krD2QM0BAMf9DZi2_4hva6dq4WXcatH@mail.gmail.com","subject":"[TopGit PATCH 1/6] Let tg-update take a branch parameter","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:25:52Z","receivedAt":"2010-10-03T21:25:52Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n README                     |    6 ++++--\n contrib/tg-completion.bash |    7 ++++++-\n tg-update.sh               |   18 ++++++++++++------\n 3 files changed, 22 insertions(+), 9 deletions(-)\n\ndiff --git a/README b/README\nindex c418ff4..dba2345 100644 README\n--- a/README\n+++ b/README\n@@ -472,13 +472,15 @@ tg import\n \n tg update\n ~~~~~~~~~\n-\tUpdate the current topic branch wrt. changes in the branches\n-\tit depends on and remote branches.\n+\tUpdate the current or specified topic branch wrt. changes in the\n+\tbranches it depends on and remote branches.\n \tThis is performed in two phases - first,\n \tchanges within the dependencies are merged to the base,\n \tthen the base is merged into the topic branch.\n \tThe output will guide you in case of conflicts.\n \n+\tAfter the update the current branch is the specified one.\n+\n \tIn case your dependencies are not up-to-date, tg update\n \twill first recurse into them and update these.\n \ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex 0ee233c..5aabc92 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -423,7 +423,12 @@ _tg_summary ()\n \n _tg_update ()\n {\n-\tCOMPREPLY=()\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\n+\tcase \"$cur\" in\n+\t*)\n+\t\t__tgcomp \"$(__tg_topics)\"\n+\tesac\n }\n \n ### }}}\ndiff --git a/tg-update.sh b/tg-update.sh\nindex 73280c6..b256c7c 100644 tg-update.sh\n--- a/tg-update.sh\n+++ b/tg-update.sh\n@@ -8,13 +8,19 @@ name=\n \n ## Parse options\n \n-if [ -n \"$1\" ]; then\n-\techo \"Usage: tg [...] update\" >&2\n-\texit 1\n-fi\n-\n-\n-name=\"$(git symbolic-ref HEAD | sed 's#^refs/\\(heads\\|top-bases\\)/##')\"\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-*)\n+\t\techo \"Usage: tg [...] update [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-- \ntg: (29ab4cf..) bw/update-does-checkout (depends on: master)\n"},{"id":"152412","messageId":"1286141157-30422-2-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"1286141157-30422-1-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH 2/6] tg-remote: use default remote if non is given","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:25:53Z","receivedAt":"2010-10-03T21:25:53Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This is usefull if the remote has new topics and you need to populate the local\ntop-bases.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n README       |    2 +-\n tg-remote.sh |    5 ++++-\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/README b/README\nindex c418ff4..5a54468 100644 README\n--- a/README\n+++ b/README\n@@ -327,7 +327,7 @@ tg remote\n \tand 'git push' to operate on them. (Do NOT use 'git push --all'\n \tfor your pushes - plain 'git push' will do the right thing.)\n \n-\tIt takes a mandatory remote name argument, and optional\n+\tIt takes a optional remote name argument, and optional\n \t'--populate' switch - use that for your origin-style remote,\n \tit will seed the local topic branch system based on the\n \tremote topic branches. '--populate' will also make 'tg remote'\ndiff --git a/tg-remote.sh b/tg-remote.sh\nindex 86dcd9a..61774d7 100644 tg-remote.sh\n--- a/tg-remote.sh\n+++ b/tg-remote.sh\n@@ -15,13 +15,16 @@ while [ -n \"$1\" ]; do\n \t--populate)\n \t\tpopulate=1;;\n \t-*)\n-\t\techo \"Usage: tg [...] remote [--populate] REMOTE\" >&2\n+\t\techo \"Usage: tg [...] remote [--populate] [REMOTE]\" >&2\n \t\texit 1;;\n \t*)\n \t\tname=\"$arg\";;\n \tesac\n done\n \n+[ -n \"$name\" ] ||\n+\tname=\"$base_remote\"\n+\n git config \"remote.$name.url\" >/dev/null || die \"unknown remote '$name'\"\n \n \n-- \ntg: (29ab4cf..) bw/tg-remote-use-defualt-remote (depends on: master)\n"},{"id":"152414","messageId":"1286141157-30422-3-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"1286141157-30422-2-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH 3/6] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:25:54Z","receivedAt":"2010-10-03T21:25:54Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"this could also be a --name-only option to tg-patch. But I Like the\nsimilarity to 'quilt files'.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n .gitignore                 |    2 +\n README                     |    8 ++++++\n contrib/tg-completion.bash |    1 +\n tg-files.sh                |   52 ++++++++++++++++++++++++++++++++++++++++++++\n 4 files changed, 63 insertions(+), 0 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 0342e09..0dc4d0e 100644 .gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -22,6 +22,8 @@\n /tg-depend.txt\n /tg-export\n /tg-export.txt\n+/tg-files\n+/tg-files.txt\n /tg-import\n /tg-import.txt\n /tg-info\ndiff --git a/README b/README\nindex f103d92..46f564a 100644 README\n--- a/README\n+++ b/README\n@@ -272,6 +272,14 @@ tg depend\n \n \tTODO: Subcommand for removing dependencies, obviously\n \n+tg files\n+~~~~~~~~\n+\tList files changed by the current or specified topic branch.\n+\n+\tOptions:\n+\t  -i\t\tlist files based on index instead of branch\n+\t  -w\t\tlist files based on working tree instead of branch\n+\n tg info\n ~~~~~~~\n \tShow a summary information about the current or specified\ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex 0ee233c..38567d0 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -467,6 +467,7 @@ _tg ()\n \tdelete)      _tg_delete ;;\n \tdepend)      _tg_depend ;;\n \texport)      _tg_export ;;\n+\tfiles)       _tg_patch ;;\n \thelp)        _tg_help ;;\n \timport)      _tg_import ;;\n \tinfo)        _tg_info ;;\ndiff --git a/tg-files.sh b/tg-files.sh\nnew file mode 100644\nindex 0000000..0723bf1 tg-files.sh\n--- /dev/null\n+++ b/tg-files.sh\n@@ -0,0 +1,52 @@\n+#!/bin/sh\n+# TopGit - A different patch queue manager\n+# (c) Petr Baudis <pasky@suse.cz>  2008\n+# GPLv2\n+\n+name=\n+\n+topic=\n+diff_opts=\n+diff_committed_only=yes\t# will be unset for index/worktree\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-i)\n+\t\ttopic='(i)'\n+\t\tdiff_opts=\"$diff_opts --cached\";\n+\t\tdiff_committed_only=;;\n+\t-w)\n+\t\ttopic='(w)'\n+\t\tdiff_committed_only=;;\n+\t-*)\n+\t\techo \"Usage: tg [...] files [-i | -w] [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+[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n+\tdie \"-i/-w are mutually exclusive with NAME\"\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+# if not index/worktree, topic is current branch\n+[ -z \"$topic\" ] && topic=\"$name\"\n+\n+\n+\n+# Evil obnoxious hack to work around the lack of git diff --exclude\n+git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n+\tfgrep -vx \".topdeps\" |\n+\tfgrep -vx \".topmsg\" || : # fgrep likes to fail randomly?\n+\n+# vim:noet\n-- \ntg: (9404aa1..) bw/files (depends on: master)\n"},{"id":"152413","messageId":"1286141157-30422-4-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"1286141157-30422-3-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH 4/6] tg-prev/tg-next: commands to explore dependencies","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:25:55Z","receivedAt":"2010-10-03T21:25:55Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Two new commands to explore the dependencies of TopGit branches:\n\n  a) tg prev [-i | -w] [NAME]\n     outputs the dependencies of NAME\n\n  b) tg next [-i | -w] [NAME]\n     outputs branches which depends on NAME\n\nObviously, quilt next was the inspiration.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n .gitignore                 |    4 +++\n README                     |   16 +++++++++++++++\n contrib/tg-completion.bash |   34 +++++++++++++++++++++++++++++++++\n tg-next.sh                 |   45 ++++++++++++++++++++++++++++++++++++++++++++\n tg-prev.sh                 |   38 +++++++++++++++++++++++++++++++++++++\n 5 files changed, 137 insertions(+), 0 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 0342e09..fe4bdc1 100644 .gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -28,8 +28,12 @@\n /tg-info.txt\n /tg-mail\n /tg-mail.txt\n+/tg-next\n+/tg-next.txt\n /tg-patch\n /tg-patch.txt\n+/tg-prev\n+/tg-prev.txt\n /tg-push\n /tg-push.txt\n /tg-remote\ndiff --git a/README b/README\nindex f103d92..f2d18a2 100644 README\n--- a/README\n+++ b/README\n@@ -522,6 +522,22 @@ tg base\n \trepository, so you will not see work done by your\n \tcollaborators.)\n \n+tg prev\n+~~~~~~~\n+\tOutputs the direct dependencies for the current or named patch.\n+\n+\tOptions:\n+\t  -i\t\tshow dependencies based on index instead of branch\n+\t  -w\t\tshow dependencies based on working tree instead of branch\n+\n+tg next\n+~~~~~~~\n+\tOutputs all patches which directly depend on the current or\n+\tnamed patch.\n+\n+\tOptions:\n+\t  -i\t\tshow dependencies based on index instead of branch\n+\t  -w\t\tshow dependencies based on working tree instead of branch\n \n TODO: tg rename\n \ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex 0ee233c..fd17d5c 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -426,6 +426,38 @@ _tg_update ()\n \tCOMPREPLY=()\n }\n \n+_tg_next ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\n+\tcase \"$cur\" in\n+\t-*)\n+\t\t__tgcomp \"\n+\t\t\t-i\n+\t\t\t-w\n+\t\t\"\n+\t\t;;\n+\t*)\n+\t\t__tgcomp \"$(__tg_topics)\"\n+\tesac\n+}\n+\n+_tg_prev ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\n+\tcase \"$cur\" in\n+\t-*)\n+\t\t__tgcomp \"\n+\t\t\t-i\n+\t\t\t-w\n+\t\t\"\n+\t\t;;\n+\t*)\n+\t\t__tgcomp \"$(__tg_topics)\"\n+\tesac\n+}\n+\n ### }}}\n ### {{{ tg completion\n \n@@ -471,7 +503,9 @@ _tg ()\n \timport)      _tg_import ;;\n \tinfo)        _tg_info ;;\n \tmail)        _tg_mail ;;\n+\tnext)        _tg_next ;;\n \tpatch)       _tg_patch ;;\n+\tprev)        _tg_prev ;;\n \tpush)        _tg_push ;;\n \tremote)      _tg_remote ;;\n \tsummary)     _tg_summary ;;\ndiff --git a/tg-next.sh b/tg-next.sh\nnew file mode 100644\nindex 0000000..9b352b3 tg-next.sh\n--- /dev/null\n+++ b/tg-next.sh\n@@ -0,0 +1,45 @@\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+head_deps=\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-i)\n+\t\thead_deps='(i)';;\n+\t-w)\n+\t\thead_deps='(w)';;\n+\t-*)\n+\t\techo \"Usage: tg next [-i | -w] [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+head=\"$(git symbolic-ref HEAD | sed 's#^refs/\\(heads\\|top-bases\\)/##')\"\n+[ -n \"$name\" ] || name=$head\n+\n+git for-each-ref --format='%(refname)' refs/top-bases |\n+\twhile read ref; do\n+\t\tparent=\"${ref#refs/top-bases/}\"\n+\n+\t\tdeps_src=$parent\n+\t\t# select .topdeps source for HEAD branch\n+\t\t[ \"x$parent\" = \"x$head\" -a -n \"$head_deps\" ] &&\n+\t\t\tdeps_src=$head_deps\n+\n+\t\tcat_file \"$deps_src\":.topdeps | fgrep -qx \"$name\" ||\n+\t\t\tcontinue\n+\n+\t\techo \"$parent\"\n+\tdone\ndiff --git a/tg-prev.sh b/tg-prev.sh\nnew file mode 100644\nindex 0000000..efef410 tg-prev.sh\n--- /dev/null\n+++ b/tg-prev.sh\n@@ -0,0 +1,38 @@\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+head_deps=\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-i)\n+\t\thead_deps='(i)';;\n+\t-w)\n+\t\thead_deps='(w)';;\n+\t-*)\n+\t\techo \"Usage: tg next [-i | -w] [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+head=\"$(git symbolic-ref HEAD | sed 's#^refs/\\(heads\\|top-bases\\)/##')\"\n+[ -n \"$name\" ] || name=$head\n+base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\" ||\n+\tdie \"not a TopGit-controlled branch\"\n+\n+deps_src=$name\n+# select .topdeps source for HEAD branch\n+[ \"x$name\" = \"x$head\" -a -n \"$head_deps\" ] &&\n+\tdeps_src=$head_deps\n+cat_file \"$deps_src:.topdeps\"\n-- \ntg: (9404aa1..) bw/next-prev-base (depends on: master)\n"},{"id":"152415","messageId":"1286141157-30422-5-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"1286141157-30422-4-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH 5/6] put die() messages to stderr","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:25:56Z","receivedAt":"2010-10-03T21:25:56Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n tg.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/tg.sh b/tg.sh\nindex 9d08d63..3925f49 100644 tg.sh\n--- a/tg.sh\n+++ b/tg.sh\n@@ -14,7 +14,7 @@ info()\n \n die()\n {\n-\tinfo \"fatal: $*\"\n+\tinfo \"fatal: $*\" >&2\n \texit 1\n }\n \n-- \ntg: (9404aa1..) bw/die-to-stderr (depends on: master)\n"},{"id":"152416","messageId":"1286141157-30422-6-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"1286141157-30422-5-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH 6/6] tg-log: short cut to git log","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-03T21:25:57Z","receivedAt":"2010-10-03T21:25:57Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"A short cut to show the history of a named topgit branch.  Additional options\nto git log can be given after a '--'.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n .gitignore                 |    2 ++\n README                     |    3 +++\n contrib/tg-completion.bash |   11 +++++++++++\n tg-log.sh                  |   30 ++++++++++++++++++++++++++++++\n 4 files changed, 46 insertions(+), 0 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 0342e09..3298889 100644 .gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -28,6 +28,8 @@\n /tg-info.txt\n /tg-mail\n /tg-mail.txt\n+/tg-log\n+/tg-log.txt\n /tg-patch\n /tg-patch.txt\n /tg-push\ndiff --git a/README b/README\nindex f103d92..b5fdaaf 100644 README\n--- a/README\n+++ b/README\n@@ -522,6 +522,9 @@ tg base\n \trepository, so you will not see work done by your\n \tcollaborators.)\n \n+tg log\n+~~~~~~\n+\tPrints the git log of the named topgit branch.\n \n TODO: tg rename\n \ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex 0ee233c..c65398a 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -344,6 +344,16 @@ _tg_info ()\n \tesac\n }\n \n+_tg_log ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\n+\tcase \"$cur\" in\n+\t*)\n+\t\t__tgcomp \"$(__tg_topics)\"\n+\tesac\n+}\n+\n _tg_mail ()\n {\n \tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n@@ -470,6 +480,7 @@ _tg ()\n \thelp)        _tg_help ;;\n \timport)      _tg_import ;;\n \tinfo)        _tg_info ;;\n+\tlog)         _tg_log ;;\n \tmail)        _tg_mail ;;\n \tpatch)       _tg_patch ;;\n \tpush)        _tg_push ;;\ndiff --git a/tg-log.sh b/tg-log.sh\nnew file mode 100644\nindex 0000000..8a8d527 tg-log.sh\n--- /dev/null\n+++ b/tg-log.sh\n@@ -0,0 +1,30 @@\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\tbreak;;\n+\t-*)\n+\t\techo \"Usage: tg [...] log [NAME] [-- GIT LOG OPTIONS...]\" >&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/##')\"\n+base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\" ||\n+\tdie \"not a TopGit-controlled branch\"\n+\n+git log --first-parent --no-merges \"$@\" \"refs/top-bases/$name\"..\"$name\"\n-- \ntg: (9404aa1..) bw/log (depends on: master)\n"},{"id":"152418","messageId":"20101003215520.GC28679@pengutronix.de","threadId":"25320","inReplyTo":"1286141157-30422-4-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH 4/6] tg-prev/tg-next: commands to explore dependencies","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-03T21:55:20Z","receivedAt":"2010-10-03T21:55:20Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hi,\n\nOn Sun, Oct 03, 2010 at 11:25:55PM +0200, Bert Wesarg wrote:\n> Two new commands to explore the dependencies of TopGit branches:\n> \n>   a) tg prev [-i | -w] [NAME]\n>      outputs the dependencies of NAME\n> \n>   b) tg next [-i | -w] [NAME]\n>      outputs branches which depends on NAME\nI wonder if this is somehow mergable with Per's checkout [next|prev].\n(contained in git://repo.or.cz/topgit/tsort.git, t/checkout)\n\nWhat do you think?\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152420","messageId":"20101003220052.GD28679@pengutronix.de","threadId":"25320","inReplyTo":"1286141157-30422-2-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH 2/6] tg-remote: use default remote if non is given","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-03T22:00:52Z","receivedAt":"2010-10-03T22:00:52Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nOn Sun, Oct 03, 2010 at 11:25:53PM +0200, Bert Wesarg wrote:\n> This is usefull if the remote has new topics and you need to populate the local\n> top-bases.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> \n> ---\n>  README       |    2 +-\n>  tg-remote.sh |    5 ++++-\n>  2 files changed, 5 insertions(+), 2 deletions(-)\n> \n> diff --git a/README b/README\n> index c418ff4..5a54468 100644 README\n> --- a/README\n> +++ b/README\n> @@ -327,7 +327,7 @@ tg remote\n>  \tand 'git push' to operate on them. (Do NOT use 'git push --all'\n>  \tfor your pushes - plain 'git push' will do the right thing.)\n>  \n> -\tIt takes a mandatory remote name argument, and optional\n> +\tIt takes a optional remote name argument, and optional\n>  \t'--populate' switch - use that for your origin-style remote,\n>  \tit will seed the local topic branch system based on the\n>  \tremote topic branches. '--populate' will also make 'tg remote'\n> diff --git a/tg-remote.sh b/tg-remote.sh\n> index 86dcd9a..61774d7 100644 tg-remote.sh\n> --- a/tg-remote.sh\n> +++ b/tg-remote.sh\n> @@ -15,13 +15,16 @@ while [ -n \"$1\" ]; do\n>  \t--populate)\n>  \t\tpopulate=1;;\n>  \t-*)\n> -\t\techo \"Usage: tg [...] remote [--populate] REMOTE\" >&2\n> +\t\techo \"Usage: tg [...] remote [--populate] [REMOTE]\" >&2\n>  \t\texit 1;;\n>  \t*)\n>  \t\tname=\"$arg\";;\n>  \tesac\n>  done\n>  \n> +[ -n \"$name\" ] ||\n> +\tname=\"$base_remote\"\n> +\nDoesn't this need error checking, i.e. what happens if tg remote was\nnever called before?  Hmm, seems to be a problem that already exists\nnow?!  Took your patch anyhow.\n\n>  git config \"remote.$name.url\" >/dev/null || die \"unknown remote '$name'\"\n>  \n>  \n> -- \n> tg: (29ab4cf..) bw/tg-remote-use-defualt-remote (depends on: master)\n> \n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152421","messageId":"20101003220330.GE28679@pengutronix.de","threadId":"25320","inReplyTo":"1286141157-30422-3-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH 3/6] tg-files: list files changed by the topic branch","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-03T22:03:30Z","receivedAt":"2010-10-03T22:03:30Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hi Bert,\n\nOn Sun, Oct 03, 2010 at 11:25:54PM +0200, Bert Wesarg wrote:\n> this could also be a --name-only option to tg-patch. But I Like the\n> similarity to 'quilt files'.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> \n> ---\n>  .gitignore                 |    2 +\n>  README                     |    8 ++++++\n>  contrib/tg-completion.bash |    1 +\n>  tg-files.sh                |   52 ++++++++++++++++++++++++++++++++++++++++++++\n>  4 files changed, 63 insertions(+), 0 deletions(-)\n> \n> diff --git a/.gitignore b/.gitignore\n> index 0342e09..0dc4d0e 100644 .gitignore\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -22,6 +22,8 @@\n>  /tg-depend.txt\n>  /tg-export\n>  /tg-export.txt\n> +/tg-files\n> +/tg-files.txt\n>  /tg-import\n>  /tg-import.txt\n>  /tg-info\n> diff --git a/README b/README\n> index f103d92..46f564a 100644 README\n> --- a/README\n> +++ b/README\n> @@ -272,6 +272,14 @@ tg depend\n>  \n>  \tTODO: Subcommand for removing dependencies, obviously\n>  \n> +tg files\n> +~~~~~~~~\n> +\tList files changed by the current or specified topic branch.\n> +\n> +\tOptions:\n> +\t  -i\t\tlist files based on index instead of branch\n> +\t  -w\t\tlist files based on working tree instead of branch\n> +\n>  tg info\n>  ~~~~~~~\n>  \tShow a summary information about the current or specified\n> diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\n> index 0ee233c..38567d0 100755 contrib/tg-completion.bash\n> --- a/contrib/tg-completion.bash\n> +++ b/contrib/tg-completion.bash\n> @@ -467,6 +467,7 @@ _tg ()\n>  \tdelete)      _tg_delete ;;\n>  \tdepend)      _tg_depend ;;\n>  \texport)      _tg_export ;;\n> +\tfiles)       _tg_patch ;;\n>  \thelp)        _tg_help ;;\n>  \timport)      _tg_import ;;\n>  \tinfo)        _tg_info ;;\n> diff --git a/tg-files.sh b/tg-files.sh\n> new file mode 100644\n> index 0000000..0723bf1 tg-files.sh\n> --- /dev/null\n> +++ b/tg-files.sh\n> @@ -0,0 +1,52 @@\n> +#!/bin/sh\n> +# TopGit - A different patch queue manager\n> +# (c) Petr Baudis <pasky@suse.cz>  2008\n> +# GPLv2\n> +\n> +name=\n> +\n> +topic=\n> +diff_opts=\n> +diff_committed_only=yes\t# will be unset for index/worktree\n> +\n> +\n> +## Parse options\n> +\n> +while [ -n \"$1\" ]; do\n> +\targ=\"$1\"; shift\n> +\tcase \"$arg\" in\n> +\t-i)\n> +\t\ttopic='(i)'\n> +\t\tdiff_opts=\"$diff_opts --cached\";\n> +\t\tdiff_committed_only=;;\n> +\t-w)\n> +\t\ttopic='(w)'\n> +\t\tdiff_committed_only=;;\n> +\t-*)\n> +\t\techo \"Usage: tg [...] files [-i | -w] [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> +[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n> +\tdie \"-i/-w are mutually exclusive with NAME\"\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> +# if not index/worktree, topic is current branch\n> +[ -z \"$topic\" ] && topic=\"$name\"\n> +\n> +\n> +\n> +# Evil obnoxious hack to work around the lack of git diff --exclude\n> +git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n> +\tfgrep -vx \".topdeps\" |\n> +\tfgrep -vx \".topmsg\" || : # fgrep likes to fail randomly?\nInstead of using fgrep you could export the branch and call git diff\n--name-only $diff_opts on the resulting commit?\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152422","messageId":"20101003221105.GF28679@pengutronix.de","threadId":"25320","inReplyTo":"AANLkTim3gnU+_krD2QM0BAMf9DZi2_4hva6dq4WXcatH@mail.gmail.com","subject":"Re: planning a new topgit release","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-03T22:11:05Z","receivedAt":"2010-10-03T22:11:05Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Bert,\n\nOn Sun, Oct 03, 2010 at 11:21:42PM +0200, Bert Wesarg wrote:\n> Hey,\n> \n> 2010/10/3 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> > Hello,\n> >\n> > In the last few days I got two mails about the status of topgit and was\n> > asked about a new release.\n> >\n> > I'm willing to create a release as 0.8 was done quite some time ago and\n> > there were several patches merged since then---mostly bugfixes.\n> >\n> > I'm sure I missed questions and patches in the recent past, so I ask you\n> > to resend anything you still have pending to me to get it included in\n> > 0.9.\n> \n> Thanks for the heads-up. I will send my low and long hanging fruits in\n> reply to this message. I haven't followed master recently. The missing\n> important patch is the tg-graph one (which is probably my most used\n> command these days). Which Per may find interesting, Maybe I find the\n> time this week to update and send this out.\nI took patches 1, 2 (with two typo fixes in the commit log), 5 and 6.\n\nFor 3 and 4 see my replies on the respective mails.\n\nThanks\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152446","messageId":"AANLkTin_erzxiOgthOq5_9dtFXeRT+K5K4uGTGa1OOZP@mail.gmail.com","threadId":"25320","inReplyTo":"1286141157-30422-2-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH 2/6] tg-remote: use default remote if non is given","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-10-04T03:13:24Z","receivedAt":"2010-10-04T03:13:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sun, Oct 3, 2010 at 21:25, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n\nMinor: I think you mean \"none\" in the subject, not \"non\".\n"},{"id":"152465","messageId":"20101004064304.GG28679@pengutronix.de","threadId":"25320","inReplyTo":"AANLkTin_erzxiOgthOq5_9dtFXeRT+K5K4uGTGa1OOZP@mail.gmail.com","subject":"Re: [TopGit PATCH 2/6] tg-remote: use default remote if non is given","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-04T06:43:04Z","receivedAt":"2010-10-04T06:43:04Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"On Mon, Oct 04, 2010 at 03:13:24AM +0000, Ævar Arnfjörð Bjarmason wrote:\n> On Sun, Oct 3, 2010 at 21:25, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> \n> Minor: I think you mean \"none\" in the subject, not \"non\".\nRight, I fixed that up when committing, together with s/usefull/useful/\n\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152467","messageId":"AANLkTimLgWKPBjVAni=t6EK4Yr9FyJZa=Yk01SeMcwA1@mail.gmail.com","threadId":"25320","inReplyTo":"20101003220330.GE28679@pengutronix.de","subject":"Re: [TopGit PATCH 3/6] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T06:43:52Z","receivedAt":"2010-10-04T06:43:52Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Hi,\n\n2010/10/4 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hi Bert,\n>\n> On Sun, Oct 03, 2010 at 11:25:54PM +0200, Bert Wesarg wrote:\n>> this could also be a --name-only option to tg-patch. But I Like the\n>> similarity to 'quilt files'.\n>>\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>> ---\n>>  .gitignore                 |    2 +\n>>  README                     |    8 ++++++\n>>  contrib/tg-completion.bash |    1 +\n>>  tg-files.sh                |   52 ++++++++++++++++++++++++++++++++++++++++++++\n>>  4 files changed, 63 insertions(+), 0 deletions(-)\n>>\n>> diff --git a/.gitignore b/.gitignore\n>> index 0342e09..0dc4d0e 100644 .gitignore\n>> --- a/.gitignore\n>> +++ b/.gitignore\n>> @@ -22,6 +22,8 @@\n>>  /tg-depend.txt\n>>  /tg-export\n>>  /tg-export.txt\n>> +/tg-files\n>> +/tg-files.txt\n>>  /tg-import\n>>  /tg-import.txt\n>>  /tg-info\n>> diff --git a/README b/README\n>> index f103d92..46f564a 100644 README\n>> --- a/README\n>> +++ b/README\n>> @@ -272,6 +272,14 @@ tg depend\n>>\n>>       TODO: Subcommand for removing dependencies, obviously\n>>\n>> +tg files\n>> +~~~~~~~~\n>> +     List files changed by the current or specified topic branch.\n>> +\n>> +     Options:\n>> +       -i            list files based on index instead of branch\n>> +       -w            list files based on working tree instead of branch\n>> +\n>>  tg info\n>>  ~~~~~~~\n>>       Show a summary information about the current or specified\n>> diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\n>> index 0ee233c..38567d0 100755 contrib/tg-completion.bash\n>> --- a/contrib/tg-completion.bash\n>> +++ b/contrib/tg-completion.bash\n>> @@ -467,6 +467,7 @@ _tg ()\n>>       delete)      _tg_delete ;;\n>>       depend)      _tg_depend ;;\n>>       export)      _tg_export ;;\n>> +     files)       _tg_patch ;;\n>>       help)        _tg_help ;;\n>>       import)      _tg_import ;;\n>>       info)        _tg_info ;;\n>> diff --git a/tg-files.sh b/tg-files.sh\n>> new file mode 100644\n>> index 0000000..0723bf1 tg-files.sh\n>> --- /dev/null\n>> +++ b/tg-files.sh\n>> @@ -0,0 +1,52 @@\n>> +#!/bin/sh\n>> +# TopGit - A different patch queue manager\n>> +# (c) Petr Baudis <pasky@suse.cz>  2008\n>> +# GPLv2\n>> +\n>> +name=\n>> +\n>> +topic=\n>> +diff_opts=\n>> +diff_committed_only=yes      # will be unset for index/worktree\n>> +\n>> +\n>> +## Parse options\n>> +\n>> +while [ -n \"$1\" ]; do\n>> +     arg=\"$1\"; shift\n>> +     case \"$arg\" in\n>> +     -i)\n>> +             topic='(i)'\n>> +             diff_opts=\"$diff_opts --cached\";\n>> +             diff_committed_only=;;\n>> +     -w)\n>> +             topic='(w)'\n>> +             diff_committed_only=;;\n>> +     -*)\n>> +             echo \"Usage: tg [...] files [-i | -w] [NAME]\" >&2\n>> +             exit 1;;\n>> +     *)\n>> +             [ -z \"$name\" ] || die \"name already specified ($name)\"\n>> +             name=\"$arg\";;\n>> +     esac\n>> +done\n>> +\n>> +\n>> +[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n>> +     die \"-i/-w are mutually exclusive with NAME\"\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>> +     die \"not a TopGit-controlled branch\"\n>> +\n>> +# if not index/worktree, topic is current branch\n>> +[ -z \"$topic\" ] && topic=\"$name\"\n>> +\n>> +\n>> +\n>> +# Evil obnoxious hack to work around the lack of git diff --exclude\n>> +git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n>> +     fgrep -vx \".topdeps\" |\n>> +     fgrep -vx \".topmsg\" || : # fgrep likes to fail randomly?\n> Instead of using fgrep you could export the branch and call git diff\n> --name-only $diff_opts on the resulting commit?\n\nIf you mean using tg-export, than I think this is a bad idea. The\noperation will than be O(n), with n the total number of depending\nbranches.\n\nI think a pretty_tree on the base and the branch with git diff-tree\nshould suffice:\n\ngit diff-tree --name-only $(pretty_tree refs/top-bases/$name)\n$(pretty_tree $name)\n\nBert\n\n>\n> Best regards\n> Uwe\n>\n> --\n> Pengutronix e.K.                           | Uwe Kleine-König            |\n> Industrial Linux Solutions                 | http://www.pengutronix.de/  |\n>\n"},{"id":"152468","messageId":"AANLkTi=sc-FBG=CeNTv9H4Fj0KqdHkoudjQHqEYZxPuV@mail.gmail.com","threadId":"25320","inReplyTo":"AANLkTi=Kwx5avY7xRdWLS931zK2fi7cj5Q8u3++bqRO+@mail.gmail.com","subject":"Re: [TopGit PATCH 6/6] tg-log: short cut to git log","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T06:45:31Z","receivedAt":"2010-10-04T06:45:31Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Mon, Oct 4, 2010 at 06:40, Per Cederqvist <ceder@lysator.liu.se> wrote:\n> Using --first-parent to get only the interesting commits only works reliably\n> when you only work locally. If you collaborate and you and your partner both\n> make a commit before you push to a central server you will have to make a\n> merge, where both parents are interesting.\n>\n> I wish that git remembered which branch a commit was initially made on. That\n> would make \"tg log\" easy to implement correctly. But since git doesn't, I\n> don't think it is possible to implement it properly.\n>\n> At least, a warning should be added to the README.\n\nI've read it from your tg base help message and have no problem to\ncopy/move it to tg log.\n\nBert\n\n>\n>     /ceder\n"},{"id":"152469","messageId":"20101004064544.GH28679@pengutronix.de","threadId":"25320","inReplyTo":"AANLkTi=Kwx5avY7xRdWLS931zK2fi7cj5Q8u3++bqRO+@mail.gmail.com","subject":"Re: [TopGit PATCH 6/6] tg-log: short cut to git log","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-04T06:45:44Z","receivedAt":"2010-10-04T06:45:44Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hi,\n\nOn Mon, Oct 04, 2010 at 06:40:22AM +0200, Per Cederqvist wrote:\n> Using --first-parent to get only the interesting commits only works reliably\n> when you only work locally. If you collaborate and you and your partner both\n> make a commit before you push to a central server you will have to make a\n> merge, where both parents are interesting.\n> \n> I wish that git remembered which branch a commit was initially made on. That\n> would make \"tg log\" easy to implement correctly. But since git doesn't, I\n> don't think it is possible to implement it properly.\n> \n> At least, a warning should be added to the README.\nOh right, I missed that, when looking over the patch.  Maybe doing\nsomething like:\n\n\tgit log $name ^base(name) $(for d in dep(name); do echo ^$d)\n\nwould work?\n\nThanks\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152470","messageId":"20101004064747.GJ28679@pengutronix.de","threadId":"25320","inReplyTo":"AANLkTimLgWKPBjVAni=t6EK4Yr9FyJZa=Yk01SeMcwA1@mail.gmail.com","subject":"Re: [TopGit PATCH 3/6] tg-files: list files changed by the topic branch","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-04T06:47:47Z","receivedAt":"2010-10-04T06:47:47Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Bert,\n\nOn Mon, Oct 04, 2010 at 08:43:52AM +0200, Bert Wesarg wrote:\n> 2010/10/4 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> > Hi Bert,\n> >\n> > On Sun, Oct 03, 2010 at 11:25:54PM +0200, Bert Wesarg wrote:\n> >> this could also be a --name-only option to tg-patch. But I Like the\n> >> similarity to 'quilt files'.\n> >>\n> >> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> >>\n> >> ---\n> >>  .gitignore                 |    2 +\n> >>  README                     |    8 ++++++\n> >>  contrib/tg-completion.bash |    1 +\n> >>  tg-files.sh                |   52 ++++++++++++++++++++++++++++++++++++++++++++\n> >>  4 files changed, 63 insertions(+), 0 deletions(-)\n> >>\n> >> diff --git a/.gitignore b/.gitignore\n> >> index 0342e09..0dc4d0e 100644 .gitignore\n> >> --- a/.gitignore\n> >> +++ b/.gitignore\n> >> @@ -22,6 +22,8 @@\n> >>  /tg-depend.txt\n> >>  /tg-export\n> >>  /tg-export.txt\n> >> +/tg-files\n> >> +/tg-files.txt\n> >>  /tg-import\n> >>  /tg-import.txt\n> >>  /tg-info\n> >> diff --git a/README b/README\n> >> index f103d92..46f564a 100644 README\n> >> --- a/README\n> >> +++ b/README\n> >> @@ -272,6 +272,14 @@ tg depend\n> >>\n> >>       TODO: Subcommand for removing dependencies, obviously\n> >>\n> >> +tg files\n> >> +~~~~~~~~\n> >> +     List files changed by the current or specified topic branch.\n> >> +\n> >> +     Options:\n> >> +       -i            list files based on index instead of branch\n> >> +       -w            list files based on working tree instead of branch\n> >> +\n> >>  tg info\n> >>  ~~~~~~~\n> >>       Show a summary information about the current or specified\n> >> diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\n> >> index 0ee233c..38567d0 100755 contrib/tg-completion.bash\n> >> --- a/contrib/tg-completion.bash\n> >> +++ b/contrib/tg-completion.bash\n> >> @@ -467,6 +467,7 @@ _tg ()\n> >>       delete)      _tg_delete ;;\n> >>       depend)      _tg_depend ;;\n> >>       export)      _tg_export ;;\n> >> +     files)       _tg_patch ;;\n> >>       help)        _tg_help ;;\n> >>       import)      _tg_import ;;\n> >>       info)        _tg_info ;;\n> >> diff --git a/tg-files.sh b/tg-files.sh\n> >> new file mode 100644\n> >> index 0000000..0723bf1 tg-files.sh\n> >> --- /dev/null\n> >> +++ b/tg-files.sh\n> >> @@ -0,0 +1,52 @@\n> >> +#!/bin/sh\n> >> +# TopGit - A different patch queue manager\n> >> +# (c) Petr Baudis <pasky@suse.cz>  2008\n> >> +# GPLv2\n> >> +\n> >> +name=\n> >> +\n> >> +topic=\n> >> +diff_opts=\n> >> +diff_committed_only=yes      # will be unset for index/worktree\n> >> +\n> >> +\n> >> +## Parse options\n> >> +\n> >> +while [ -n \"$1\" ]; do\n> >> +     arg=\"$1\"; shift\n> >> +     case \"$arg\" in\n> >> +     -i)\n> >> +             topic='(i)'\n> >> +             diff_opts=\"$diff_opts --cached\";\n> >> +             diff_committed_only=;;\n> >> +     -w)\n> >> +             topic='(w)'\n> >> +             diff_committed_only=;;\n> >> +     -*)\n> >> +             echo \"Usage: tg [...] files [-i | -w] [NAME]\" >&2\n> >> +             exit 1;;\n> >> +     *)\n> >> +             [ -z \"$name\" ] || die \"name already specified ($name)\"\n> >> +             name=\"$arg\";;\n> >> +     esac\n> >> +done\n> >> +\n> >> +\n> >> +[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n> >> +     die \"-i/-w are mutually exclusive with NAME\"\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> >> +     die \"not a TopGit-controlled branch\"\n> >> +\n> >> +# if not index/worktree, topic is current branch\n> >> +[ -z \"$topic\" ] && topic=\"$name\"\n> >> +\n> >> +\n> >> +\n> >> +# Evil obnoxious hack to work around the lack of git diff --exclude\n> >> +git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n> >> +     fgrep -vx \".topdeps\" |\n> >> +     fgrep -vx \".topmsg\" || : # fgrep likes to fail randomly?\n> > Instead of using fgrep you could export the branch and call git diff\n> > --name-only $diff_opts on the resulting commit?\n> \n> If you mean using tg-export, than I think this is a bad idea. The\n> operation will than be O(n), with n the total number of depending\n> branches.\n> \n> I think a pretty_tree on the base and the branch with git diff-tree\n> should suffice:\n> \n> git diff-tree --name-only $(pretty_tree refs/top-bases/$name)\n> $(pretty_tree $name)\nThat's what I thought after sending the mail and shuting down my machine\n:-)\n\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152471","messageId":"AANLkTi=EcKuUUaGvEPk+DQ-S5q4CvKh6MN0O8Aup1V-a@mail.gmail.com","threadId":"25320","inReplyTo":"20101003215520.GC28679@pengutronix.de","subject":"Re: [TopGit PATCH 4/6] tg-prev/tg-next: commands to explore dependencies","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T06:48:26Z","receivedAt":"2010-10-04T06:48:26Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2010/10/3 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hi,\n>\n> On Sun, Oct 03, 2010 at 11:25:55PM +0200, Bert Wesarg wrote:\n>> Two new commands to explore the dependencies of TopGit branches:\n>>\n>>   a) tg prev [-i | -w] [NAME]\n>>      outputs the dependencies of NAME\n>>\n>>   b) tg next [-i | -w] [NAME]\n>>      outputs branches which depends on NAME\n> I wonder if this is somehow mergable with Per's checkout [next|prev].\n> (contained in git://repo.or.cz/topgit/tsort.git, t/checkout)\n>\n> What do you think?\n\nWhile this is obviously possible. I'm more a friend of many small\ncommands like quilt has it.\n\nAlso, I have a follow-up patch that prints all offending branches, not\nonly the directly one (--all option).\n\nBert\n\n>\n> Best regards\n> Uwe\n"},{"id":"152472","messageId":"AANLkTi=-2fHW30vxvc8q30KPfE0YWxUfuqzvk15fmtO6@mail.gmail.com","threadId":"25320","inReplyTo":"20101004064747.GJ28679@pengutronix.de","subject":"Re: [TopGit PATCH 3/6] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T06:50:11Z","receivedAt":"2010-10-04T06:50:11Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2010/10/4 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hello Bert,\n>\n> On Mon, Oct 04, 2010 at 08:43:52AM +0200, Bert Wesarg wrote:\n>> git diff-tree --name-only $(pretty_tree refs/top-bases/$name)\n>> $(pretty_tree $name)\n> That's what I thought after sending the mail and shuting down my machine\n> :-)\n\nBut what about the -w and -i option now?\n\n>\n> Uwe\n"},{"id":"152474","messageId":"20101004065918.GL28679@pengutronix.de","threadId":"25320","inReplyTo":"AANLkTi=-2fHW30vxvc8q30KPfE0YWxUfuqzvk15fmtO6@mail.gmail.com","subject":"Re: [TopGit PATCH 3/6] tg-files: list files changed by the topic branch","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-04T06:59:18Z","receivedAt":"2010-10-04T06:59:18Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hi Bert,\n\nOn Mon, Oct 04, 2010 at 08:50:11AM +0200, Bert Wesarg wrote:\n> 2010/10/4 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> > On Mon, Oct 04, 2010 at 08:43:52AM +0200, Bert Wesarg wrote:\n> >> git diff-tree --name-only $(pretty_tree refs/top-bases/$name)\n> >> $(pretty_tree $name)\n> > That's what I thought after sending the mail and shuting down my machine\n> > :-)\n> \n> But what about the -w and -i option now?\nFor these we need pretty_tree -i and pretty_tree -w?!\n\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152522","messageId":"1286198194-12873-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"20101004065918.GL28679@pengutronix.de","subject":"[TopGit PATCH] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T13:16:34Z","receivedAt":"2010-10-04T13:16:34Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"this could also be a --name-only option to tg-patch. But I Like the\nsimilarity to 'quilt files'.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\n> For these we need pretty_tree -i and pretty_tree -w?!\nDone and moved to tg.sh. tg-patch should now be updated.\n\nRegards,\nBert\n\n .gitignore                 |    2 +\n README                     |    8 +++++++\n contrib/tg-completion.bash |    1 +\n tg-export.sh               |    9 --------\n tg-files.sh                |   43 ++++++++++++++++++++++++++++++++++++++\n tg.sh                      |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 6 files changed, 103 insertions(+), 9 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 0342e09..0dc4d0e 100644 .gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -22,6 +22,8 @@\n /tg-depend.txt\n /tg-export\n /tg-export.txt\n+/tg-files\n+/tg-files.txt\n /tg-import\n /tg-import.txt\n /tg-info\ndiff --git a/README b/README\nindex f103d92..46f564a 100644 README\n--- a/README\n+++ b/README\n@@ -272,6 +272,14 @@ tg depend\n \n \tTODO: Subcommand for removing dependencies, obviously\n \n+tg files\n+~~~~~~~~\n+\tList files changed by the current or specified topic branch.\n+\n+\tOptions:\n+\t  -i\t\tlist files based on index instead of branch\n+\t  -w\t\tlist files based on working tree instead of branch\n+\n tg info\n ~~~~~~~\n \tShow a summary information about the current or specified\ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex 0ee233c..38567d0 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -467,6 +467,7 @@ _tg ()\n \tdelete)      _tg_delete ;;\n \tdepend)      _tg_depend ;;\n \texport)      _tg_export ;;\n+\tfiles)       _tg_patch ;;\n \thelp)        _tg_help ;;\n \timport)      _tg_import ;;\n \tinfo)        _tg_info ;;\ndiff --git a/tg-export.sh b/tg-export.sh\nindex 6d82d55..4b0148c 100644 tg-export.sh\n--- a/tg-export.sh\n+++ b/tg-export.sh\n@@ -63,15 +63,6 @@ trap 'rm -rf \"$playground\"' EXIT\n \n ## Collapse driver\n \n-# pretty_tree NAME\n-# Output tree ID of a cleaned-up tree without tg's artifacts.\n-pretty_tree()\n-{\n-\tgit ls-tree --full-tree \"$1\" \\\n-\t| awk -F '\t' '$2 !~ /^.top/' \\\n-\t| git mktree\n-}\n-\n create_tg_commit()\n {\n \tname=\"$1\"\ndiff --git a/tg-files.sh b/tg-files.sh\nnew file mode 100644\nindex 0000000..4e9c5cd tg-files.sh\n--- /dev/null\n+++ b/tg-files.sh\n@@ -0,0 +1,43 @@\n+#!/bin/sh\n+# TopGit - A different patch queue manager\n+# (c) Petr Baudis <pasky@suse.cz>  2008\n+# GPLv2\n+\n+name=\n+topic=\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-i)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n+\t\ttopic=-i;;\n+\t-w)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n+\t\ttopic=-w;;\n+\t-*)\n+\t\techo \"Usage: tg [...] files [-i | -w] [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+[ -n \"$name\" -a -n \"$topic\" ] &&\n+\tdie \"-i/-w are mutually exclusive with NAME\"\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+b_tree=$(prett_tree \"$name\" -b)\n+t_tree=$(prett_tree \"$name\" $topic)\n+\n+git diff-tree --name-only -r $b_tree $t_tree\n+\n+# vim:noet\ndiff --git a/tg.sh b/tg.sh\nindex 9d08d63..ff39483 100644 tg.sh\n--- a/tg.sh\n+++ b/tg.sh\n@@ -39,6 +39,55 @@ cat_file()\n \tesac\n }\n \n+# get tree for topic\n+get_tree_()\n+{\n+\techo \"$1\"\n+}\n+\n+# get tree for base\n+get_tree_b()\n+{\n+\techo \"refs/top-bases/$1\"\n+}\n+\n+# get tree for index\n+get_tree_i()\n+{\n+\tgit write-tree\n+}\n+\n+# get tree for worktree\n+get_tree_w()\n+{\n+\ti_tree=$(git write-tree)\n+\t(\n+\t\tTMP_INDEX=\"$(mktemp -t tg-files-index.XXXXXX)\"\n+\t\trm -f \"$TMP_INDEX\" &&\n+\t\t: ${GIT_DIR:=\"$root_dir/.git\"} &&\n+\t\tcp -p ${GIT_INDEX_FILE-\"$GIT_DIR/index\"} \"$TMP_INDEX\" &&\n+\t\tGIT_INDEX_FILE=\"$TMP_INDEX\" &&\n+\t\texport GIT_INDEX_FILE &&\n+\t\tgit read-tree -m $i_tree &&\n+\t\tgit diff --name-only -z HEAD |\n+\t\t\tgit update-index -z --add --remove --stdin &&\n+\t\tgit write-tree &&\n+\t\trm -f \"$TMP_INDEX\"\n+\t)\n+}\n+\n+# pretty_tree NAME [-b | -i | -w]\n+# Output tree ID of a cleaned-up tree without tg's artifacts.\n+# NAME will be ignored for -i and -w, but needs to be present\n+prett_tree()\n+{\n+\tname=$1\n+\tsource=${2#?}\n+\tgit ls-tree --full-tree \"$(get_tree_$source \"$name\")\" |\n+\t\tawk -F '\t' '$2 !~ /^.top/' |\n+\t\tgit mktree\n+}\n+\n # setup_hook NAME\n setup_hook()\n {\n-- \ntg: (9404aa1..) bw/files (depends on: master)\n"},{"id":"152528","messageId":"20101004135200.GD11737@pengutronix.de","threadId":"25320","inReplyTo":"1286198194-12873-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH] tg-files: list files changed by the topic branch","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-04T13:52:00Z","receivedAt":"2010-10-04T13:52:00Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"On Mon, Oct 04, 2010 at 03:16:34PM +0200, Bert Wesarg wrote:\n> this could also be a --name-only option to tg-patch. But I Like the\n> similarity to 'quilt files'.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> \n> ---\n> \n> > For these we need pretty_tree -i and pretty_tree -w?!\n> Done and moved to tg.sh. tg-patch should now be updated.\n> \n> Regards,\n> Bert\n> \n>  .gitignore                 |    2 +\n>  README                     |    8 +++++++\n>  contrib/tg-completion.bash |    1 +\n>  tg-export.sh               |    9 --------\n>  tg-files.sh                |   43 ++++++++++++++++++++++++++++++++++++++\n>  tg.sh                      |   49 ++++++++++++++++++++++++++++++++++++++++++++\n>  6 files changed, 103 insertions(+), 9 deletions(-)\n> \n> diff --git a/.gitignore b/.gitignore\n> index 0342e09..0dc4d0e 100644 .gitignore\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -22,6 +22,8 @@\n>  /tg-depend.txt\n>  /tg-export\n>  /tg-export.txt\n> +/tg-files\n> +/tg-files.txt\n>  /tg-import\n>  /tg-import.txt\n>  /tg-info\n> diff --git a/README b/README\n> index f103d92..46f564a 100644 README\n> --- a/README\n> +++ b/README\n> @@ -272,6 +272,14 @@ tg depend\n>  \n>  \tTODO: Subcommand for removing dependencies, obviously\n>  \n> +tg files\n> +~~~~~~~~\n> +\tList files changed by the current or specified topic branch.\n> +\n> +\tOptions:\n> +\t  -i\t\tlist files based on index instead of branch\n> +\t  -w\t\tlist files based on working tree instead of branch\n> +\n>  tg info\n>  ~~~~~~~\n>  \tShow a summary information about the current or specified\n> diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\n> index 0ee233c..38567d0 100755 contrib/tg-completion.bash\n> --- a/contrib/tg-completion.bash\n> +++ b/contrib/tg-completion.bash\n> @@ -467,6 +467,7 @@ _tg ()\n>  \tdelete)      _tg_delete ;;\n>  \tdepend)      _tg_depend ;;\n>  \texport)      _tg_export ;;\n> +\tfiles)       _tg_patch ;;\n>  \thelp)        _tg_help ;;\n>  \timport)      _tg_import ;;\n>  \tinfo)        _tg_info ;;\n> diff --git a/tg-export.sh b/tg-export.sh\n> index 6d82d55..4b0148c 100644 tg-export.sh\n> --- a/tg-export.sh\n> +++ b/tg-export.sh\n> @@ -63,15 +63,6 @@ trap 'rm -rf \"$playground\"' EXIT\n>  \n>  ## Collapse driver\n>  \n> -# pretty_tree NAME\n> -# Output tree ID of a cleaned-up tree without tg's artifacts.\n> -pretty_tree()\n> -{\n> -\tgit ls-tree --full-tree \"$1\" \\\n> -\t| awk -F '\t' '$2 !~ /^.top/' \\\n> -\t| git mktree\n> -}\n> -\n>  create_tg_commit()\n>  {\n>  \tname=\"$1\"\n> diff --git a/tg-files.sh b/tg-files.sh\n> new file mode 100644\n> index 0000000..4e9c5cd tg-files.sh\n> --- /dev/null\n> +++ b/tg-files.sh\n> @@ -0,0 +1,43 @@\n> +#!/bin/sh\n> +# TopGit - A different patch queue manager\n> +# (c) Petr Baudis <pasky@suse.cz>  2008\n> +# GPLv2\n> +\n> +name=\n> +topic=\n> +\n> +\n> +## Parse options\n> +\n> +while [ -n \"$1\" ]; do\n> +\targ=\"$1\"; shift\n> +\tcase \"$arg\" in\n> +\t-i)\n> +\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n> +\t\ttopic=-i;;\n> +\t-w)\n> +\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n> +\t\ttopic=-w;;\n> +\t-*)\n> +\t\techo \"Usage: tg [...] files [-i | -w] [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> +[ -n \"$name\" -a -n \"$topic\" ] &&\n> +\tdie \"-i/-w are mutually exclusive with NAME\"\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> +b_tree=$(prett_tree \"$name\" -b)\n> +t_tree=$(prett_tree \"$name\" $topic)\n> +\n> +git diff-tree --name-only -r $b_tree $t_tree\n> +\n> +# vim:noet\n> diff --git a/tg.sh b/tg.sh\n> index 9d08d63..ff39483 100644 tg.sh\n> --- a/tg.sh\n> +++ b/tg.sh\n> @@ -39,6 +39,55 @@ cat_file()\n>  \tesac\n>  }\n>  \n> +# get tree for topic\n> +get_tree_()\n> +{\n> +\techo \"$1\"\n> +}\n> +\n> +# get tree for base\n> +get_tree_b()\n> +{\n> +\techo \"refs/top-bases/$1\"\n> +}\n> +\n> +# get tree for index\n> +get_tree_i()\n> +{\n> +\tgit write-tree\n> +}\n> +\n> +# get tree for worktree\n> +get_tree_w()\n> +{\n> +\ti_tree=$(git write-tree)\n> +\t(\n> +\t\tTMP_INDEX=\"$(mktemp -t tg-files-index.XXXXXX)\"\n> +\t\trm -f \"$TMP_INDEX\" &&\nwhy remove the temp file here?\n\n> +\t\t: ${GIT_DIR:=\"$root_dir/.git\"} &&\n> +\t\tcp -p ${GIT_INDEX_FILE-\"$GIT_DIR/index\"} \"$TMP_INDEX\" &&\n> +\t\tGIT_INDEX_FILE=\"$TMP_INDEX\" &&\n> +\t\texport GIT_INDEX_FILE &&\n> +\t\tgit read-tree -m $i_tree &&\nCouldn't the same be done by just doing:\n\n\tgit read-tree -m $i_tree --index-output=\"$TMP_INDEX\"\n\n> +\t\tgit diff --name-only -z HEAD |\n> +\t\t\tgit update-index -z --add --remove --stdin &&\n> +\t\tgit write-tree &&\n> +\t\trm -f \"$TMP_INDEX\"\n> +\t)\n> +}\n> +\n> +# pretty_tree NAME [-b | -i | -w]\n> +# Output tree ID of a cleaned-up tree without tg's artifacts.\n> +# NAME will be ignored for -i and -w, but needs to be present\n> +prett_tree()\nCan we please have the y back? :-)\n\n> +{\n> +\tname=$1\n> +\tsource=${2#?}\n> +\tgit ls-tree --full-tree \"$(get_tree_$source \"$name\")\" |\n> +\t\tawk -F '\t' '$2 !~ /^.top/' |\n> +\t\tgit mktree\n> +}\n> +\n>  # setup_hook NAME\n>  setup_hook()\n>  {\n> -- \n> tg: (9404aa1..) bw/files (depends on: master)\n> \n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152539","messageId":"AANLkTinv40O_gdMdEbTOV6LQKBNjksAGKMOtewwauMjP@mail.gmail.com","threadId":"25320","inReplyTo":"20101004135200.GD11737@pengutronix.de","subject":"Re: [TopGit PATCH] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T16:02:09Z","receivedAt":"2010-10-04T16:02:09Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2010/10/4 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> On Mon, Oct 04, 2010 at 03:16:34PM +0200, Bert Wesarg wrote:\n>> this could also be a --name-only option to tg-patch. But I Like the\n>> similarity to 'quilt files'.\n>>\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>> ---\n>>\n>> > For these we need pretty_tree -i and pretty_tree -w?!\n>> Done and moved to tg.sh. tg-patch should now be updated.\n>>\n>> Regards,\n>> Bert\n>>\n>>  .gitignore                 |    2 +\n>>  README                     |    8 +++++++\n>>  contrib/tg-completion.bash |    1 +\n>>  tg-export.sh               |    9 --------\n>>  tg-files.sh                |   43 ++++++++++++++++++++++++++++++++++++++\n>>  tg.sh                      |   49 ++++++++++++++++++++++++++++++++++++++++++++\n>>  6 files changed, 103 insertions(+), 9 deletions(-)\n>>\n>> diff --git a/.gitignore b/.gitignore\n>> index 0342e09..0dc4d0e 100644 .gitignore\n>> --- a/.gitignore\n>> +++ b/.gitignore\n>> @@ -22,6 +22,8 @@\n>>  /tg-depend.txt\n>>  /tg-export\n>>  /tg-export.txt\n>> +/tg-files\n>> +/tg-files.txt\n>>  /tg-import\n>>  /tg-import.txt\n>>  /tg-info\n>> diff --git a/README b/README\n>> index f103d92..46f564a 100644 README\n>> --- a/README\n>> +++ b/README\n>> @@ -272,6 +272,14 @@ tg depend\n>>\n>>       TODO: Subcommand for removing dependencies, obviously\n>>\n>> +tg files\n>> +~~~~~~~~\n>> +     List files changed by the current or specified topic branch.\n>> +\n>> +     Options:\n>> +       -i            list files based on index instead of branch\n>> +       -w            list files based on working tree instead of branch\n>> +\n>>  tg info\n>>  ~~~~~~~\n>>       Show a summary information about the current or specified\n>> diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\n>> index 0ee233c..38567d0 100755 contrib/tg-completion.bash\n>> --- a/contrib/tg-completion.bash\n>> +++ b/contrib/tg-completion.bash\n>> @@ -467,6 +467,7 @@ _tg ()\n>>       delete)      _tg_delete ;;\n>>       depend)      _tg_depend ;;\n>>       export)      _tg_export ;;\n>> +     files)       _tg_patch ;;\n>>       help)        _tg_help ;;\n>>       import)      _tg_import ;;\n>>       info)        _tg_info ;;\n>> diff --git a/tg-export.sh b/tg-export.sh\n>> index 6d82d55..4b0148c 100644 tg-export.sh\n>> --- a/tg-export.sh\n>> +++ b/tg-export.sh\n>> @@ -63,15 +63,6 @@ trap 'rm -rf \"$playground\"' EXIT\n>>\n>>  ## Collapse driver\n>>\n>> -# pretty_tree NAME\n>> -# Output tree ID of a cleaned-up tree without tg's artifacts.\n>> -pretty_tree()\n>> -{\n>> -     git ls-tree --full-tree \"$1\" \\\n>> -     | awk -F '      ' '$2 !~ /^.top/' \\\n>> -     | git mktree\n>> -}\n>> -\n>>  create_tg_commit()\n>>  {\n>>       name=\"$1\"\n>> diff --git a/tg-files.sh b/tg-files.sh\n>> new file mode 100644\n>> index 0000000..4e9c5cd tg-files.sh\n>> --- /dev/null\n>> +++ b/tg-files.sh\n>> @@ -0,0 +1,43 @@\n>> +#!/bin/sh\n>> +# TopGit - A different patch queue manager\n>> +# (c) Petr Baudis <pasky@suse.cz>  2008\n>> +# GPLv2\n>> +\n>> +name=\n>> +topic=\n>> +\n>> +\n>> +## Parse options\n>> +\n>> +while [ -n \"$1\" ]; do\n>> +     arg=\"$1\"; shift\n>> +     case \"$arg\" in\n>> +     -i)\n>> +             [ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n>> +             topic=-i;;\n>> +     -w)\n>> +             [ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n>> +             topic=-w;;\n>> +     -*)\n>> +             echo \"Usage: tg [...] files [-i | -w] [NAME]\" >&2\n>> +             exit 1;;\n>> +     *)\n>> +             [ -z \"$name\" ] || die \"name already specified ($name)\"\n>> +             name=\"$arg\";;\n>> +     esac\n>> +done\n>> +\n>> +\n>> +[ -n \"$name\" -a -n \"$topic\" ] &&\n>> +     die \"-i/-w are mutually exclusive with NAME\"\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>> +     die \"not a TopGit-controlled branch\"\n>> +\n>> +b_tree=$(prett_tree \"$name\" -b)\n>> +t_tree=$(prett_tree \"$name\" $topic)\n>> +\n>> +git diff-tree --name-only -r $b_tree $t_tree\n>> +\n>> +# vim:noet\n>> diff --git a/tg.sh b/tg.sh\n>> index 9d08d63..ff39483 100644 tg.sh\n>> --- a/tg.sh\n>> +++ b/tg.sh\n>> @@ -39,6 +39,55 @@ cat_file()\n>>       esac\n>>  }\n>>\n>> +# get tree for topic\n>> +get_tree_()\n>> +{\n>> +     echo \"$1\"\n>> +}\n>> +\n>> +# get tree for base\n>> +get_tree_b()\n>> +{\n>> +     echo \"refs/top-bases/$1\"\n>> +}\n>> +\n>> +# get tree for index\n>> +get_tree_i()\n>> +{\n>> +     git write-tree\n>> +}\n>> +\n>> +# get tree for worktree\n>> +get_tree_w()\n>> +{\n>> +     i_tree=$(git write-tree)\n>> +     (\n>> +             TMP_INDEX=\"$(mktemp -t tg-files-index.XXXXXX)\"\n>> +             rm -f \"$TMP_INDEX\" &&\n> why remove the temp file here?\n\nThis code block was from git-stash. Will remove that.\n\n>\n>> +             : ${GIT_DIR:=\"$root_dir/.git\"} &&\n>> +             cp -p ${GIT_INDEX_FILE-\"$GIT_DIR/index\"} \"$TMP_INDEX\" &&\n>> +             GIT_INDEX_FILE=\"$TMP_INDEX\" &&\n>> +             export GIT_INDEX_FILE &&\n>> +             git read-tree -m $i_tree &&\n> Couldn't the same be done by just doing:\n>\n>        git read-tree -m $i_tree --index-output=\"$TMP_INDEX\"\n\nI don't know. Maybe. But the subsequent git commands need to operate\non $TMP_INDEX, so the only thing we safe is the cp.\n\n>\n>> +             git diff --name-only -z HEAD |\n>> +                     git update-index -z --add --remove --stdin &&\n>> +             git write-tree &&\n>> +             rm -f \"$TMP_INDEX\"\n>> +     )\n>> +}\n>> +\n>> +# pretty_tree NAME [-b | -i | -w]\n>> +# Output tree ID of a cleaned-up tree without tg's artifacts.\n>> +# NAME will be ignored for -i and -w, but needs to be present\n>> +prett_tree()\n> Can we please have the y back? :-)\n\nSure.\n\nBert\n"},{"id":"152564","messageId":"1286216867-14701-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"AANLkTinv40O_gdMdEbTOV6LQKBNjksAGKMOtewwauMjP@mail.gmail.com","subject":"[TopGit PATCH v3] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T18:27:47Z","receivedAt":"2010-10-04T18:27:47Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"this could also be a --name-only option to tg-patch. But I Like the\nsimilarity to 'quilt files'.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\n Changes:\n  v3:\n   * use --index-output= option in read-tree\n   * use $git_dir instead of $root_dir/.git\n   * bring back the y\n  v2:\n   * work on trees\n\n .gitignore                 |    2 +\n README                     |    8 +++++++\n contrib/tg-completion.bash |    1 +\n tg-export.sh               |    9 --------\n tg-files.sh                |   43 ++++++++++++++++++++++++++++++++++++++\n tg.sh                      |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 6 files changed, 103 insertions(+), 9 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 0342e09..0dc4d0e 100644 .gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -22,6 +22,8 @@\n /tg-depend.txt\n /tg-export\n /tg-export.txt\n+/tg-files\n+/tg-files.txt\n /tg-import\n /tg-import.txt\n /tg-info\ndiff --git a/README b/README\nindex f103d92..46f564a 100644 README\n--- a/README\n+++ b/README\n@@ -272,6 +272,14 @@ tg depend\n \n \tTODO: Subcommand for removing dependencies, obviously\n \n+tg files\n+~~~~~~~~\n+\tList files changed by the current or specified topic branch.\n+\n+\tOptions:\n+\t  -i\t\tlist files based on index instead of branch\n+\t  -w\t\tlist files based on working tree instead of branch\n+\n tg info\n ~~~~~~~\n \tShow a summary information about the current or specified\ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex 0ee233c..38567d0 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -467,6 +467,7 @@ _tg ()\n \tdelete)      _tg_delete ;;\n \tdepend)      _tg_depend ;;\n \texport)      _tg_export ;;\n+\tfiles)       _tg_patch ;;\n \thelp)        _tg_help ;;\n \timport)      _tg_import ;;\n \tinfo)        _tg_info ;;\ndiff --git a/tg-export.sh b/tg-export.sh\nindex 6d82d55..4b0148c 100644 tg-export.sh\n--- a/tg-export.sh\n+++ b/tg-export.sh\n@@ -63,15 +63,6 @@ trap 'rm -rf \"$playground\"' EXIT\n \n ## Collapse driver\n \n-# pretty_tree NAME\n-# Output tree ID of a cleaned-up tree without tg's artifacts.\n-pretty_tree()\n-{\n-\tgit ls-tree --full-tree \"$1\" \\\n-\t| awk -F '\t' '$2 !~ /^.top/' \\\n-\t| git mktree\n-}\n-\n create_tg_commit()\n {\n \tname=\"$1\"\ndiff --git a/tg-files.sh b/tg-files.sh\nnew file mode 100644\nindex 0000000..b88940a tg-files.sh\n--- /dev/null\n+++ b/tg-files.sh\n@@ -0,0 +1,43 @@\n+#!/bin/sh\n+# TopGit - A different patch queue manager\n+# (c) Petr Baudis <pasky@suse.cz>  2008\n+# GPLv2\n+\n+name=\n+topic=\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-i)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n+\t\ttopic=-i;;\n+\t-w)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n+\t\ttopic=-w;;\n+\t-*)\n+\t\techo \"Usage: tg [...] files [-i | -w] [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+[ -n \"$name\" -a -n \"$topic\" ] &&\n+\tdie \"-i/-w are mutually exclusive with NAME\"\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+b_tree=$(pretty_tree \"$name\" -b)\n+t_tree=$(pretty_tree \"$name\" $topic)\n+\n+git diff-tree --name-only -r $b_tree $t_tree\n+\n+# vim:noet\ndiff --git a/tg.sh b/tg.sh\nindex 9d08d63..2bc6bed 100644 tg.sh\n--- a/tg.sh\n+++ b/tg.sh\n@@ -39,6 +39,55 @@ cat_file()\n \tesac\n }\n \n+# get tree for the committed topic\n+get_tree_()\n+{\n+\techo \"$1\"\n+}\n+\n+# get tree for the base\n+get_tree_b()\n+{\n+\techo \"refs/top-bases/$1\"\n+}\n+\n+# get tree for the index\n+get_tree_i()\n+{\n+\tgit write-tree\n+}\n+\n+# get tree for the worktree\n+get_tree_w()\n+{\n+\ti_tree=$(git write-tree)\n+\t(\n+\t\t# the file for --index-output needs to sit next to the\n+\t\t# current index file\n+\t\t: ${GIT_INDEX_FILE:=\"$git_dir/index\"}\n+\t\tTMP_INDEX=\"$(mktemp \"${GIT_INDEX_FILE}-tg.XXXXXX\")\"\n+\t\tgit read-tree -m $i_tree --index-output=\"$TMP_INDEX\" &&\n+\t\tGIT_INDEX_FILE=\"$TMP_INDEX\" &&\n+\t\texport GIT_INDEX_FILE &&\n+\t\tgit diff --name-only -z HEAD |\n+\t\t\tgit update-index -z --add --remove --stdin &&\n+\t\tgit write-tree &&\n+\t\trm -f \"$TMP_INDEX\"\n+\t)\n+}\n+\n+# pretty_tree NAME [-b | -i | -w]\n+# Output tree ID of a cleaned-up tree without tg's artifacts.\n+# NAME will be ignored for -i and -w, but needs to be present\n+pretty_tree()\n+{\n+\tname=$1\n+\tsource=${2#?}\n+\tgit ls-tree --full-tree \"$(get_tree_$source \"$name\")\" |\n+\t\tawk -F '\t' '$2 !~ /^.top/' |\n+\t\tgit mktree\n+}\n+\n # setup_hook NAME\n setup_hook()\n {\n-- \ntg: (9404aa1..) bw/files (depends on: master)\n"},{"id":"152575","messageId":"1286219189-22054-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"AANLkTi=sc-FBG=CeNTv9H4Fj0KqdHkoudjQHqEYZxPuV@mail.gmail.com","subject":"[TopGit PATCH] tg-log: move note from tg base to tg log","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T19:06:29Z","receivedAt":"2010-10-04T19:06:29Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n README |   15 ++++++---------\n 1 files changed, 6 insertions(+), 9 deletions(-)\n\ndiff --git a/README b/README\nindex ce0c3a6..2331117 100644 README\n--- a/README\n+++ b/README\n@@ -514,20 +514,17 @@ tg base\n ~~~~~~~\n \tPrints the base commit of the current topic branch.  Silently\n \texits with exit code 1 if you are not working on a TopGit\n-\tbranch.  The following command can be useful to get a summary\n-\tof the work you have made on a topic branch:\n-\n-\t\tgit log --first-parent --no-merges `tg base`..\n-\n-\t(Note: if you have shared the TopGit branch, the above command\n-\tonly lists the commits that were made in the current\n-\trepository, so you will not see work done by your\n-\tcollaborators.)\n+\tbranch.\n \n tg log\n ~~~~~~\n \tPrints the git log of the named topgit branch.\n \n+\tNote: if you have shared the TopGit branch, this command\n+\tonly lists the commits that where made in the current\n+\trepository, so you will not see work done by your\n+\tcollaborators.\n+\n TODO: tg rename\n \n \n-- \ntg: (ff59ac7..) bw/log (depends on: master)\n"},{"id":"152585","messageId":"1286222981-28358-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"1286216867-14701-1-git-send-email-bert.wesarg@googlemail.com","subject":"[TopGit PATCH] tg-patch: use pretty_tree","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T20:09:41Z","receivedAt":"2010-10-04T20:09:41Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This applies the same treatment to tg-patch like tg-files got in v2.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n tg-patch.sh |   56 ++++++++++++++++++++++++++++++++------------------------\n 1 files changed, 32 insertions(+), 24 deletions(-)\n\ndiff --git a/tg-patch.sh b/tg-patch.sh\nindex 7bafdfe..0ebef7a 100644\n--- a/tg-patch.sh\n+++ b/tg-patch.sh\n@@ -4,11 +4,8 @@\n # GPLv2\n \n name=\n-\n topic=\n-diff_opts=\n-diff_committed_only=yes\t# will be unset for index/worktree\n-\n+topic_for_pretty_tree=\n \n ## Parse options\n \n@@ -16,12 +13,13 @@ while [ -n \"$1\" ]; do\n \targ=\"$1\"; shift\n \tcase \"$arg\" in\n \t-i)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n \t\ttopic='(i)'\n-\t\tdiff_opts=\"$diff_opts --cached\";\n-\t\tdiff_committed_only=;;\n+\t\ttopic_for_pretty_tree=-i;;\n \t-w)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n \t\ttopic='(w)'\n-\t\tdiff_committed_only=;;\n+\t\ttopic_for_pretty_tree=-w;;\n \t-*)\n \t\techo \"Usage: tg [...] patch [-i | -w] [NAME]\" >&2\n \t\texit 1;;\n@@ -32,7 +30,7 @@ while [ -n \"$1\" ]; do\n done\n \n \n-[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n+[ -n \"$name\" -a -n \"$topic\" ] &&\n \tdie \"-i/-w are mutually exclusive with NAME\"\n \n [ -n \"$name\" ] || name=\"$(git symbolic-ref HEAD | sed 's#^refs/\\(heads\\|top-bases\\)/##')\"\n@@ -46,22 +44,32 @@ base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\"\n \n setup_pager\n \n-cat_file \"$topic:.topmsg\"\n-echo\n-[ -n \"$(git grep $diff_opts '^[-]--' ${diff_committed_only:+\"$name\"} -- \".topmsg\")\" ] || echo '---'\n-\n-# Evil obnoxious hack to work around the lack of git diff --exclude\n-git_is_stupid=\"$(mktemp -t tg-patch-changes.XXXXXX)\"\n-git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n-\tfgrep -vx \".topdeps\" |\n-\tfgrep -vx \".topmsg\" >\"$git_is_stupid\" || : # fgrep likes to fail randomly?\n-if [ -s \"$git_is_stupid\" ]; then\n-\tcd \"$root_dir\"\n-\tcat \"$git_is_stupid\" | xargs git diff -a --patch-with-stat $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} --\n-else\n-\techo \"No changes.\"\n-fi\n-rm \"$git_is_stupid\"\n+# put out the commit message\n+# and put an empty line out, if the last one in the message was not an empty line\n+# and put out \"---\" if the commit message does not have one yet\n+cat_file \"$topic:.topmsg\" |\n+\tawk '\n+/^---/ {\n+    has_3dash=1;\n+}\n+       {\n+    need_empty = 1;\n+    if ($0 == \"\")\n+        need_empty = 0;\n+    print;\n+}\n+END    {\n+    if (need_empty)\n+        print \"\";\n+    if (!has_3dash)\n+        print \"---\";\n+}\n+'\n+\n+b_tree=$(pretty_tree \"$name\" -b)\n+t_tree=$(pretty_tree \"$name\" $topic_for_pretty_tree)\n+\n+git diff-tree -p --stat -r $b_tree $t_tree\n \n echo '-- '\n echo \"tg: ($base_rev..) $name (depends on: $(cat_file \"$topic:.topdeps\" | paste -s -d' '))\"\n-- \ntg: (c9ca19b..) bw/tg-patch-pretty_tree (depends on: bw/files)\n"},{"id":"152597","messageId":"87vd5h1xei.fsf@gmail.com","threadId":"25320","inReplyTo":"1286219189-22054-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH] tg-log: move note from tg base to tg log","fromName":"Štěpán Němec","fromEmail":"stepnem@gmail.com","sentAt":"2010-10-04T21:05:41Z","receivedAt":"2010-10-04T21:05:41Z","isPatch":true,"sender":{"key":"stepnem@gmail.com","avatar":"https://avatars.githubusercontent.com/u/106838?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n[...]\n\n> -\t(Note: if you have shared the TopGit branch, the above command\n> -\tonly lists the commits that were made in the current\n> -\trepository, so you will not see work done by your\n> -\tcollaborators.)\n> +\tbranch.\n>  \n>  tg log\n>  ~~~~~~\n>  \tPrints the git log of the named topgit branch.\n>  \n> +\tNote: if you have shared the TopGit branch, this command\n> +\tonly lists the commits that where made in the current\n                                    ^^^^^\n                                    \nYou managed to introduce a typo while (mostly just) moving the paragraph. :-)\n\nŠtěpán\n"},{"id":"152599","messageId":"AANLkTine7qKg_jCMxt-OfE5bqitr5b4NacTF5jnsBNDw@mail.gmail.com","threadId":"25320","inReplyTo":"87vd5h1xei.fsf@gmail.com","subject":"Re: [TopGit PATCH] tg-log: move note from tg base to tg log","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T21:08:55Z","receivedAt":"2010-10-04T21:08:55Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Mon, Oct 4, 2010 at 23:05, Štěpán Němec <stepnem@gmail.com> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>\n> [...]\n>\n>> -     (Note: if you have shared the TopGit branch, the above command\n>> -     only lists the commits that were made in the current\n>> -     repository, so you will not see work done by your\n>> -     collaborators.)\n>> +     branch.\n>>\n>>  tg log\n>>  ~~~~~~\n>>       Prints the git log of the named topgit branch.\n>>\n>> +     Note: if you have shared the TopGit branch, this command\n>> +     only lists the commits that where made in the current\n>                                    ^^^^^\n>\n> You managed to introduce a typo while (mostly just) moving the paragraph. :-)\n\nAnd I thought I fixed this typo ;-)\n\nThanks.\n\nBert\n\n>\n> Štěpán\n>\n"},{"id":"152619","messageId":"AANLkTinOOzY2wk3Z89D2K8qDuHZkj65L56bHr79q2jpT@mail.gmail.com","threadId":"25320","inReplyTo":"1286222981-28358-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH] tg-patch: use pretty_tree","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-04T23:02:07Z","receivedAt":"2010-10-04T23:02:07Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Mon, Oct 4, 2010 at 22:09, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> @@ -46,22 +44,32 @@ base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\"\n>\n>  setup_pager\n:\n> +git diff-tree -p --stat -r $b_tree $t_tree\n\nThere is currently no color output and I don't know if a simple\n--color suffice here.\n\nBert\n\n>\n>  echo '-- '\n>  echo \"tg: ($base_rev..) $name (depends on: $(cat_file \"$topic:.topdeps\" | paste -s -d' '))\"\n> --\n> tg: (c9ca19b..) bw/tg-patch-pretty_tree (depends on: bw/files)\n>\n"},{"id":"152645","messageId":"20101005071723.GG11737@pengutronix.de","threadId":"25320","inReplyTo":"1286216867-14701-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH v3] tg-files: list files changed by the topic branch","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-05T07:17:23Z","receivedAt":"2010-10-05T07:17:23Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nOn Mon, Oct 04, 2010 at 08:27:47PM +0200, Bert Wesarg wrote:\n> this could also be a --name-only option to tg-patch. But I Like the\n> similarity to 'quilt files'.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> \n> ---\n> \n>  Changes:\n>   v3:\n>    * use --index-output= option in read-tree\n>    * use $git_dir instead of $root_dir/.git\n>    * bring back the y\n>   v2:\n>    * work on trees\n> \n>  .gitignore                 |    2 +\n>  README                     |    8 +++++++\n>  contrib/tg-completion.bash |    1 +\n>  tg-export.sh               |    9 --------\n>  tg-files.sh                |   43 ++++++++++++++++++++++++++++++++++++++\n>  tg.sh                      |   49 ++++++++++++++++++++++++++++++++++++++++++++\n>  6 files changed, 103 insertions(+), 9 deletions(-)\n> \n> diff --git a/.gitignore b/.gitignore\n> index 0342e09..0dc4d0e 100644 .gitignore\n> --- a/.gitignore\n> +++ b/.gitignore\n> @@ -22,6 +22,8 @@\n>  /tg-depend.txt\n>  /tg-export\n>  /tg-export.txt\n> +/tg-files\n> +/tg-files.txt\n>  /tg-import\n>  /tg-import.txt\n>  /tg-info\n> diff --git a/README b/README\n> index f103d92..46f564a 100644 README\n> --- a/README\n> +++ b/README\n> @@ -272,6 +272,14 @@ tg depend\n>  \n>  \tTODO: Subcommand for removing dependencies, obviously\n>  \n> +tg files\n> +~~~~~~~~\n> +\tList files changed by the current or specified topic branch.\n> +\n> +\tOptions:\n> +\t  -i\t\tlist files based on index instead of branch\n> +\t  -w\t\tlist files based on working tree instead of branch\n> +\n>  tg info\n>  ~~~~~~~\n>  \tShow a summary information about the current or specified\n> diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\n> index 0ee233c..38567d0 100755 contrib/tg-completion.bash\n> --- a/contrib/tg-completion.bash\n> +++ b/contrib/tg-completion.bash\n> @@ -467,6 +467,7 @@ _tg ()\n>  \tdelete)      _tg_delete ;;\n>  \tdepend)      _tg_depend ;;\n>  \texport)      _tg_export ;;\n> +\tfiles)       _tg_patch ;;\n>  \thelp)        _tg_help ;;\n>  \timport)      _tg_import ;;\n>  \tinfo)        _tg_info ;;\n> diff --git a/tg-export.sh b/tg-export.sh\n> index 6d82d55..4b0148c 100644 tg-export.sh\n> --- a/tg-export.sh\n> +++ b/tg-export.sh\n> @@ -63,15 +63,6 @@ trap 'rm -rf \"$playground\"' EXIT\n>  \n>  ## Collapse driver\n>  \n> -# pretty_tree NAME\n> -# Output tree ID of a cleaned-up tree without tg's artifacts.\n> -pretty_tree()\n> -{\n> -\tgit ls-tree --full-tree \"$1\" \\\n> -\t| awk -F '\t' '$2 !~ /^.top/' \\\n> -\t| git mktree\n> -}\n> -\n>  create_tg_commit()\n>  {\n>  \tname=\"$1\"\n> diff --git a/tg-files.sh b/tg-files.sh\n> new file mode 100644\n> index 0000000..b88940a tg-files.sh\n> --- /dev/null\n> +++ b/tg-files.sh\n> @@ -0,0 +1,43 @@\n> +#!/bin/sh\n> +# TopGit - A different patch queue manager\n> +# (c) Petr Baudis <pasky@suse.cz>  2008\n> +# GPLv2\n> +\n> +name=\n> +topic=\n> +\n> +\n> +## Parse options\n> +\n> +while [ -n \"$1\" ]; do\n> +\targ=\"$1\"; shift\n> +\tcase \"$arg\" in\n> +\t-i)\n> +\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n> +\t\ttopic=-i;;\n> +\t-w)\n> +\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n> +\t\ttopic=-w;;\nthis can be compressed to:\n\n\t-i|-w)\n\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n\t\ttopic=$arg\n\t\t;;\n\t\n> +\t-*)\n> +\t\techo \"Usage: tg [...] files [-i | -w] [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> +[ -n \"$name\" -a -n \"$topic\" ] &&\n> +\tdie \"-i/-w are mutually exclusive with NAME\"\nWhat about \n\tdie \"$topic is mutually exclusive with NAME\"\n?\n\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> +b_tree=$(pretty_tree \"$name\" -b)\n> +t_tree=$(pretty_tree \"$name\" $topic)\n> +\n> +git diff-tree --name-only -r $b_tree $t_tree\n> +\n> +# vim:noet\n> diff --git a/tg.sh b/tg.sh\n> index 9d08d63..2bc6bed 100644 tg.sh\n> --- a/tg.sh\n> +++ b/tg.sh\n> @@ -39,6 +39,55 @@ cat_file()\n>  \tesac\n>  }\n>  \n> +# get tree for the committed topic\n> +get_tree_()\n> +{\n> +\techo \"$1\"\n> +}\n> +\n> +# get tree for the base\n> +get_tree_b()\n> +{\n> +\techo \"refs/top-bases/$1\"\n> +}\n> +\n> +# get tree for the index\n> +get_tree_i()\n> +{\n> +\tgit write-tree\n> +}\n> +\n> +# get tree for the worktree\n> +get_tree_w()\n> +{\n> +\ti_tree=$(git write-tree)\n> +\t(\n> +\t\t# the file for --index-output needs to sit next to the\n> +\t\t# current index file\n> +\t\t: ${GIT_INDEX_FILE:=\"$git_dir/index\"}\n> +\t\tTMP_INDEX=\"$(mktemp \"${GIT_INDEX_FILE}-tg.XXXXXX\")\"\n> +\t\tgit read-tree -m $i_tree --index-output=\"$TMP_INDEX\" &&\n> +\t\tGIT_INDEX_FILE=\"$TMP_INDEX\" &&\n> +\t\texport GIT_INDEX_FILE &&\n> +\t\tgit diff --name-only -z HEAD |\n> +\t\t\tgit update-index -z --add --remove --stdin &&\n> +\t\tgit write-tree &&\n> +\t\trm -f \"$TMP_INDEX\"\n> +\t)\n> +}\n> +\n> +# pretty_tree NAME [-b | -i | -w]\n> +# Output tree ID of a cleaned-up tree without tg's artifacts.\n> +# NAME will be ignored for -i and -w, but needs to be present\n> +pretty_tree()\n> +{\n> +\tname=$1\n> +\tsource=${2#?}\n> +\tgit ls-tree --full-tree \"$(get_tree_$source \"$name\")\" |\n> +\t\tawk -F '\t' '$2 !~ /^.top/' |\n> +\t\tgit mktree\n> +}\n> +\n>  # setup_hook NAME\n>  setup_hook()\n>  {\n> -- \n> tg: (9404aa1..) bw/files (depends on: master)\n> \n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152646","messageId":"20101005071849.GH11737@pengutronix.de","threadId":"25320","inReplyTo":"AANLkTinOOzY2wk3Z89D2K8qDuHZkj65L56bHr79q2jpT@mail.gmail.com","subject":"Re: [TopGit PATCH] tg-patch: use pretty_tree","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-05T07:18:49Z","receivedAt":"2010-10-05T07:18:49Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nOn Tue, Oct 05, 2010 at 01:02:07AM +0200, Bert Wesarg wrote:\n> On Mon, Oct 4, 2010 at 22:09, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> > @@ -46,22 +44,32 @@ base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\"\n> >\n> >  setup_pager\n> :\n> > +git diff-tree -p --stat -r $b_tree $t_tree\n> \n> There is currently no color output and I don't know if a simple\n> --color suffice here.\n--color=auto maybe?\n\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152654","messageId":"AANLkTikXT=rzOJTTcNOsWkXctKOM3FzQ9ycVtOprLHGh@mail.gmail.com","threadId":"25320","inReplyTo":"20101005071849.GH11737@pengutronix.de","subject":"Re: [TopGit PATCH] tg-patch: use pretty_tree","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-05T08:05:35Z","receivedAt":"2010-10-05T08:05:35Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2010/10/5 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> Hello,\n>\n> On Tue, Oct 05, 2010 at 01:02:07AM +0200, Bert Wesarg wrote:\n>> On Mon, Oct 4, 2010 at 22:09, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n>> > @@ -46,22 +44,32 @@ base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\"\n>> >\n>> >  setup_pager\n>> :\n>> > +git diff-tree -p --stat -r $b_tree $t_tree\n>>\n>> There is currently no color output and I don't know if a simple\n>> --color suffice here.\n> --color=auto maybe?\n\nI think it should depend on the color.diff config option. Is auto the\ndefault, when this is not set?\n\nBert\n\n>\n> Uwe\n>\n> --\n> Pengutronix e.K.                           | Uwe Kleine-König            |\n> Industrial Linux Solutions                 | http://www.pengutronix.de/  |\n>\n"},{"id":"152699","messageId":"1286305402-28284-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"20101005071723.GG11737@pengutronix.de","subject":"[TopGit PATCH v4] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-05T19:03:22Z","receivedAt":"2010-10-05T19:03:22Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"this could also be a --name-only option to tg-patch. But I Like the\nsimilarity to 'quilt files'.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\n Changes:\n  v4:\n   * apply Uwe's suggestions\n  v3:\n   * use --index-output= option in read-tree\n   * use $git_dir instead of $root_dir/.git\n   * bring back the y\n  v2:\n   * work on trees\n\n .gitignore                 |    2 +\n README                     |    8 +++++++\n contrib/tg-completion.bash |    1 +\n tg-export.sh               |    9 --------\n tg-files.sh                |   40 +++++++++++++++++++++++++++++++++++\n tg.sh                      |   49 ++++++++++++++++++++++++++++++++++++++++++++\n 6 files changed, 100 insertions(+), 9 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 3298889..2a4d165 100644 .gitignore\n--- a/.gitignore\n+++ b/.gitignore\n@@ -22,6 +22,8 @@\n /tg-depend.txt\n /tg-export\n /tg-export.txt\n+/tg-files\n+/tg-files.txt\n /tg-import\n /tg-import.txt\n /tg-info\ndiff --git a/README b/README\nindex ce0c3a6..705791b 100644 README\n--- a/README\n+++ b/README\n@@ -272,6 +272,14 @@ tg depend\n \n \tTODO: Subcommand for removing dependencies, obviously\n \n+tg files\n+~~~~~~~~\n+\tList files changed by the current or specified topic branch.\n+\n+\tOptions:\n+\t  -i\t\tlist files based on index instead of branch\n+\t  -w\t\tlist files based on working tree instead of branch\n+\n tg info\n ~~~~~~~\n \tShow a summary information about the current or specified\ndiff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash\nindex ccf1a32..48e47c7 100755 contrib/tg-completion.bash\n--- a/contrib/tg-completion.bash\n+++ b/contrib/tg-completion.bash\n@@ -482,6 +482,7 @@ _tg ()\n \tdelete)      _tg_delete ;;\n \tdepend)      _tg_depend ;;\n \texport)      _tg_export ;;\n+\tfiles)       _tg_patch ;;\n \thelp)        _tg_help ;;\n \timport)      _tg_import ;;\n \tinfo)        _tg_info ;;\ndiff --git a/tg-export.sh b/tg-export.sh\nindex 6d82d55..4b0148c 100644 tg-export.sh\n--- a/tg-export.sh\n+++ b/tg-export.sh\n@@ -63,15 +63,6 @@ trap 'rm -rf \"$playground\"' EXIT\n \n ## Collapse driver\n \n-# pretty_tree NAME\n-# Output tree ID of a cleaned-up tree without tg's artifacts.\n-pretty_tree()\n-{\n-\tgit ls-tree --full-tree \"$1\" \\\n-\t| awk -F '\t' '$2 !~ /^.top/' \\\n-\t| git mktree\n-}\n-\n create_tg_commit()\n {\n \tname=\"$1\"\ndiff --git a/tg-files.sh b/tg-files.sh\nnew file mode 100644\nindex 0000000..5983a7b tg-files.sh\n--- /dev/null\n+++ b/tg-files.sh\n@@ -0,0 +1,40 @@\n+#!/bin/sh\n+# TopGit - A different patch queue manager\n+# (c) Petr Baudis <pasky@suse.cz>  2008\n+# GPLv2\n+\n+name=\n+topic=\n+\n+\n+## Parse options\n+\n+while [ -n \"$1\" ]; do\n+\targ=\"$1\"; shift\n+\tcase \"$arg\" in\n+\t-i|-w)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n+\t\ttopic=\"$arg\";;\n+\t-*)\n+\t\techo \"Usage: tg [...] files [-i | -w] [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+[ -n \"$name\" -a -n \"$topic\" ] &&\n+\tdie \"$topic are mutually exclusive with NAME\"\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+b_tree=$(pretty_tree \"$name\" -b)\n+t_tree=$(pretty_tree \"$name\" $topic)\n+\n+git diff-tree --name-only -r $b_tree $t_tree\n+\n+# vim:noet\ndiff --git a/tg.sh b/tg.sh\nindex 3718702..535120e 100644 tg.sh\n--- a/tg.sh\n+++ b/tg.sh\n@@ -39,6 +39,55 @@ cat_file()\n \tesac\n }\n \n+# get tree for the committed topic\n+get_tree_()\n+{\n+\techo \"$1\"\n+}\n+\n+# get tree for the base\n+get_tree_b()\n+{\n+\techo \"refs/top-bases/$1\"\n+}\n+\n+# get tree for the index\n+get_tree_i()\n+{\n+\tgit write-tree\n+}\n+\n+# get tree for the worktree\n+get_tree_w()\n+{\n+\ti_tree=$(git write-tree)\n+\t(\n+\t\t# the file for --index-output needs to sit next to the\n+\t\t# current index file\n+\t\t: ${GIT_INDEX_FILE:=\"$git_dir/index\"}\n+\t\tTMP_INDEX=\"$(mktemp \"${GIT_INDEX_FILE}-tg.XXXXXX\")\"\n+\t\tgit read-tree -m $i_tree --index-output=\"$TMP_INDEX\" &&\n+\t\tGIT_INDEX_FILE=\"$TMP_INDEX\" &&\n+\t\texport GIT_INDEX_FILE &&\n+\t\tgit diff --name-only -z HEAD |\n+\t\t\tgit update-index -z --add --remove --stdin &&\n+\t\tgit write-tree &&\n+\t\trm -f \"$TMP_INDEX\"\n+\t)\n+}\n+\n+# pretty_tree NAME [-b | -i | -w]\n+# Output tree ID of a cleaned-up tree without tg's artifacts.\n+# NAME will be ignored for -i and -w, but needs to be present\n+pretty_tree()\n+{\n+\tname=$1\n+\tsource=${2#?}\n+\tgit ls-tree --full-tree \"$(get_tree_$source \"$name\")\" |\n+\t\tawk -F '\t' '$2 !~ /^.top/' |\n+\t\tgit mktree\n+}\n+\n # setup_hook NAME\n setup_hook()\n {\n-- \ntg: (ff59ac7..) bw/files (depends on: master)\n"},{"id":"152700","messageId":"1286305486-28607-1-git-send-email-bert.wesarg@googlemail.com","threadId":"25320","inReplyTo":"AANLkTikXT=rzOJTTcNOsWkXctKOM3FzQ9ycVtOprLHGh@mail.gmail.com","subject":"[TopGit PATCH v2] tg-patch: use pretty_tree","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-05T19:04:46Z","receivedAt":"2010-10-05T19:04:46Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"This applies the same treatment to tg-patch like tg-files got in v2.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\nBasing the decision whether to use the ui diff or the porcelain diff-tree\nis probably very unorthodox, but also makes sense, doesn't it?\n\nChanges:\n v2:\n  * apply suggestions from Uwe made to tg-files here too\n  * the running pager decides whether we use the ui diff or the porcelain\n    diff-tree\n\n tg-patch.sh |   67 +++++++++++++++++++++++++++++++++-------------------------\n 1 files changed, 38 insertions(+), 29 deletions(-)\n\ndiff --git a/tg-patch.sh b/tg-patch.sh\nindex 7bafdfe..e88985a 100644 tg-patch.sh\n--- a/tg-patch.sh\n+++ b/tg-patch.sh\n@@ -4,24 +4,18 @@\n # GPLv2\n \n name=\n-\n topic=\n-diff_opts=\n-diff_committed_only=yes\t# will be unset for index/worktree\n-\n+topic_for_pretty_tree=\n \n ## Parse options\n \n while [ -n \"$1\" ]; do\n \targ=\"$1\"; shift\n \tcase \"$arg\" in\n-\t-i)\n-\t\ttopic='(i)'\n-\t\tdiff_opts=\"$diff_opts --cached\";\n-\t\tdiff_committed_only=;;\n-\t-w)\n-\t\ttopic='(w)'\n-\t\tdiff_committed_only=;;\n+\t-i|-w)\n+\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n+\t\ttopic=\"(${arg#-})\"\n+\t\ttopic_for_pretty_tree=\"$arg\";;\n \t-*)\n \t\techo \"Usage: tg [...] patch [-i | -w] [NAME]\" >&2\n \t\texit 1;;\n@@ -32,8 +26,8 @@ while [ -n \"$1\" ]; do\n done\n \n \n-[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n-\tdie \"-i/-w are mutually exclusive with NAME\"\n+[ -n \"$name\" -a -n \"$topic\" ] &&\n+\tdie \"$topic are mutually exclusive with NAME\"\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@@ -46,22 +40,37 @@ base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\"\n \n setup_pager\n \n-cat_file \"$topic:.topmsg\"\n-echo\n-[ -n \"$(git grep $diff_opts '^[-]--' ${diff_committed_only:+\"$name\"} -- \".topmsg\")\" ] || echo '---'\n-\n-# Evil obnoxious hack to work around the lack of git diff --exclude\n-git_is_stupid=\"$(mktemp -t tg-patch-changes.XXXXXX)\"\n-git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n-\tfgrep -vx \".topdeps\" |\n-\tfgrep -vx \".topmsg\" >\"$git_is_stupid\" || : # fgrep likes to fail randomly?\n-if [ -s \"$git_is_stupid\" ]; then\n-\tcd \"$root_dir\"\n-\tcat \"$git_is_stupid\" | xargs git diff -a --patch-with-stat $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} --\n-else\n-\techo \"No changes.\"\n-fi\n-rm \"$git_is_stupid\"\n+# put out the commit message\n+# and put an empty line out, if the last one in the message was not an empty line\n+# and put out \"---\" if the commit message does not have one yet\n+cat_file \"$topic:.topmsg\" |\n+\tawk '\n+/^---/ {\n+    has_3dash=1;\n+}\n+       {\n+    need_empty = 1;\n+    if ($0 == \"\")\n+        need_empty = 0;\n+    print;\n+}\n+END    {\n+    if (need_empty)\n+        print \"\";\n+    if (!has_3dash)\n+        print \"---\";\n+}\n+'\n+\n+b_tree=$(pretty_tree \"$name\" -b)\n+t_tree=$(pretty_tree \"$name\" $topic_for_pretty_tree)\n+\n+# use the ui diff command when the pager is active\n+diff_command=diff\n+[ \"x$GIT_PAGER_IN_USE\" = \"x1\" ] ||\n+\tdiff_command=diff-tree\n+\n+git $diff_command -p --stat $b_tree $t_tree\n \n echo '-- '\n echo \"tg: ($base_rev..) $name (depends on: $(cat_file \"$topic:.topdeps\" | paste -s -d' '))\"\n-- \ntg: (aaf1181..) bw/tg-patch-pretty_tree (depends on: bw/files)\n"},{"id":"152706","messageId":"20101005200159.GZ11737@pengutronix.de","threadId":"25320","inReplyTo":"1286305486-28607-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH v2] tg-patch: use pretty_tree","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-10-05T20:01:59Z","receivedAt":"2010-10-05T20:01:59Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"On Tue, Oct 05, 2010 at 09:04:46PM +0200, Bert Wesarg wrote:\n> This applies the same treatment to tg-patch like tg-files got in v2.\n> \n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n> \n> ---\n> \n> Basing the decision whether to use the ui diff or the porcelain diff-tree\n> is probably very unorthodox, but also makes sense, doesn't it?\nUuuuuh, I'd feel better with git diff-tree --color=auto.  Why did you\ndecide against that?\n\n> Changes:\n>  v2:\n>   * apply suggestions from Uwe made to tg-files here too\n>   * the running pager decides whether we use the ui diff or the porcelain\n>     diff-tree\n> \n>  tg-patch.sh |   67 +++++++++++++++++++++++++++++++++-------------------------\n>  1 files changed, 38 insertions(+), 29 deletions(-)\n> \n> diff --git a/tg-patch.sh b/tg-patch.sh\n> index 7bafdfe..e88985a 100644 tg-patch.sh\n> --- a/tg-patch.sh\n> +++ b/tg-patch.sh\n> @@ -4,24 +4,18 @@\n>  # GPLv2\n>  \n>  name=\n> -\n>  topic=\n> -diff_opts=\n> -diff_committed_only=yes\t# will be unset for index/worktree\n> -\n> +topic_for_pretty_tree=\n>  \n>  ## Parse options\n>  \n>  while [ -n \"$1\" ]; do\n>  \targ=\"$1\"; shift\n>  \tcase \"$arg\" in\n> -\t-i)\n> -\t\ttopic='(i)'\n> -\t\tdiff_opts=\"$diff_opts --cached\";\n> -\t\tdiff_committed_only=;;\n> -\t-w)\n> -\t\ttopic='(w)'\n> -\t\tdiff_committed_only=;;\n> +\t-i|-w)\n> +\t\t[ -z \"$topic\" ] || die \"-i and -w are mutually exclusive\"\n> +\t\ttopic=\"(${arg#-})\"\n> +\t\ttopic_for_pretty_tree=\"$arg\";;\n>  \t-*)\n>  \t\techo \"Usage: tg [...] patch [-i | -w] [NAME]\" >&2\n>  \t\texit 1;;\n> @@ -32,8 +26,8 @@ while [ -n \"$1\" ]; do\n>  done\n>  \n>  \n> -[ -n \"$name\"  -a  -z \"$diff_committed_only\" ]  &&\n> -\tdie \"-i/-w are mutually exclusive with NAME\"\n> +[ -n \"$name\" -a -n \"$topic\" ] &&\n> +\tdie \"$topic are mutually exclusive with NAME\"\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> @@ -46,22 +40,37 @@ base_rev=\"$(git rev-parse --short --verify \"refs/top-bases/$name\" 2>/dev/null)\"\n>  \n>  setup_pager\n>  \n> -cat_file \"$topic:.topmsg\"\n> -echo\n> -[ -n \"$(git grep $diff_opts '^[-]--' ${diff_committed_only:+\"$name\"} -- \".topmsg\")\" ] || echo '---'\n> -\n> -# Evil obnoxious hack to work around the lack of git diff --exclude\n> -git_is_stupid=\"$(mktemp -t tg-patch-changes.XXXXXX)\"\n> -git diff --name-only $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} -- |\n> -\tfgrep -vx \".topdeps\" |\n> -\tfgrep -vx \".topmsg\" >\"$git_is_stupid\" || : # fgrep likes to fail randomly?\n> -if [ -s \"$git_is_stupid\" ]; then\n> -\tcd \"$root_dir\"\n> -\tcat \"$git_is_stupid\" | xargs git diff -a --patch-with-stat $diff_opts \"$base_rev\" ${diff_committed_only:+\"$name\"} --\n> -else\n> -\techo \"No changes.\"\n> -fi\n> -rm \"$git_is_stupid\"\n> +# put out the commit message\n> +# and put an empty line out, if the last one in the message was not an empty line\n> +# and put out \"---\" if the commit message does not have one yet\n> +cat_file \"$topic:.topmsg\" |\n> +\tawk '\n> +/^---/ {\n> +    has_3dash=1;\n> +}\n> +       {\n> +    need_empty = 1;\n> +    if ($0 == \"\")\n> +        need_empty = 0;\n> +    print;\n> +}\n> +END    {\n> +    if (need_empty)\n> +        print \"\";\n> +    if (!has_3dash)\n> +        print \"---\";\n> +}\n> +'\n> +\n> +b_tree=$(pretty_tree \"$name\" -b)\n> +t_tree=$(pretty_tree \"$name\" $topic_for_pretty_tree)\n> +\n> +# use the ui diff command when the pager is active\n> +diff_command=diff\n> +[ \"x$GIT_PAGER_IN_USE\" = \"x1\" ] ||\n> +\tdiff_command=diff-tree\n> +\n> +git $diff_command -p --stat $b_tree $t_tree\n>  \n>  echo '-- '\n>  echo \"tg: ($base_rev..) $name (depends on: $(cat_file \"$topic:.topdeps\" | paste -s -d' '))\"\n> -- \n> tg: (aaf1181..) bw/tg-patch-pretty_tree (depends on: bw/files)\n> \n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"152708","messageId":"AANLkTimQ6CQonVJRuUzZkzbNFPsHkt4nSD70Fp_Ug1rp@mail.gmail.com","threadId":"25320","inReplyTo":"20101005200159.GZ11737@pengutronix.de","subject":"Re: [TopGit PATCH v2] tg-patch: use pretty_tree","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-05T20:14:55Z","receivedAt":"2010-10-05T20:14:55Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"2010/10/5 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:\n> On Tue, Oct 05, 2010 at 09:04:46PM +0200, Bert Wesarg wrote:\n>> This applies the same treatment to tg-patch like tg-files got in v2.\n>>\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>> ---\n>>\n>> Basing the decision whether to use the ui diff or the porcelain diff-tree\n>> is probably very unorthodox, but also makes sense, doesn't it?\n> Uuuuuh, I'd feel better with git diff-tree --color=auto.  Why did you\n> decide against that?\n\nBecause there are more config options which diff-tree ignores, for\nexample diff.mnemonicprefix or diff.noprefix. While\ndiff.mnemonicprefix unfortunately should not work in our case (git\ndiff can't decide just from the two tree-ishs what is what) but we\ncould provide our own prefixes with --{src,dst}-prefix. See\ndiff.c:git_diff_ui_config() for the full list. I also have a small\npatch in my git tree which is only recognized by the ui diff.\n\nBTW. I accidentally removed the '(No changes)' case, which I'm working\non right now.\n\nBert\n"},{"id":"152729","messageId":"87k4lw1enu.fsf@gmail.com","threadId":"25320","inReplyTo":"1286305402-28284-1-git-send-email-bert.wesarg@googlemail.com","subject":"Re: [TopGit PATCH v4] tg-files: list files changed by the topic branch","fromName":"Štěpán Němec","fromEmail":"stepnem@gmail.com","sentAt":"2010-10-05T22:02:45Z","receivedAt":"2010-10-05T22:02:45Z","isPatch":true,"sender":{"key":"stepnem@gmail.com","avatar":"https://avatars.githubusercontent.com/u/106838?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> this could also be a --name-only option to tg-patch. But I Like the\n> similarity to 'quilt files'.\n>\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>\n> ---\n>\n>  Changes:\n>   v4:\n>    * apply Uwe's suggestions\n\n[...]\n\n> +\n> +\n> +[ -n \"$name\" -a -n \"$topic\" ] &&\n> +\tdie \"$topic are mutually exclusive with NAME\"\n\n...so, \"are\" should now be \"is\", as $topic will be _either_ `-i' or\n`-w', not both.\n\nŠtěpán\n"},{"id":"152745","messageId":"AANLkTi=Fy2EoJO9Ui0BB3JA85hPDJ9xt=++=M8a8pW9o@mail.gmail.com","threadId":"25320","inReplyTo":"87k4lw1enu.fsf@gmail.com","subject":"Re: [TopGit PATCH v4] tg-files: list files changed by the topic branch","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-10-06T06:11:58Z","receivedAt":"2010-10-06T06:11:58Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Wed, Oct 6, 2010 at 00:02, Štěpán Němec <stepnem@gmail.com> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>> this could also be a --name-only option to tg-patch. But I Like the\n>> similarity to 'quilt files'.\n>>\n>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>\n>> ---\n>>\n>>  Changes:\n>>   v4:\n>>    * apply Uwe's suggestions\n>\n> [...]\n>\n>> +\n>> +\n>> +[ -n \"$name\" -a -n \"$topic\" ] &&\n>> +     die \"$topic are mutually exclusive with NAME\"\n>\n> ...so, \"are\" should now be \"is\", as $topic will be _either_ `-i' or\n> `-w', not both.\n\nThanks. Will fix.\n\nBert\n\n>\n> Štěpán\n>\n"}]}