{"thread":{"id":"3541","subject":"[PATCH] contrib/git-svn: fix a copied-tree bug in an overzealous assertion","startedAt":"2006-03-03T21:35:48Z","lastAt":"2006-03-03T21:35:48Z","messageCount":1,"participants":["Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"17121","messageId":"20060303213548.GA30403@localdomain","threadId":"3541","inReplyTo":null,"subject":"[PATCH] contrib/git-svn: fix a copied-tree bug in an overzealous assertion","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-03-03T21:35:48Z","receivedAt":"2006-03-03T21:35:48Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"I thought passing --stop-on-copy to svn would save us from all\nthe trouble svn-arch-mirror had with directory (project) copies.\nI was wrong, there was one thing I overlooked.\n\nIf a tree was moved from /foo/trunk to /bar/foo/trunk with no\nother changes in r10, but the last change was done in r5, the\nLast Changed Rev (from svn info) in /bar/foo/trunk will still be\nr5, even though the copy in the repository didn't exist until\nr10.\n\nNow, if we ever detect that the Last Changed Rev isn't what\nwe're expecting, we'll run svn diff and only croak if there are\ndifferences between them.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n contrib/git-svn/git-svn.perl |   15 +++++++++++----\n 1 files changed, 11 insertions(+), 4 deletions(-)\n\n35f4b65079f730e7413b8b585e44526e489e8b1c\ndiff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl\nindex 25d2935..c575883 100755\n--- a/contrib/git-svn/git-svn.perl\n+++ b/contrib/git-svn/git-svn.perl\n@@ -337,10 +337,17 @@ sub assert_svn_wc_clean {\n \tmy ($svn_rev, $treeish) = @_;\n \tcroak \"$svn_rev is not an integer!\\n\" unless ($svn_rev =~ /^\\d+$/);\n \tcroak \"$treeish is not a sha1!\\n\" unless ($treeish =~ /^$sha1$/o);\n-\tmy $svn_info = svn_info('.');\n-\tif ($svn_rev != $svn_info->{'Last Changed Rev'}) {\n-\t\tcroak \"Expected r$svn_rev, got r\",\n-\t\t\t\t$svn_info->{'Last Changed Rev'},\"\\n\";\n+\tmy $lcr = svn_info('.')->{'Last Changed Rev'};\n+\tif ($svn_rev != $lcr) {\n+\t\tprint STDERR \"Checking for copy-tree ... \";\n+\t\t# use\n+\t\tmy @diff = grep(/^Index: /,(safe_qx(qw(svn diff),\n+\t\t\t\t\t\t\"-r$lcr:$svn_rev\")));\n+\t\tif (@diff) {\n+\t\t\tcroak \"Nope!  Expected r$svn_rev, got r$lcr\\n\";\n+\t\t} else {\n+\t\t\tprint STDERR \"OK!\\n\";\n+\t\t}\n \t}\n \tmy @status = grep(!/^Performing status on external/,(`svn status`));\n \t@status = grep(!/^\\s*$/,@status);\n-- \n1.2.4.g198d\n"}]}