0

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.

Bruce K
  • 749
  • 5
  • 15

3 Answers3

0

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

jstanley
  • 2,087
  • 15
  • 22
  • No, thank you. I want to know which files have been added or removed. Thank you. – Bruce K Apr 10 '14 at 14:33
  • This diff will display what files are in one stream versus the other, IE added/removed. If you add foo to stream1 and defunct bar in stream2, the diff will reflect foo missing in stream2 and bar missing in stream1. – jstanley Apr 10 '14 at 17:58
  • Yes, but it _is_ also cluttered with the actual line-by-line differences. I can extract the added/removed files with some seddery. I think it boils down to an RFE to the accurev folks because I see no simple way. Thank you for your suggestions anyway. :) – Bruce K Apr 10 '14 at 19:27
  • P.S. I just tried the diff to see if I could find added/removed files. If you choose the correct ordering of "-v" and "-V" you can see "/./foo/bar created" but in the reverse ordering, "foo/bar" is gone. – Bruce K Apr 10 '14 at 19:44
0

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.

David Howland
  • 402
  • 2
  • 3
  • I am after a list of files added and a list of files removed (present in one stream, but not the other). – Bruce K Apr 10 '14 at 14:34
0

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.

Bruce K
  • 749
  • 5
  • 15