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

Recursive Status

From: Michael Maxwell <mmaxwell_at_casl.umd.edu>
Date: Fri, 1 Aug 2008 17:03:04 -0400

I want to find the status of all the SVN files in the current directory which need to be checked in, and recursively in subdirectories, including both modified and added files (I can ignore unchanged files). This seems like it should be simple, but I'm having a hard time getting it to work reliably. In particular, while it's easy to get the 'M' files (modified files that haven't been checked in), I don't always get the 'A' files (files that have been added without yet having been checked in).

One approach would be to run a loop with all the files in the current dir and subdirs, with each filename submitted to 'svn status -q' (and further grepped to get only the 'A' and 'M' files). The problem with this is that some subdirectories have thousands of files, and the loop bogs down. These thousands of files happen to be data files, and I don't keep them in svn; but their suffix is '.xml', exactly the same as the suffix on some of the files I do keep in svn. So I can't easily eliminate them before the 'svn status' command.

The closest I've gotten is this:

REL_DIR=`pwd | sed -e"s%/groups/tto308/%%"` ; \
for fn in `$svn ls -R <SVN_TRUNK>/$REL_DIR` ; do \
        svn status -q $fn | grep "^[A|M]" ; \
        done \
     | sort -u

'<SVN_TRUNK>' gives me the URI of the svn server up to the point where our svn repository starts, and REL_DIR gives me the current directory relative to that position. This usually works, but it doesn't always catch the files that have been added but not yet checked in. (I can't figure out why it sometimes works and sometimes doesn't.) 'svn ls' doesn't seem to know about those files either.

Surely there's a simple way to do this?

(BTW, in case anyone is wondering, I usually check in a newly added file right away. But sometimes I copy another file over to serve as the shell of the new file, and add it before ripping the guts out to replace them with something else. And it seems silly to check in a file that I know is going to suffer massive changes.)

   Mike Maxwell
   CASL/ U Md

To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-01 23:03:25 CEST

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.