On Tuesday 05 November 2002 06:29, Ben Collins-Sussman wrote:
> ...
> Run 'svn status' in a working copy. Any unversioned items show up
> with a '?'. You can write a little shell script to grep those
> filenames out of the list and pipe them into 'xargs svn add'.
>
> People have posted such examples around here somewhere...
Here's a very simple script I hacked together one day so I could unpack a
source tarball into a working copy, run the script, and then svn commit, and
the repo should then be synced with my tarball.
#!/usr/bin/perl -w
# Syncronize an svn workspace by scheduling any files added or removed
# from the working copy to be added/removed from svn.
#
use strict;
my @added = ();
my @removed = ();
while (<>) {
/^(.)(.) {5}(.*)$/ or do { print "line didn't match: $_"; next; };
my $status = $1;
my $propstatus = $2;
my $file = $3;
$status eq "!" && push(@removed, $file);
$status eq "?" && push(@added, $file);
}
@removed > 0 and print "svn rm " . join(' ', @removed) . "\n\n";
@added > 0 and print "svn add " . join(' ', @added) . "\n\n";
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 5 19:02:04 2002