Question

I need to see which files have been added or removed between two streams. The most obvious way would be "git lsfiles" in each stream. Except this is not GIT and I do not see an analogous command. So for today:

for f in $(find * -type f);do
    accurev stat "$f"
done | \
    fgrep -v '(external)' | \
    awk '{print $1}' > .list

If there is a better way, it should be clear and easy to find here:

http://www.accurev.com/download/docs/5.7.0_books/AccuRev_5_7_User_CLI.pdf

but it is not. Help? Thank you.

Was it helpful?

Solution 3

Since neither of the two answers addressed the question, I eventually worked out a script to do what is really needed. "accurev lsfiles" is sorely needed.

#! /bin/bash

declare -r progpid=$$
declare -r progdir=$(cd $(dirname $0) >/dev/null && pwd)
declare -r prog=$(basename $0)
declare -r program="$progdir/$prog"
declare -r usage_text=' [ <directory> ... ]
If no directory is specified, "." is assumed'

die() {
    echo "$prog error:  $*"
    exec 1>/dev/null 2>&1
    kill -9 $progpid
    exit 1
} 1>&2

usage() {
    test $# -gt 0 && {
        exec 1>&2
        echo "$prog usage error:  $*"
    }
    printf "USAGE:  $prog %s\n" "$usage_text"
    exit $#
}

init() {
    shift_ct=$#
    tmpd=$(mktemp -d ${TMPDIR:-/tmp}/ls-XXXXXX)
    test -d "$tmpd" || die "mktemp -d does not work"
    exec 4> ${tmpd}/files
    trap "rm -rf '$tmpd'" EXIT
    prune_pat=

    while :
    do
        test $# -eq 0 && break
        test -f "$1" && break
        [[ "$1" =~ -.* ]] || break
        case "X$1" in
            X-p )
                prune_pat+="${2}|"
                shift 2 || usage "missing arg for '-p' option"
                ;;

            X-p* )
                prune_pat+="${1#-p}"
                shift
                ;;

            X-x* )
                set -x
                tput reset 1>&2
                PS4='>${FUNCNAME:-lsf}> '
                shift
                ;;

            X-* )
                usage "unknown option:  $1"
                ;;

            * )
                break
                ;;
        esac
    done

    (( shift_ct -= $# ))
    test ${#prune_pat} -gt 0 && \
        prune_pat='(^|/)('${prune_pat%|}')$'
}

chkdir() {
    declare list=$(exec 2> /dev/null
        for f in "$@"
        do ls -d ${f}/* ${f}/.*
        done | \
            grep -v -E '.*/\.\.*$' )

    for f in $(accurev stat ${list} | \
        grep -v -F '(external)' | \
        awk '{print $1}' | \
        sed 's@^/*\./@@')
    do
        test ${#prune_pat} -gt 0 && [[ $f =~ ${prune_pat} ]] && continue

        if test -d "$f"
        then chkdir "$f"
        elif test -f "$f" -o -L "$f"
        then echo "$f" 1>&4
        fi
    done
}

init ${1+"$@"}
(( shift_ct > 0 )) && shift ${shift_ct}
test $# -eq 0 && set -- .
chkdir "$@"
exec 4>&-
sort -u ${tmpd}/files

It is a bit over-the-top, but I have a boilerplate I always use for my scripts.

OTHER TIPS

If you want to see the difference between two streams, run the following command: accurev diff -a -v "Stream1" -V "Stream2"

As the command line question has been answered, here's how to do the same via the AccuRev GUI.

  1. Select one dynamic stream, workspace or snapshot.
  2. Right click and select "Show Diff By Files"
  3. Select a different dynamic stream, workspace or snapshot.

    You'll be presented with a list of files different between the two choices, and yes you can mix-and-match between dynamic streams, workspaces and snapshots.

    You can then select any file and select "Show Difference" to see differences between the two files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top