threads / discuss / 4678

cvs importer woes

Subject: cvs importer woes

## tl;dr

7 messages between Jun 27, 2006 and Jun 27, 2006.

replies: 6people: 3as markdown or json

Andreas Ericsson· Jun 27, 2006, 10:05 UTC · lore

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.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Johannes Schindelin· Jun 27, 2006, 10:35 UTC · re: Andreas Ericsson · lore

[TRYTHIS] cvsimport: fix initial import

--- Hi,

On Tue, 27 Jun 2006, Andreas Ericsson wrote:
> 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(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 50f5d96..f8eb6ef 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -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");
Andreas Ericsson· Jun 27, 2006, 10:41 UTC · re: Johannes Schindelin · lore

Re: [TRYTHIS] cvsimport: fix initial import

Johannes Schindelin wrote:
Show 13 quoted lines
> ---
> Hi,
> 
> On Tue, 27 Jun 2006, Andreas Ericsson wrote:
> 
> 
>>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.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Martin Langhoff· Jun 27, 2006, 10:52 UTC · re: Johannes Schindelin · lore

Re: [TRYTHIS] cvsimport: fix initial import

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
Johannes Schindelin· Jun 27, 2006, 11:01 UTC · re: Martin Langhoff · lore

Re: [TRYTHIS] cvsimport: fix initial import

Hi,
On Tue, 27 Jun 2006, Martin Langhoff wrote:
Show 6 quoted lines
> 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(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 50f5d96..4caef10 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -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".
Martin Langhoff· Jun 27, 2006, 10:42 UTC · re: Andreas Ericsson · lore

Re: cvs importer woes

On 6/27/06, Andreas Ericsson <ae@op5.se> wrote:
> 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
> 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.

> 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.
> 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
Andreas Ericsson· Jun 27, 2006, 10:49 UTC · re: Martin Langhoff · lore

Re: cvs importer woes

Martin Langhoff wrote:
Show 11 quoted lines
> On 6/27/06, Andreas Ericsson <ae@op5.se> wrote:
> 
>> 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

Show 10 quoted 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.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

← back to recent threads