X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=.vim%2Fperforce%2Fp4Utils.sh;fp=.vim%2Fperforce%2Fp4Utils.sh;h=bcc92c668a38a91df1b04723ac2ee1a2fdae061b;hb=d0d885039e0b7f2242d6db6eb2ba36da132f1b94;hp=0000000000000000000000000000000000000000;hpb=85808cfafda2e74a99654d9a940291563b13cd85;p=profile.git diff --git a/.vim/perforce/p4Utils.sh b/.vim/perforce/p4Utils.sh new file mode 100755 index 0000000..bcc92c6 --- /dev/null +++ b/.vim/perforce/p4Utils.sh @@ -0,0 +1,24 @@ +# Get the list of unopened files under the given $1/$2 directory. +# It should be possible to implement the logic by using temp files and diff, +# but this was more challenging to me :) +# Ex: +# unOpenedFiles=`getUnOpenedFiles "$root" "src"` +getUnOpenedFiles() { + path=$1 + dir=$2 + p4 opened $path/$dir/... \ + | sed -e 's/.*'$dir'/'$dir'/' -e 's/#.*$//' \ + | perl -n -e ' + print; + END + { + # Merge the opened list with all the files under BaseClasses. + foreach $f (`find '$path/$dir' -type f | sed -e "s/.*'$dir'/'$dir'/"`) + { + print $f; + } + }' \ + | sort -f \ + | uniq -c \ + | sed -n -e 's/\s*1\s*//p' +}