* git-changes-script to show inter tree changes
@ 2005-04-23 18:43 James Bottomley
2005-04-23 23:09 ` Petr Baudis
0 siblings, 1 reply; 5+ messages in thread
From: James Bottomley @ 2005-04-23 18:43 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
One of the features I found most useful about bk changes was the ability
to see changes in my tree that weren't in the other tree (I use this to
keep track of what patches I actually have).
I've modified the gitlog script to take the -L and -R options (local
directories only; won't work on remotes like bk changes would) to add
this functionality.
James
#!/bin/bash
#
# Make a log of changes in a GIT branch.
#
# This script was originally written by (c) Ross Vandegrift.
# Adapted to his scripts set by (c) Petr Baudis, 2005.
# Major optimizations by (c) Phillip Lougher.
# Rendered trivial by Linus Torvalds.
# Added -L|-R option by James Bottomley
#
# options:
# script [-L <dir> | -R <dir> |-r <from_sha1> [ -r <to_sha1] ] [<sha1>]
#
# With no options shows all the revisions from HEAD to the root
# -L shows all the changes in the local tree compared to the tree at <dir>
# -R shows all the changes in the remote tree at <dir> compared to the local
# -r shows all the changes in one commit or between two
tmpfile=/tmp/git_changes.$$
r1=
r2=
showcommit() {
commit="$1"
echo commit ${commit%:*};
cat-file commit $commit | \
while read key rest; do
case "$key" in
"author"|"committer")
date=(${rest#*> })
sec=${date[0]};
pdate="$(date -Rd "1970-01-01 UTC + $sec sec" 2>/dev/null)"
if [ "$pdate" ]; then
echo $key $rest | sed "s/>.*/> ${pdate/+0000/$tz}/"
else
echo $key $rest
fi
;;
"")
echo; cat
;;
*)
echo $key $rest
;;
esac
done
}
while true; do
case "$1" in
-R) shift;
diffsearch=+
remote="$1"
shift;;
-L) shift;
diffsearch=-
remote="$1"
shift;;
-r) shift;
if [ -z "$r1" ]; then
r1="$1"
else
r2="$1"
fi
shift;;
*) base="$1"
break;;
esac
done
if [ -n "$r1" ]; then
if [ -z "$r2" ]; then
showcommit $r1
exit 0
fi
diffsearch=+
remote=`pwd`;
tobase="$r2";
base="$r1"
fi
if [ -z "$base" ]; then
base=$(cat .git/HEAD) || exit 1
fi
rev-tree $base | sort -rn > ${tmpfile}.base
if [ -n "$remote" ]; then
[ -d $remote/.git ] || exit 1
if [ -z "$tobase" ]; then
tobase=$(cat $remote/.git/HEAD) || exit 1
fi
pushd $remote > /dev/null
rev-tree $tobase | sort -rn > ${tmpfile}.remote
diff -u ${tmpfile}.base ${tmpfile}.remote | grep "^${diffsearch}[^${diffsearch}]" | cut -c 1- > ${tmpfile}.diff
rm -f ${tmpfile}.base ${tmpfile}.remote
mv ${tmpfile}.diff ${tmpfile}.base
if [ $diffsearch = "-" ]; then
popd > /dev/null
fi
fi
[ -s "${tmpfile}.base" ] || exit 0
cat ${tmpfile}.base | while read time commit parents; do
showcommit $commit
echo -e "\n--------------------------"
done
rm -f ${tmpfile}.base
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-changes-script to show inter tree changes
2005-04-23 18:43 git-changes-script to show inter tree changes James Bottomley
@ 2005-04-23 23:09 ` Petr Baudis
2005-04-24 1:39 ` James Bottomley
0 siblings, 1 reply; 5+ messages in thread
From: Petr Baudis @ 2005-04-23 23:09 UTC (permalink / raw)
To: James Bottomley; +Cc: Linus Torvalds, git
Dear diary, on Sat, Apr 23, 2005 at 08:43:12PM CEST, I got a letter
where James Bottomley <James.Bottomley@SteelEye.com> told me that...
> One of the features I found most useful about bk changes was the ability
> to see changes in my tree that weren't in the other tree (I use this to
> keep track of what patches I actually have).
>
> I've modified the gitlog script to take the -L and -R options (local
> directories only; won't work on remotes like bk changes would) to add
> this functionality.
Linus isn't probably the right person to Cc on this, since this is
git-pasky thing. Can you please post it as a signed-off patch?
I don't get what are you doing anyway. I don't know the "bk changes"
tool. Can't you just do
git log theothertree yourtree
?
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-changes-script to show inter tree changes
2005-04-23 23:09 ` Petr Baudis
@ 2005-04-24 1:39 ` James Bottomley
2005-04-24 12:36 ` Petr Baudis
0 siblings, 1 reply; 5+ messages in thread
From: James Bottomley @ 2005-04-24 1:39 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
On Sun, 2005-04-24 at 01:09 +0200, Petr Baudis wrote:
> Linus isn't probably the right person to Cc on this, since this is
> git-pasky thing. Can you please post it as a signed-off patch?
I'm just offering it as one of the scripts I need to operate a git tree
as a maintainer. I don't have git-pasky installed, so I can't patch it
against anything. However, feel free to incorporate any pieces you
need.
> I don't get what are you doing anyway. I don't know the "bk changes"
> tool. Can't you just do
>
> git log theothertree yourtree
No idea .. not used it. However, how does this show the -L and -R diffs
since there are two possible views of changes between trees? It's
primarily -L (changes in local) I need to keep the changes in my local
tree. -R (changes in remote) is just useful to show what changes I'm
missing and might need to merge.
James
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-changes-script to show inter tree changes
2005-04-24 1:39 ` James Bottomley
@ 2005-04-24 12:36 ` Petr Baudis
2005-04-24 12:48 ` James Bottomley
0 siblings, 1 reply; 5+ messages in thread
From: Petr Baudis @ 2005-04-24 12:36 UTC (permalink / raw)
To: James Bottomley; +Cc: Linus Torvalds, git
Dear diary, on Sun, Apr 24, 2005 at 03:39:22AM CEST, I got a letter
where James Bottomley <James.Bottomley@SteelEye.com> told me that...
> On Sun, 2005-04-24 at 01:09 +0200, Petr Baudis wrote:
> > Linus isn't probably the right person to Cc on this, since this is
> > git-pasky thing. Can you please post it as a signed-off patch?
>
> I'm just offering it as one of the scripts I need to operate a git tree
> as a maintainer. I don't have git-pasky installed, so I can't patch it
> against anything. However, feel free to incorporate any pieces you
> need.
Aha, I thought this is based on the current gitlog.sh, sorry.
> > I don't get what are you doing anyway. I don't know the "bk changes"
> > tool. Can't you just do
> >
> > git log theothertree yourtree
>
> No idea .. not used it. However, how does this show the -L and -R diffs
> since there are two possible views of changes between trees? It's
> primarily -L (changes in local) I need to keep the changes in my local
> tree. -R (changes in remote) is just useful to show what changes I'm
> missing and might need to merge.
For -R, you'd probably do
git log yourtree theothertree
(the range of changes between yourtree and theothertree, literally).
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: git-changes-script to show inter tree changes
2005-04-24 12:36 ` Petr Baudis
@ 2005-04-24 12:48 ` James Bottomley
0 siblings, 0 replies; 5+ messages in thread
From: James Bottomley @ 2005-04-24 12:48 UTC (permalink / raw)
To: Petr Baudis; +Cc: Linus Torvalds, git
On Sun, 2005-04-24 at 14:36 +0200, Petr Baudis wrote:
> Aha, I thought this is based on the current gitlog.sh, sorry.
I think it is ... such a beast briefly appeared in the git tree, which
is where I got the skeleton from.
> For -R, you'd probably do
>
> git log yourtree theothertree
>
> (the range of changes between yourtree and theothertree, literally).
As long as that's a true what's in the other tree only, -L should appear
if you simply reverse the arguments.
James
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-24 12:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-23 18:43 git-changes-script to show inter tree changes James Bottomley
2005-04-23 23:09 ` Petr Baudis
2005-04-24 1:39 ` James Bottomley
2005-04-24 12:36 ` Petr Baudis
2005-04-24 12:48 ` James Bottomley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.