Re: Getting version output for a file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux