git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] contrib/git-svn: fix a copied-tree bug in an overzealous assertion
@ 2006-03-03 21:35 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2006-03-03 21:35 UTC (permalink / raw
  To: Junio C Hamano, git list

I thought passing --stop-on-copy to svn would save us from all
the trouble svn-arch-mirror had with directory (project) copies.
I was wrong, there was one thing I overlooked.

If a tree was moved from /foo/trunk to /bar/foo/trunk with no
other changes in r10, but the last change was done in r5, the
Last Changed Rev (from svn info) in /bar/foo/trunk will still be
r5, even though the copy in the repository didn't exist until
r10.

Now, if we ever detect that the Last Changed Rev isn't what
we're expecting, we'll run svn diff and only croak if there are
differences between them.

Signed-off-by: Eric Wong <normalperson@yhbt.net>

---

 contrib/git-svn/git-svn.perl |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

35f4b65079f730e7413b8b585e44526e489e8b1c
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl
index 25d2935..c575883 100755
--- a/contrib/git-svn/git-svn.perl
+++ b/contrib/git-svn/git-svn.perl
@@ -337,10 +337,17 @@ sub assert_svn_wc_clean {
 	my ($svn_rev, $treeish) = @_;
 	croak "$svn_rev is not an integer!\n" unless ($svn_rev =~ /^\d+$/);
 	croak "$treeish is not a sha1!\n" unless ($treeish =~ /^$sha1$/o);
-	my $svn_info = svn_info('.');
-	if ($svn_rev != $svn_info->{'Last Changed Rev'}) {
-		croak "Expected r$svn_rev, got r",
-				$svn_info->{'Last Changed Rev'},"\n";
+	my $lcr = svn_info('.')->{'Last Changed Rev'};
+	if ($svn_rev != $lcr) {
+		print STDERR "Checking for copy-tree ... ";
+		# use
+		my @diff = grep(/^Index: /,(safe_qx(qw(svn diff),
+						"-r$lcr:$svn_rev")));
+		if (@diff) {
+			croak "Nope!  Expected r$svn_rev, got r$lcr\n";
+		} else {
+			print STDERR "OK!\n";
+		}
 	}
 	my @status = grep(!/^Performing status on external/,(`svn status`));
 	@status = grep(!/^\s*$/,@status);
-- 
1.2.4.g198d

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-03 21:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-03 21:35 [PATCH] contrib/git-svn: fix a copied-tree bug in an overzealous assertion Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).