Skip to contentSkip to conversation

cvs importer woes

DISCUSSION Andreas Ericsson 3 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Sadly, the cvsimport command no longer works to create new repositories from scratch. I'm not nearly perl literate enough to fix it, but the problem seems to be firstly 061303f0b50a648db8e0af23791fc56181f6bf93. In particular "Also, make sure that the initial git-read-tree is performed." which fails if there is not a complete git repo already created with at least one tree committed.

Some sample output:

$ git cvsimport -k -u -d:local:/home/CVS packages
fatal: Not a git repository: '/data/home/exon/git/packages/.git'
read-tree failed: 32768

Removing the unconditional read-tree call, I get this (still in an empty directory which isn't a repo):

$ git cvsimport -k -u -d:local:/home/CVS packages
fatal: Not a git repository: '/data/home/exon/git/packages/.git'
read-tree failed: 32768
$ git init-db
defaulting to local storage area
$ git cvsimport -k -u -d:local:/home/CVS packages
fatal: Not a valid object name origin
read-tree failed: 32768

Bisect running now. v1.3.1 is good and imports the stuff properly to an empty directory.

Oh, now it's done (4 minutes for 620 revisions with automated testing between good/bad. *LOVE* bisect).

The culprit is definitely 061303f0b50a648db8e0af23791fc56181f6bf93.

Any perl-literate takers? Otherwise, just reverting the patch makes things work (for me) again.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#1 lore raw
Quoted 2 lines · Andreas Ericsson

Sadly, the cvsimport command no longer works to create new repositories from scratch.

We are seeing some breakage in cvsimport that started with a patch of mine:

8f732649bc4d5619a1b399e5808b3f4c662ad200 cvsimport: keep one index per branch during import

so I'd say that if you are using cvsimport, stick to the v1.4.0 version. You can do

git-cat-file blob v1.4.0:git-cvsimport.perl >git-cvsimport.perl

Quoted 1 line

problem seems to be firstly 061303f0b50a648db8e0af23791fc56181f6bf93.

Yes, that commit will break brand new imports, but it's trying to fixup breakage that started with my patch. It shouldn't be too hard to fix up, but real life is interfering.

Quoted 2 lines

Oh, now it's done (4 minutes for 620 revisions with automated testing between good/bad. *LOVE* bisect).

Love bisect too for easy-to-test cases.

Quoted 4 lines

The culprit is definitely 061303f0b50a648db8e0af23791fc56181f6bf93.

Any perl-literate takers? Otherwise, just reverting the patch makes things work (for me) again.

Don't just revert that patch, unless I'm wrong there is some subtle branch-creation breakage too.

cheers,

martin

#2 lore raw
Quoted 11 lines · Martin Langhoff
Quoted 2 lines · Andreas Ericsson

Sadly, the cvsimport command no longer works to create new repositories from scratch.

We are seeing some breakage in cvsimport that started with a patch of mine:

8f732649bc4d5619a1b399e5808b3f4c662ad200 cvsimport: keep one index per branch during import

I experimented a bit with that one too, but it worked for my (very small, no branches, no tags) cvs repo

Quoted 10 lines
Quoted 5 lines

The culprit is definitely 061303f0b50a648db8e0af23791fc56181f6bf93.

Any perl-literate takers? Otherwise, just reverting the patch makes things work (for me) again.

Don't just revert that patch, unless I'm wrong there is some subtle branch-creation breakage too.

Dscho's patch on top of 061303f0b works wonders. Thanks all the same though.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#3 lore raw

[TRYTHIS] cvsimport: fix initial import

In reply to Andreas Ericsson

---
Hi,

Quoted 3 lines · Andreas Ericsson

Sadly, the cvsimport command no longer works to create new repositories from scratch. I'm not nearly perl literate enough to fix it, but the problem seems to be firstly 061303f0b50a648db8e0af23791fc56181f6bf93.

My bad. Could you try this patch on top of 'next'?

 git-cvsimport.perl |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
git-cvsimport.perl +0 -1
index 50f5d96..f8eb6ef 100755
@@ -471,7 +471,6 @@ my %index; # holds filenames of one inde
 
 $ENV{GIT_INDEX_FILE} = $index{$opt_o};
 system("git-read-tree", $opt_o);
-die "read-tree failed: $?\n" if $?;
 
 unless(-d $git_dir) {
 	system("git-init-db");
#4 lore raw

Re: [TRYTHIS] cvsimport: fix initial import

Quoted 6 lines · Johannes Schindelin

---
Hi,

On Tue, 27 Jun 2006, Andreas Ericsson wrote:

Quoted 7 lines
Quoted 3 lines

Sadly, the cvsimport command no longer works to create new repositories from scratch. I'm not nearly perl literate enough to fix it, but the problem seems to be firstly 061303f0b50a648db8e0af23791fc56181f6bf93.

My bad. Could you try this patch on top of 'next'?

Works wonderfully. Weird that it didn't when I removed the read-tree completely. There was probably some pilot error involved on my part there and then.

Thanks, and ack.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#5 lore raw

Re: [TRYTHIS] cvsimport: fix initial import

In reply to Johannes Schindelin

Hi Johannes,

this patch doesn't quite make sense to me. The git-read-tree should be in the else block of the unless you have right there (and it's actually there, but it may be breaking in some cases? Perhaps should happen a bit earlier?).

How do you expect to run git-read-tree or die _before_ git-init-db?

cheers,

martin

#6 lore raw

Re: [TRYTHIS] cvsimport: fix initial import

Hi,

Quoted 6 lines · Martin Langhoff

this patch doesn't quite make sense to me. The git-read-tree should be in the else block of the unless you have right there (and it's actually there, but it may be breaking in some cases? Perhaps should happen a bit earlier?).

How do you expect to run git-read-tree or die _before_ git-init-db?

Oops. I even do not remember what I smoked.

The git-read-tree before git-init-db evidently only works if this is not the initial import. Which it wasn't in my case.

And I keep getting confused with the "if" and "unless" sometimes prepended, sometimes appended. Well, that is Perl before Swine for me ;-)

How about this instead:

 git-cvsimport.perl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
git-cvsimport.perl +2 -2
index 50f5d96..4caef10 100755
@@ -470,8 +470,6 @@ my %index; # holds filenames of one inde
 $index{$opt_o} = tmpnam();
 
 $ENV{GIT_INDEX_FILE} = $index{$opt_o};
-system("git-read-tree", $opt_o);
-die "read-tree failed: $?\n" if $?;
 
 unless(-d $git_dir) {
 	system("git-init-db");
@@ -482,6 +480,8 @@ unless(-d $git_dir) {
 	$last_branch = $opt_o;
 	$orig_branch = "";
 } else {
+	system("git-read-tree", $opt_o);
+	die "read-tree failed: $?\n" if $?;
 	-f "$git_dir/refs/heads/$opt_o"
 		or die "Branch '$opt_o' does not exist.\n".
 		       "Either use the correct '-o branch' option,\n".