From: John Ellson <ellson@research.att.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: [PATCH] cg-history FILE [NTH_PARENT] - was: Re: Wanted - a file browser interface to git
Date: Tue, 18 Oct 2005 23:15:15 -0400 [thread overview]
Message-ID: <4355BA43.5030509@research.att.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0510181806250.3369@g5.osdl.org>
Linus Torvalds wrote:
>
> On Tue, 18 Oct 2005, John Ellson wrote:
>> An example is: "I know that file xxx contained algorithm yyy at some point in
>> the past and now I'd like to browse back through the history of xxx to find
>> the exact details."
>
> You are aware of "git whatchanged -p xxx", right?
>
> Yeah, it's not graphical, and I agree that it might be very cool to have a
> graphical version of it. But I thought I'd mention it even so. A
> surprising number of people seem to have never realized, and at least for
> me personally, it's one of the most common things I do.
>
> Linus
OK. Here is a not-very-smart cogito command to display the history of a file,
or the state of the nth parent of the file in its history.
Feedback and or complete rewrites are requested ;-)
John
produce the history of a file, or its state at its nth_parent
---
commit 8478ad1164e37e9cca039a3f9552d2a98f7bead6
tree 40b39d5f9af573a7815f073cada03c7903bfc6fa
parent 5d74e4859afc81a4658133d5a83809ac814dbf34
author John Ellson <ellson@ontap.ellson.com> Tue, 18 Oct 2005 23:13:44 -0400
committer John Ellson <ellson@ontap.ellson.com> Tue, 18 Oct 2005 23:13:44 -0400
cg-history | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/cg-history b/cg-history
new file mode 100755
index 0000000..ba86f71
--- /dev/null
+++ b/cg-history
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+#
+# Display the change history of a file.
+# Copyright (c) John Ellson, 2005
+#
+# The change history of a file is displayed on stdout, or
+# if an integer is provided for NTH_PARENT, then the complete
+# state of the file at that step in its history is sent to stdout.
+#
+
+USAGE="cg-history FILE [NTH_PARENT]"
+
+. ${COGITO_LIB}cg-Xlib || exit 1
+
+[ "$ARGS" ] || usage
+
+if [ "${ARGS[1]}" = "" ]; then
+ git-whatchanged -p "${ARGS[0]}"
+else
+ i=0
+ git-whatchanged -p "${ARGS[0]}" |
+ while read -r cmd sha rest
+ do
+ case "$cmd" in
+ diff-tree)
+ i=`expr $i + 1`
+ if [ $i = ${ARGS[1]} ] ; then
+ cg-admin-cat -r "$sha" "${ARGS[0]}"
+ exit 0
+ fi
+ ;;
+ *)
+ ;;
+ esac
+ done
+fi
next prev parent reply other threads:[~2005-10-19 3:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-19 0:58 Wanted - a file browser interface to git John Ellson
2005-10-19 1:07 ` Linus Torvalds
2005-10-19 1:23 ` John Ellson
2005-10-19 3:03 ` Linus Torvalds
2005-10-19 3:15 ` John Ellson [this message]
2005-10-19 4:01 ` [PATCH] cg-history FILE [NTH_PARENT] Linus Torvalds
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=4355BA43.5030509@research.att.com \
--to=ellson@research.att.com \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/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;
as well as URLs for NNTP newsgroup(s).