2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: bin/sde-list-changes
6 # Copyright (C) 2007 The OpenSDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- SDE-COPYRIGHT-NOTE-END ---
17 export SDEROOT
=$
( cd "${0%/*}/.."; pwd -P )
19 .
$SDEROOT/lib
/libsde.
in
22 local progname
=${0##*/}
24 Usage: $progname [-C <directory>] [--status] [LOCATIONS...]
29 longopts
='directory:,status'
30 options
=$
( getopt
-o "$shortopts" -l "$longopts" -- "$@" )
36 # load new arguments list
37 eval set -- "$options"
42 while [ $# -gt 0 ]; do
44 -C|
--directory) root
="$2"; shift ;;
45 --status) show_status
=1 ;;
48 *) echo_abort
1 "Unknown argument '$1', aborting."
53 print_error
() { echo "$@" >&2; }
55 # validate root directory, and jump there
56 [ -d "$root" ] || echo_abort
1 "$root: Invalid root directory."
59 if [ -d '.git' ]; then
64 if [ -n "$show_status" ]; then
69 git-diff-index
$status HEAD
"$@" &
73 [ ! -f '.gitignore' ] || exclude
="-X .gitignore"
74 git-ls-files
--others --directory $exclude "$@" |
while read f
; do
75 # be sure to not include sub-projects
76 if [ -d "$f/.git" -o -d "$f/.svn" ]; then
79 elif [ -n "$show_status" ]; then
86 # wait for git-diff-index
88 elif [ -d '.svn' ]; then
92 svn st
--ignore-externals -- "$@" |
while read l
; do
93 s1
="${l:0:1}" # ' ' A C D I M R X ? ! ~
94 s2
="${l:1:1}" # ' ' C M
97 # be sure to not include sub-projects
98 if [ -d "$f/.git" -o -d "$f/.svn" ]; then
101 elif [ -n "$show_status" ]; then
102 # the status is wanted
103 if [ "$s2" != ' ' ]; then
104 # changes on the properties go first
106 elif [ "$s1" != ' ' ]; then
107 # and changes on the item, next
109 fi # other changes, ignored
110 elif [ "$s1$s2" != ' ' ]; then
111 # only the filename is wanted, but when the change is interesting
116 print_error
"$root: Invalid Version Control System."