AXP Examples - annotate

axp annotate produces a fully configurable output of file annotation. By default, it lists all file lines prefixed by the revision index that last modified this line, and shows all affected revision descriptions on the botton.

Let's take one short file sensible-pager and play with annotate options.

% axp annotate -CFH sensible-pager  # --cvs option is new in 0.2.1
patch-4  (schizo   2004-09-18): #!/bin/sh
patch-4  (schizo   2004-09-18): 
patch-4  (schizo   2004-09-18): ${PAGER:-pager} "$@"
patch-4  (schizo   2004-09-18): ret="$?"
patch-9  (schizo   2004-09-20): if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
patch-4  (schizo   2004-09-18): more "$@"
patch-4  (schizo   2004-09-18): ret="$?"
patch-9  (schizo   2004-09-20):         if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
patch-4  (schizo   2004-09-18):                 echo "Couldn't find a pager!" 1>&2
patch-4  (schizo   2004-09-18):                 echo "Set the \$PAGER environment variable to your desired pager." 1>&2
patch-4  (schizo   2004-09-18):                 exit 1
patch-4  (schizo   2004-09-18):         fi
patch-4  (schizo   2004-09-18): fi
% axp annotate sensible-pager
2 | #!/bin/sh                                                           
2 | 
2 | ${PAGER:-pager} "$@"
2 | ret="$?"
1 | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 | more "$@"
2 | ret="$?"
1 |     if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 |             echo "Couldn't find a pager!" 1>&2
2 |             echo "Set the \$PAGER environment variable to your desired pager." 1>&2
2 |             exit 1
2 |     fi
2 | fi
--------------------------------------------------------------------------------
1: schizo@debian.org--2004-primary/debianutils--etch--0--patch-9
    2004-09-20 13:32:24 GMT      Clint Adams <schizo@debian.org>
    missing spaces
2: schizo@debian.org--2004-primary/debianutils--etch--0--patch-4
    2004-09-18 00:50:19 GMT      Clint Adams <schizo@debian.org>
    POSIX sh rewrite of sensible-{editor,pager}
% axp annotate --highlight --no-progress --no-desc sensible-pager
2 | #!/bin/sh
2 | 
2 | ${PAGER:-pager} "$@"
2 | ret="$?"
1 | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 | more "$@"
2 | ret="$?"
1 |     if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 |             echo "Couldn't find a pager!" 1>&2
2 |             echo "Set the \$PAGER environment variable to your desired pager." 1>&2
2 |             exit 1
2 |     fi
2 | fi
--------------------------------------------------------------------------------
1: schizo@debian.org--2004-primary/debianutils--etch--0--patch-9
2: schizo@debian.org--2004-primary/debianutils--etch--0--patch-4
% axp annotate --group --summary --highlight sensible-pager
2 | #!/bin/sh
  | 
  | ${PAGER:-pager} "$@"
  | ret="$?"
1 | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 | more "$@"
  | ret="$?"
1 |     if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 |             echo "Couldn't find a pager!" 1>&2
  |             echo "Set the \$PAGER environment variable to your desired pager." 1>&2
  |             exit 1
  |     fi
  | fi
--------------------------------------------------------------------------------
1: schizo@debian.org--2004-primary/debianutils--etch--0--patch-9
    missing spaces
2: schizo@debian.org--2004-primary/debianutils--etch--0--patch-4
    POSIX sh rewrite of sensible-{editor,pager}
% axp annotate --delim ": " --no-revs sensible-pager
2: #!/bin/sh                                                            
2: 
2: ${PAGER:-pager} "$@"
2: ret="$?"
1: if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2: more "$@"
2: ret="$?"
1:      if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2:              echo "Couldn't find a pager!" 1>&2
2:              echo "Set the \$PAGER environment variable to your desired pager." 1>&2
2:              exit 1
2:      fi
2: fi
% axp annotate --match PAGER --highlight sensible-pager
? | #!/bin/sh
? | 
1 | ${PAGER:-pager} "$@"
? | ret="$?"
? | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
? | more "$@"
? | ret="$?"
? |     if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
? |             echo "Couldn't find a pager!" 1>&2
1 |             echo "Set the \$PAGER environment variable to your desired pager." 1>&2
? |             exit 1
? |     fi
? | fi
--------------------------------------------------------------------------------
1: schizo@debian.org--2004-primary/debianutils--etch--0--patch-4
    2004-09-18 00:50:19 GMT      Clint Adams <schizo@debian.org>
    POSIX sh rewrite of sensible-{editor,pager}
% axp annotate --match 'Set.*environment\b' --no-lines --no-email sensible-pager
schizo@debian.org--2004-primary/debianutils--etch--0--patch-4
    2004-09-18 00:50:19 GMT      Clint Adams
    POSIX sh rewrite of sensible-{editor,pager}
% axp annotate -f "%8name %23date%9username%delim%line" --no-revs -g -H sensible-pager
 patch-4 2004-09-18 00:50:19 GMT   schizo | #!/bin/sh
                                          | 
                                          | ${PAGER:-pager} "$@"
                                          | ret="$?"
 patch-9 2004-09-20 13:32:24 GMT   schizo | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
 patch-4 2004-09-18 00:50:19 GMT   schizo | more "$@"
                                          | ret="$?"
 patch-9 2004-09-20 13:32:24 GMT   schizo |     if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
 patch-4 2004-09-18 00:50:19 GMT   schizo |             echo "Couldn't find a pager!" 1>&2
                                          |             echo "Set the \$PAGER environment variable to your desired pager." 1>&2
                                          |             exit 1
                                          |     fi
                                          | fi
% axp annotate -f "%10*10realname%13*~-12date|%8age ago|%line" --no-revs -H sensible-pager
Clint A... 00:50:19 GMT|7 months ago|#!/bin/sh
Clint A... 00:50:19 GMT|7 months ago|
Clint A... 00:50:19 GMT|7 months ago|${PAGER:-pager} "$@"
Clint A... 00:50:19 GMT|7 months ago|ret="$?"
Clint A... 13:32:24 GMT|7 months ago|if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
Clint A... 00:50:19 GMT|7 months ago|more "$@"
Clint A... 00:50:19 GMT|7 months ago|ret="$?"
Clint A... 13:32:24 GMT|7 months ago|   if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
Clint A... 00:50:19 GMT|7 months ago|           echo "Couldn't find a pager!" 1>&2
Clint A... 00:50:19 GMT|7 months ago|           echo "Set the \$PAGER environment variable to your desired pager." 1>&2
Clint A... 00:50:19 GMT|7 months ago|           exit 1
Clint A... 00:50:19 GMT|7 months ago|   fi
Clint A... 00:50:19 GMT|7 months ago|fi
% axp annotate -f "%-20*20email %24*-24version | %line" --no-revs -g -H sensible-pager
schizo@debian.org    .../debianutils--etch--0 | #!/bin/sh
                                              | 
                                              | ${PAGER:-pager} "$@"
                                              | ret="$?"
schizo@debian.org    .../debianutils--etch--0 | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
schizo@debian.org    .../debianutils--etch--0 | more "$@"
                                              | ret="$?"
schizo@debian.org    .../debianutils--etch--0 |         if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
schizo@debian.org    .../debianutils--etch--0 |                 echo "Couldn't find a pager!" 1>&2
                                              |                 echo "Set the \$PAGER environment variable to your desired pager." 1>&2
                                              |                 exit 1
                                              |         fi
                                              | fi
% axp annotate --linenums 1-6 -f "%num%12*12realname%delim%line" --no-revs -g -H sensible-pager
2 Clint Adams | #!/bin/sh
              | 
              | ${PAGER:-pager} "$@"
              | ret="$?"
1 Clint Adams | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 Clint Adams | more "$@"
?             | ret="$?"
              |         if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
              |                 echo "Couldn't find a pager!" 1>&2
              |                 echo "Set the \$PAGER environment variable to your desired pager." 1>&2
              |                 exit 1
              |         fi
              | fi
% axp annotate --linenums 5,8-10 -f "%num %-16*16summary%delim%line" --no-full -s -H sensible-pager
?                  | #!/bin/sh
?                  | 
?                  | ${PAGER:-pager} "$@"
?                  | ret="$?"
1 missing spaces   | if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
?                  | more "$@"
?                  | ret="$?"
1 missing spaces   |    if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
2 POSIX sh rewr... |            echo "Couldn't find a pager!" 1>&2
2 POSIX sh rewr... |            echo "Set the \$PAGER environment variable to your desired pager." 1>&2
?                  |            exit 1
?                  |    fi
?                  | fi
--------------------------------------------------------------------------------
1: patch-9
    missing spaces
2: patch-4
    POSIX sh rewrite of sensible-{editor,pager}