Re: [Q] Abbreviated history graph?

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

 



On Mon, Nov 3, 2008 at 2:39 PM, Brian Foster
<brian.foster@xxxxxxxxxxxxxxx> wrote:
>
> Hello,
>
>  A colleague and I recently wanted to examine the
>  history in a broad sense without worrying too much
>  about the individual commits.  What we (think we)
>  wanted is a 'gitk --all' history graph showing only
>  "named" historical points; i.e., tags and branch
>  HEADs, perhaps with an indication of whether or not
>  it's a "linear" change sequence that leads from one
>  to another.  That is, hypothetically, if the history
>  looks something like (where 'A' &tc has a name as
>  per above, and '*' does not):
>
>     A--->*--->*--->C--->D--->*----->E
>      \                   \         /
>       \->*-->B            \->*--->*--->F
>
>  What we wanted to see is something like:
>
>     A------>C--->D--->E
>      \       \       /
>       \->B    \-----/--->F
>
>  Is there some way of doing something similar to that
>  (git v1.6.0.2)?  In addition to 'gitk', we also (rather
>  quickly!) tried both 'qgit' and 'giggle', but without
>  any apparent success.

Not in git.git but you can use the script at the bottom (also attached
in case it is whitespace damage).
It could be much faster if "git log" stops when finding a tag/branch.

HTH,
Santi

[git-overview]
#!/bin/sh

TMP=$(mktemp -t git-overview.XXXXXXXXXXX)
trap 'rm -f "$TMP"' 0 1 2 3 15

git log --reverse --pretty=short --decorate --pretty=format:%H%d $@ |\
    awk 'BEGIN {FS="[ ,()]*"} NF>=2 {print $1}' | \
    while read hash ; do
    # Independent tags/branches parents:
    # Notes:
    #   * -n 1000 to limit the search, ideally "git log" could stop
    #     traversing the history when hits a tag/branch tip
    #   * head -n 25 because "git show-branch --independent" has this limit
    ancestors=$(git log -n 1000 --pretty=short --decorate
--pretty=format:%H%d $hash^@ |\
    awk 'BEGIN {FS="[ ,()]*"} NF>=2 {print $1}' | head -n 25)
    if [ -n "$ancestors" ] ; then
	echo $hash $(git show-branch --independent $ancestors)
    else
	echo $hash
    fi
done > $TMP
GIT_GRAFT_FILE=$TMP gitk "$@" -d

Attachment: git-overview
Description: Binary data


[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