[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [svn] Re: Determining which files are treated as binary

From: Eli Barzilay <eli_at_barzilay.org>
Date: 2005-06-02 18:09:43 CEST

On Jun 2, Thomas Moschny wrote:
> On Thursday 02 June 2005 16:55, Christopher Ness wrote:
> > I think this will work:
> >
> > find . -! -path '*/.svn/*' -type f | \
> > xargs svn propget "svn:mime-type" 2>/dev/null | \
> > grep -v "- text/"
>
> This will not work if there are filenames with spaces in it, and especially
> not for files named e.g. 'foobar - text.doc'.
>
> What about this:
>
> find . -! -path '*/.svn/*' -type f -exec sh -c \
> 'if test "`svn propget svn:mime-type $0 2>/dev/null '\
> '| cut -f1 -d/`" != "text" ; then echo $0 ; fi' \{\} \;
>
> But of course this is somewhat slower, because svn propget is executed for
> each file.

IIUC, you have to do it that way, since `svn propget' will not display
anything for files with no svn:mime-type property.

Anyway, this is my hack -- it shows the eol-style too, and uses `file'
to look for files with weird eols.

----------------------------------------------------------------------
#!/bin/sh
find . -name .svn -type d -prune -o -type f -print \
| \
while true; do
  read f
  if [ "x$f" = "x" ]; then exit; fi
  echo "$f:" \
       "{`svn propget svn:mime-type \"${f}@BASE\"`}" \
       "{`svn propget svn:eol-style \"${f}@BASE\"`}" \
       "{`file \"$f\" | egrep -o '(CR|LF|NEL|CRLF(.*LF)?)'`}"
done
----------------------------------------------------------------------

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jun 2 18:26:47 2005

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.