Git development
 help / color / mirror / Atom feed
From: "Sean" <seanlkml@sympatico.ca>
To: "Petr Baudis" <pasky@ucw.cz>
Cc: "Marcel Holtmann" <marcel@holtmann.org>,
	"GIT Mailing List" <git@vger.kernel.org>
Subject: Re: cg-log patches
Date: Sun, 8 May 2005 15:23:50 -0400 (EDT)	[thread overview]
Message-ID: <2014.10.10.10.24.1115580230.squirrel@linux1> (raw)
In-Reply-To: <20050508191831.GD9495@pasky.ji.cz>

[-- Attachment #1: Type: text/plain, Size: 811 bytes --]

On Sun, May 8, 2005 3:18 pm, Petr Baudis said:

>> I am not a really good git expert, but maybe another option for it would
>> be fine.
>>
>> However there is another thing that I am missing. With Bitkeeper I was
>> able to do something like "bk changes -umarcel" to list all changes done
>> by the user "marcel". I like to have something similar with cg-log. Any
>> ideas on how to do that?
>
> What should it take in regard? Username portion of the email address?
> The email address itself? The realname?
>

Attached is a new version of cg-log that includes a -u option that takes a
single parameter.   Whatever you put in that parameter will be searched in
the author line, so it can be part or all of an authors name and/or email
address.

So you could do:

cg-log -c -f -u petr

or

cg-log -uxpasky

Sean

[-- Attachment #2: cg-log --]
[-- Type: application/octet-stream, Size: 3187 bytes --]

#!/usr/bin/env bash
#
# Make a log of changes in a GIT branch.
# Copyright (c) Petr Baudis, 2005.
# Copyright (c) David Woodhouse, 2005.
# Copyright (c) Sean Estabrooks, 2005.
#
# Takes a -c option to add color to the output.
# Currently, the colors are:
#
#	header		Green	
#	author 		Cyan
#	committer	Magenta
#	files		Blue
#	signoff		Yellow
#
# Takes an -f option to list which files was changed.
#
# Takes an -r followed with id resolving to a commit to start from
# (HEAD by default), or id1:id2 representing an (id1;id2] range
# of commits to show.
#
# The rest of arguments are took as filenames; cg-log then displays
# only changes in those files.

. cg-Xlib
# Try to fix the annoying "Broken pipe" output. May not help, but apparently
# at least somewhere it does. Bash is broken.
trap exit SIGPIPE

colheader=
colauthor=
colcommitter=
colfiles=
colsignoff=
coldefault=

list_files=

log_start=
log_end=

user=

while getopts cfr:u: o
do
	case $o in
	c)	# See terminfo(5), "Color Handling"
		colheader="$(tput setaf 2)"    # Green
		colauthor="$(tput setaf 6)"    # Cyan
		colcommitter="$(tput setaf 5)" # Magenta
		colfiles="$(tput setaf 4)"     # Blue
		colsignoff="$(tput setaf 3)"   # Yellow
		coldefault="$(tput op)"        # Restore default
		;;
	f)	list_files=1 
		;;
	r)	if [ -z $log_start ]; then
			log_start="${OPTARG/:*}"
			[ $OPTARG != $log_start ] && log_end="${OPTARG/*:}"
		else	log_end="$OPTARG"
		fi
		;;
	u)	user="$OPTARG"
		;;
	*)	exit 1
		;;
	esac
done
shift $((OPTIND-1))

list_commit_files()
{
	echo
	if [ -z $2 ]; then
		git-ls-tree $1  # List all files for initial commit
	else	
		local tree1=$1; shift
		for tree2; do
			git-diff-tree -r $tree1 $tree2
		done
	fi | cut -f4 | sort -u | column | column -t | \
	sed "s/^/$colfiles    * /;s/$/$coldefault/"
}

id1="$(commit-id $log_start)" || exit 1
if [ "$log_end" ]; then
	id2="$(commit-id $log_end)" || exit 1
	git-rev-tree $id2 ^$id1 | sort -rn | cut -d' ' -f2
else
	git-rev-list $id1
fi | \
while read commit
do
	trap exit SIGPIPE
	trees=
	if [ $# -ne 0 ]; then
		parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q')
		[ "$parent" ] && [ "$(git-diff-tree -r $commit $parent "$@")" ] || continue
	fi
	if [ ! -z "$user" ]; then
		git-cat-file commit $commit | grep '^author ' | grep -qi "$user" || continue
	fi
	echo $colheader""commit ${commit%:*} $coldefault;
	git-cat-file commit $commit | \
		while read key rest; do
			trap exit SIGPIPE
			case "$key" in
			"author"|"committer")
				if [ "$key" = "author" ]; then
					color="$colauthor"
				else
					color="$colcommitter"
				fi

				date=(${rest#*> })
				pdate="$(showdate $date)"
				if [ "$pdate" ]; then
					echo -n $color$key $rest | sed "s/>.*/> $pdate/"
					echo $coldefault
				else
					echo $color$key $rest $coldefault
				fi
				;;
			"tree"|"parent")
				trees="$trees $rest"
				echo $colheader$key $rest $coldefault
				;;
			"")
				echo; sed -re "
				 s/^(from|cc|signed.off.by|acked.by): .*/$colsignoff&$coldefault/I
				 s/^/    /"
				[ -n "$list_files" ] && list_commit_files $trees
				;;
			*)
				echo $colheader$key $rest $coldefault
				;;
			esac

		done
	echo
done | ${PAGER:-less} ${PAGER_FLAGS:--R}

  reply	other threads:[~2005-05-08 19:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-08 17:35 cg-log patches Sean
2005-05-08 17:42 ` Marcel Holtmann
2005-05-08 18:26   ` Sean
2005-05-08 19:00     ` Marcel Holtmann
2005-05-08 19:18       ` Petr Baudis
2005-05-08 19:23         ` Sean [this message]
2005-05-08 19:25           ` Petr Baudis
2005-05-08 19:52             ` Sean
2005-05-08 19:27         ` Marcel Holtmann
     [not found] ` <1792.10.10.10.24.1115575196.squirrel@linux1>
     [not found]   ` <20050508180312.GB9495@pasky.ji.cz>
     [not found]     ` <1896.10.10.10.24.1115577733.squirrel@linux1>
2005-05-08 19:01       ` Petr Baudis
2005-05-08 23:49 ` Jonas Fonseca
2005-05-09  3:45   ` Sean
2005-05-09 11:39     ` Jonas Fonseca
2005-05-09 12:14       ` Petr Baudis
2005-05-09 12:41         ` Jonas Fonseca
2005-05-09 13:13         ` Sean
2005-05-10  0:37         ` Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2014.10.10.10.24.1115580230.squirrel@linux1 \
    --to=seanlkml@sympatico.ca \
    --cc=git@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox