I've been doing a lot of Ruby on Rails dev work lately, and the framework tends to generate a lot of files. Until recently, I was using a combination of "svn status" piped into grep, awk, and xargs to accomplish adding new files recursively. A friend recently told me to check out the following solution instead.
svn --force add *
The only negative side effect I can see is that it seems to add ignored files back into the tree. This is mostly a non-issue for me, but take note.
Showing posts with label svn. Show all posts
Showing posts with label svn. Show all posts
Monday, August 11, 2008
Friday, May 2, 2008
Finding Recent SVN Commits
Here's a quick Perl script I whipped up to ease finding newly committed files in our subversion repository. It's a little cleaner than what the client provides and nice to quickly find changes.
#!/usr/bin/perl -w
#
# quick script to succinctly display SVN changes since a given date
# usage: svnsince.pl YYYY-MM-DD HH:MM
#
use strict;
use Date::Calc qw(Date_to_Time);
if (!defined($ARGV[0]) || $ARGV[0] !~ /^\d\d\d\d-\d\d-\d\d$/) {
die("Invalid date. Usage: $0 YYYY-MM-DD HH:MM.");
}
if (!defined($ARGV[1]) || $ARGV[1] !~ /^\d\d:\d\d$/) {
die("Invalid time. Usage: $0 YYYY-MM-DD HH:MM.");
}
my $date_thresh = date_to_epoch($ARGV[0], $ARGV[1]);
my $svn_file = "";
my $svn_date = "";
open(SVN, "svn info -R |") || die("Can't run svn client: $!");
while (<SVN>) {
if (/^Path: (.+)/) {
$svn_file = $1;
}
if (/^Last Changed Date: (\d\d\d\d-\d\d-\d\d) (\d\d:\d\d)/) {
$svn_date = date_to_epoch($1, $2);
if ($svn_date >= $date_thresh) {
print "$1 $2 $svn_file\n";
}
}
}
close(SVN);
sub date_to_epoch {
my ($date, $time) = @_;
my ($year, $month, $day) = split(/-/, $date);
my ($hour, $minute) = split(/:/, $time);
return Date_to_Time($year, $month, $day, $hour, $minute, 0);
}
Thursday, April 10, 2008
Restore a Deleted SVN Directory
Occasionally when working with a group of developers, someone (and I'm not going to name names...) will accidentally delete an entire directory of the subversion trunk and commit that change. Luckily, it's not the end of the world if this happens. Change directories into the root of your subversion source tree and issue a merge command as follows:
svn merge -r [bad revision]:[good revision] .
example:
svn merge -r 13831:13830 .
After that, checkin your changes, and you're back in business. You can determine revision numbers by doing something like:
svn log -v . | less
svn merge -r [bad revision]:[good revision] .
example:
svn merge -r 13831:13830 .
After that, checkin your changes, and you're back in business. You can determine revision numbers by doing something like:
svn log -v . | less
Subscribe to:
Posts (Atom)