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

Re: Lack of $Id$ support - FAQ

From: David Good <dgood_at_fsautomation.com>
Date: 2004-07-19 19:15:44 CEST

On Mon, Jul 19, 2004 at 04:21:40PM +0200, Klaus Rennecke <kre@tigris.org> wrote:
> pwc@u.washington.edu wrote:
> >[...]
> >I have over a thousand files in which we have
> >been using ID when we need to verify that the
> >user has a correct version. The need to do a
> >propset for so many files is onerous
> >[...]
> What is wrong with something like
> $ find . \( -type d -a -name .svn -a -prune \) \
> -o \( -type f -a -print0 \) | \
> xargs -0 svn propset svn:keywords Id
> in a working copy? Takes a few seconds for the 1108 files in the current
> subversion source tree. Combine with -a -name \*.[ch] or similar in the
> second parenthesized expression to limit to specific file types.
> See find(1L), xargs(1L).

Or here's a perl script that'll list only text files that already have
the '$Id' keyword in them:

    use strict;
    use warnings;
    use File::Find;
    use Getopt::Std;
    our $opt_0;
    my $term = "\n";
    if ($opt_0){
        $term = "\0";
    die "usage: find_id [-0] DIR ...\n" unless @ARGV;
    find(\&process, @ARGV);
    sub process {
        return unless -f $_; # only interested in plain files
        return unless -T $_; # only interested in text files
        return if ($File::Find::name =~ m|/\.svn/|);
        open FILE, $_;
        while (<FILE>){
            if (/\$Id/){
                print $File::Find::name, $term;
        close FILE;

You can then save and examine the output or pipe it directly to xargs.
If your filenames might have spaces, use the '-0' option to this script
(as well as to xargs).

Someone familiar with the Perl bindings could probably add the 'svn propset'
directly to the script as well...

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Mon Jul 19 19:16:10 2004

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.