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

Re: Adding forgotten files to a svn repository

From: Colin D Bennett <cbennett_at_radsoft.com>
Date: 2002-11-05 19:01:40 CET

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

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

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