git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[TopGit PATCH 6/6] tg-log: short cut to git log

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
Oct 3, 2010, 21:25 UTC
Message-ID
<1286141157-30422-6-git-send-email-bert.wesarg@googlemail.com>
In-Reply-To
<1286141157-30422-5-git-send-email-bert.wesarg@googlemail.com>

A short cut to show the history of a named topgit branch. Additional options to git log can be given after a '--'.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 .gitignore                 |    2 ++
 README                     |    3 +++
 contrib/tg-completion.bash |   11 +++++++++++
 tg-log.sh                  |   30 ++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 0342e09..3298889 100644 .gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,8 @@
 /tg-info.txt
 /tg-mail
 /tg-mail.txt
+/tg-log
+/tg-log.txt
 /tg-patch
 /tg-patch.txt
 /tg-push
diff --git a/README b/README
index f103d92..b5fdaaf 100644 README
--- a/README
+++ b/README
@@ -522,6 +522,9 @@ tg base
 	repository, so you will not see work done by your
 	collaborators.)
 
+tg log
+~~~~~~
+	Prints the git log of the named topgit branch.
 
 TODO: tg rename
 
diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash
index 0ee233c..c65398a 100755 contrib/tg-completion.bash
--- a/contrib/tg-completion.bash
+++ b/contrib/tg-completion.bash
@@ -344,6 +344,16 @@ _tg_info ()
 	esac
 }
 
+_tg_log ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+
+	case "$cur" in
+	*)
+		__tgcomp "$(__tg_topics)"
+	esac
+}
+
 _tg_mail ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -470,6 +480,7 @@ _tg ()
 	help)        _tg_help ;;
 	import)      _tg_import ;;
 	info)        _tg_info ;;
+	log)         _tg_log ;;
 	mail)        _tg_mail ;;
 	patch)       _tg_patch ;;
 	push)        _tg_push ;;
diff --git a/tg-log.sh b/tg-log.sh
new file mode 100644
index 0000000..8a8d527 tg-log.sh
--- /dev/null
+++ b/tg-log.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@suse.cz>  2008
+# (c) Bert Wesarg <Bert.Wesarg@googlemail.com>  2009
+# GPLv2
+
+name=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+	arg="$1"; shift
+	case "$arg" in
+	--)
+		break;;
+	-*)
+		echo "Usage: tg [...] log [NAME] [-- GIT LOG OPTIONS...]" >&2
+		exit 1;;
+	*)
+		[ -z "$name" ] || die "name already specified ($name)"
+		name="$arg";;
+	esac
+done
+
+[ -n "$name" ] || name="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
+base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
+	die "not a TopGit-controlled branch"
+
+git log --first-parent --no-merges "$@" "refs/top-bases/$name".."$name"
-- 
tg: (9404aa1..) bw/log (depends on: master)
Previous: Bert WesargNext: Uwe Kleine-König
Message 8 of 39 in “planning a new topgit release”
  1. Uwe Kleine-KönigOct 3, 2010
  2. Bert WesargOct 3, 2010
  3. 1/6 Let tg-update take a branch parameterBert Wesarg, Oct 3, 2010
  4. 2/6 tg-remote: use default remote if non is givenBert Wesarg, Oct 3, 2010
  5. 3/6 tg-files: list files changed by the topic branchBert Wesarg, Oct 3, 2010
  6. 4/6 tg-prev/tg-next: commands to explore dependenciesBert Wesarg, Oct 3, 2010
  7. 5/6 put die() messages to stderrBert Wesarg, Oct 3, 2010
  8. 6/6 tg-log: short cut to git logBert Wesarg, Oct 3, 2010
  9. Uwe Kleine-KönigOct 3, 2010
  10. Bert WesargOct 4, 2010
  11. Uwe Kleine-KönigOct 3, 2010
  12. Bert WesargOct 4, 2010
  13. Uwe Kleine-KönigOct 4, 2010
  14. Bert WesargOct 4, 2010
  15. Uwe Kleine-KönigOct 4, 2010
  16. tg-files: list files changed by the topic branchBert Wesarg, Oct 4, 2010
  17. Uwe Kleine-KönigOct 4, 2010
  18. Bert WesargOct 4, 2010
  19. tg-files: list files changed by the topic branchBert Wesarg, Oct 4, 2010
  20. tg-patch: use pretty_treeBert Wesarg, Oct 4, 2010
  21. Bert WesargOct 4, 2010
  22. Uwe Kleine-KönigOct 5, 2010
  23. Bert WesargOct 5, 2010
  24. tg-patch: use pretty_treeBert Wesarg, Oct 5, 2010
  25. Uwe Kleine-KönigOct 5, 2010
  26. Bert WesargOct 5, 2010
  27. Uwe Kleine-KönigOct 5, 2010
  28. tg-files: list files changed by the topic branchBert Wesarg, Oct 5, 2010
  29. Štěpán NěmecOct 5, 2010
  30. Bert WesargOct 6, 2010
  31. Uwe Kleine-KönigOct 3, 2010
  32. Ævar Arnfjörð BjarmasonOct 4, 2010
  33. Uwe Kleine-KönigOct 4, 2010
  34. Uwe Kleine-KönigOct 3, 2010
  35. Bert WesargOct 4, 2010
  36. tg-log: move note from tg base to tg logBert Wesarg, Oct 4, 2010
  37. Štěpán NěmecOct 4, 2010
  38. Bert WesargOct 4, 2010
  39. Uwe Kleine-KönigOct 4, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.