[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: Daniel Rall <dlr_at_finemaltcoding.com>
Date: 2002-11-05 22:10:34 CET

Colin D Bennett <cbennett@radsoft.com> writes:

> 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";

Might be nice to include something like this in the tools section of
the repo as a starting place for people needing this sort of
functionality. Of course, then the documentaiton would need to
mention it so seekers would know that it even existed. Of course,
then users would have to actually read the documentation..

-- 
Daniel Rall <dlr@finemaltcoding.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 5 22:11:16 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.