git-svn: don't allow commit if svn tree is not current
If new revisions are fetched, that implies we haven't merged, acked, or nacked them yet, and attempting to write the tree we're committing means we'd silently clobber the newly fetched changes. Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong committed
Jun 3, 2006 at 02:56 UTC
b63af9b340dd831840c70103c9f609940a910031
1 file changed
+9
-2
contrib/git-svn/git-svn.perl
+9
-2
@@ -309,9 +309,16 @@ sub commit {
309
}
310
chomp @revs;
311
312
- fetch();
313
- chdir $SVN_WC or croak $!;
312
+ chdir $SVN_WC or croak "Unable to chdir $SVN_WC: $!\n";
313
my $info = svn_info('.');
314
+ my $fetched = fetch();
315
+ if ($info->{Revision} != $fetched->{revision}) {
316
+ print STDERR "There are new revisions that were fetched ",
317
+ "and need to be merged (or acknowledged) ",
318
+ "before committing.\n";
319
+ exit 1;
320
+ }
321
+ $info = svn_info('.');
322
read_uuid($info);
323
my $svn_current_rev = $info->{'Last Changed Rev'};
324
foreach my $c (@revs) {