* git-svnimport issue with rename+change in the same commit
@ 2006-02-14 17:12 Eduardo Pereira Habkost
2006-02-14 17:29 ` Manu
0 siblings, 1 reply; 2+ messages in thread
From: Eduardo Pereira Habkost @ 2006-02-14 17:12 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 1708 bytes --]
Hi,
I've just hit a problem when using git-svnimport to import a big
subversion repository: it doesn't import correctly a commit when the
commit renames (or copies) and modify a file at the same time.
At the bottom of this message, there is a script that reproduces the bug.
The result of the final 'diff' command on the script is:
diff -u --exclude .git --exclude .svn checkout/universe.py
git/universe.py
--- checkout/universe.py 2006-02-14 14:55:37.000000000 -0200
+++ git/universe.py 2006-02-14 14:55:38.000000000 -0200
@@ -1 +1 @@
-print "Hello, universe!"
+print "Hello, world!"
git-svnadmin is just taking the original version of the file when
the commit has a 'file copy', even if this copy was modified before
the commit.
However I can't see a way to fix this problem without making the script
ignore completely the the "copied from" information from the svn commits
(and always fetching the resulting files from the repository). It seems
that subversion doesn't tell us if the copied file was changed (or this
information is hidden somewhere else).
--
Eduardo
#!/bin/sh
set -e
mkdir repos
svnadmin create $PWD/repos
repos=file://$PWD/repos
svn mkdir $repos/trunk -m 'creating trunk'
svn co file://$PWD/repos/trunk checkout
cd checkout
cat >hello.py <<EOF
print "Hello, world!"
EOF
svn add hello.py
svn commit -m 'adding hello.py'
svn mv hello.py world.py
svn commit -m 'renaming to world.py'
svn mv world.py universe.py
sed -i -e 's/world/universe/' universe.py
svn commit -m 'universe, now'
cd ..
mkdir git
cd git
git svnimport $repos
cd ..
diff -u --exclude .git --exclude .svn checkout git # will report differences
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: git-svnimport issue with rename+change in the same commit
2006-02-14 17:12 git-svnimport issue with rename+change in the same commit Eduardo Pereira Habkost
@ 2006-02-14 17:29 ` Manu
0 siblings, 0 replies; 2+ messages in thread
From: Manu @ 2006-02-14 17:29 UTC (permalink / raw)
To: Eduardo Pereira Habkost; +Cc: git
Hi,
Eduardo Pereira Habkost wrote:
> Hi,
>
> I've just hit a problem when using git-svnimport to import a big
> subversion repository: it doesn't import correctly a commit when the
> commit renames (or copies) and modify a file at the same time.
I came accross the same problem myself. Here is a patch that seemed to
do the trick for me.
I tried your script, and it also seems to work.
Regards,
Emmanuel
---
[PATCH] git-svnimport: Correction when a "copy_path" has different
contents for src and dest.
In my SVN repository, there is a weird log:
A /trunk/mydir2 (from /trunk/mydir1:4)
R /trunk/mydir2/test.txt (from /trunk/mydir1/test.txt:4)
As a result, mydir2/test.txt is different than mydir1/test.txt, but
git-svnimport assumes that the content of mydir2/test.txt is the same
as mydir1/test.txt.
This patch adds a test in copy_path, that makes sure that src and dest
have the same content. If not, it uses the content of dest.
---
git-svnimport.perl | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
e107ff9a06497a0003036ffafa45fa9dc050ecc4
diff --git a/git-svnimport.perl b/git-svnimport.perl
index f17d5a2..a2faa9a 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -409,6 +409,12 @@ sub copy_path($$$$$$$$) {
$p = $path . substr($p,length($srcpath)-1);
} else {
$p = $path;
+ # Deal with copy and modification
+ my $f=get_file($newrev,$newbranch,$path);
+ my ($tmode,$tsha1,$tp)=@$f;
+ if ($tsha1 ne $sha1) {
+ $sha1=$tsha1;
+ }
}
push(@$new,[$mode,$sha1,$p]);
}
--
1.1.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-02-14 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-14 17:12 git-svnimport issue with rename+change in the same commit Eduardo Pereira Habkost
2006-02-14 17:29 ` Manu
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 NNTP newsgroup(s).