tags:

views:

35

answers:

2

This is from svn docs(http://svnbook.red-bean.com/en/1.1/re44.html)

$ svnlook changed -r 39 /usr/local/svn/repos
A   trunk/vendors/deli/
A   trunk/vendors/deli/chips.txt
A   trunk/vendors/deli/sandwich.txt
A   trunk/vendors/deli/pickle.txt

I can check for trailing slash ("/") and if that exists, then it is a folder.

1) But how can I make sure that svn will always display folder path with the trailing slash?

2) Or, maybe there is more reliable way to check for path type(folder or file)?

+1  A: 

AFAIK there will always be a trailing slash on directory names as this signifies it is a directory. Otherwise it looks like a file without an extension.

Tom
A: 

Client side and assuming you have some kind of unix shell You could cut the 'A' part away then simply test if the path is a directory using shell provided fonctions. something like

set TEST=`cat test.txt | cut -c5-`
for p in $TEST;do
 if [[ -d $p ]];then
   echo "$p is a directory"
 fi
done

Server side you can use:

svnlook dirs-changed REPOS_PATH

to detect the changed directories then filter them out of the change log from "svnlook changed" or you could use:

 svn info $PATH

on each path and check the node kind, though that's probably going to be slow.

Jean
I don't think this will work because I am using svnlook on the server inside of pre-commit hook. Those paths don't actually exists on the server
Chicago
Oh sorry I hadn't noticed this was server side. you could use svn infoand check the Node Kind
Jean