From: Brian Gernhardt <benji@silverinsanity.com>
To: David Kastrup <dak@gnu.org>
Cc: git@vger.kernel.org
Subject: Re: Getting version output for a file.
Date: Wed, 11 Jul 2007 15:48:51 -0400 [thread overview]
Message-ID: <A084830C-F1CD-4EDC-A13D-573DFC68DF77@silverinsanity.com> (raw)
In-Reply-To: <86abu3dv9o.fsf@lola.quinscape.zz>
I don't know lisp very well, and elisp not at all, but I can help you
with what command lines would give you the results you might want.
On Jul 11, 2007, at 7:39 AM, David Kastrup wrote:
> (vc-git-previous-version FILE REV)
> Return the version number immediately preceding REV for FILE,
> or nil if there is no previous version.
If you want the last revision where the file was altered, you could
easily use
git rev-list -2 $current_rev -- $file | tail -1
The result would be a SHA-1 of the next commit where the file was
altered.
> (vc-git-next-version FILE REV)
> Return the version number immediately following REV for FILE,
> or nil if there is no previous version.
This is a little more problematic as git doesn't have forward links
in it's history. If you have a ref to start with (HEAD is a good one
to use, if you don't have anything else) you could use a similar
command to the above
git rev-list $ref -- $file | grep -C1 -m1 $current_rev | head -1
If you don't have a ref to start from, you could use --all, but that
may not be what the user expects.
If you want a human readable name for either you could use name-rev.
(Add "| git name-rev --stdin" to the end of the above.) It places a
human readable name after the SHA-1 in parentheses. (example:
"54dadbdb29668fbd51effefd0a0c65d915f5422b (master~3)")
~~ Brian
next prev parent reply other threads:[~2007-07-11 19:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-11 11:39 Getting version output for a file David Kastrup
2007-07-11 19:48 ` Brian Gernhardt [this message]
2007-07-12 14:48 ` [PATCH] Add missing functions to contrib/emacs/vc-git.el David Kastrup
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=A084830C-F1CD-4EDC-A13D-573DFC68DF77@silverinsanity.com \
--to=benji@silverinsanity.com \
--cc=dak@gnu.org \
--cc=git@vger.kernel.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).