From 5398fed96699b5321678fdace86b6d4c62a155fb Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Fri, 3 Mar 2006 16:38:03 +1300 Subject: [PATCH 1/4] cvsserver: checkout faster by sending files in a sensible order Just by sending the files in an ordered fashion, clients can process them much faster. And we can optimize our check of whether we created this directory already -- faster. Timings for a checkout on a commandline cvs client for a project with ~13K files totalling ~100MB: Unsorted: 603.12 real 16.89 user 42.88 sys Sorted: 298.19 real 26.37 user 42.42 sys --- git-cvsserver.perl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 7b3ba1b9de..f707bd9376 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -584,6 +584,7 @@ sub req_co print "E cvs checkout: Updating $checkout_path\n"; my %seendirs = (); + my $lastdir =''; foreach my $git ( @{$updater->gethead} ) { @@ -603,7 +604,8 @@ sub req_co print "M U $checkout_path/$git->{name}\n"; } - if (length($git->{dir}) && $git->{dir} ne './' && !exists($seendirs{$git->{dir}})) { + if (length($git->{dir}) && $git->{dir} ne './' + && $git->{dir} ne $lastdir && !exists($seendirs{$git->{dir}})) { # Eclipse seems to need the Clear-sticky command # to prepare the 'Entries' file for the new directory. @@ -612,6 +614,7 @@ sub req_co print "Clear-static-directory $module/$git->{dir}\n"; print $state->{CVSROOT} . "/$module/$git->{dir}\n"; print "E cvs checkout: Updating /$module/$git->{dir}\n"; + $lastdir = $git->{dir}; $seendirs{$git->{dir}} = 1; } @@ -2349,7 +2352,7 @@ sub gethead return $self->{gethead_cache} if ( defined ( $self->{gethead_cache} ) ); - my $db_query = $self->{dbh}->prepare_cached("SELECT name, filehash, mode, revision, modified, commithash, author FROM head",{},1); + my $db_query = $self->{dbh}->prepare_cached("SELECT name, filehash, mode, revision, modified, commithash, author FROM head ORDER BY name ASC",{},1); $db_query->execute(); my $tree = []; From cfcbd3427e67056a00ec832645b057eaf33888d9 Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Fri, 3 Mar 2006 16:57:03 +1300 Subject: [PATCH 2/4] cvsserver: fix checkouts with -d A recent Eclipse compat fix broke checkouts with -d. Fix it so that the server sends the correct module name instead of the destination directory name. --- git-cvsserver.perl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git-cvsserver.perl b/git-cvsserver.perl index f707bd9376..abae4e7ee4 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -576,9 +576,9 @@ sub req_co # Eclipse seems to need the Clear-sticky command # to prepare the 'Entries' file for the new directory. print "Clear-sticky $checkout_path/\n"; - print $state->{CVSROOT} . "/$checkout_path/\n"; + print $state->{CVSROOT} . "/$module/\n"; print "Clear-static-directory $checkout_path/\n"; - print $state->{CVSROOT} . "/$checkout_path/\n"; + print $state->{CVSROOT} . "/$module/\n"; # instruct the client that we're checking out to $checkout_path print "E cvs checkout: Updating $checkout_path\n"; @@ -609,11 +609,11 @@ sub req_co # Eclipse seems to need the Clear-sticky command # to prepare the 'Entries' file for the new directory. - print "Clear-sticky $module/$git->{dir}\n"; + print "Clear-sticky $checkout_path/$git->{dir}\n"; print $state->{CVSROOT} . "/$module/$git->{dir}\n"; - print "Clear-static-directory $module/$git->{dir}\n"; + print "Clear-static-directory $checkout_path/$git->{dir}\n"; print $state->{CVSROOT} . "/$module/$git->{dir}\n"; - print "E cvs checkout: Updating /$module/$git->{dir}\n"; + print "E cvs checkout: Updating /$checkout_path/$git->{dir}\n"; $lastdir = $git->{dir}; $seendirs{$git->{dir}} = 1; } From 501c7372c73c980eed042c90e3518c2ab816c846 Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Fri, 3 Mar 2006 16:38:03 +1300 Subject: [PATCH 3/4] cvsserver: checkout faster by sending files in a sensible order Just by sending the files in an ordered fashion, clients can process them much faster. And we can optimize our check of whether we created this directory already -- faster. Timings for a checkout on a commandline cvs client for a project with ~13K files totalling ~100MB: Unsorted: 603.12 real 16.89 user 42.88 sys Sorted: 298.19 real 26.37 user 42.42 sys --- git-cvsserver.perl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 7b3ba1b9de..40b9c2af34 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -584,6 +584,7 @@ sub req_co print "E cvs checkout: Updating $checkout_path\n"; my %seendirs = (); + my $lastdir =''; foreach my $git ( @{$updater->gethead} ) { @@ -603,7 +604,8 @@ sub req_co print "M U $checkout_path/$git->{name}\n"; } - if (length($git->{dir}) && $git->{dir} ne './' && !exists($seendirs{$git->{dir}})) { + if (length($git->{dir}) && $git->{dir} ne './' + && $git->{dir} ne $lastdir && !exists($seendirs{$git->{dir}})) { # Eclipse seems to need the Clear-sticky command # to prepare the 'Entries' file for the new directory. @@ -612,6 +614,7 @@ sub req_co print "Clear-static-directory $module/$git->{dir}\n"; print $state->{CVSROOT} . "/$module/$git->{dir}\n"; print "E cvs checkout: Updating /$module/$git->{dir}\n"; + $lastdir = $git->{dir}; $seendirs{$git->{dir}} = 1; } @@ -2349,7 +2352,7 @@ sub gethead return $self->{gethead_cache} if ( defined ( $self->{gethead_cache} ) ); - my $db_query = $self->{dbh}->prepare_cached("SELECT name, filehash, mode, revision, modified, commithash, author FROM head",{},1); + my $db_query = $self->{dbh}->prepare_cached("SELECT name, filehash, mode, revision, modified, commithash, author FROM head ORDER BY name ASC",{},1); $db_query->execute(); my $tree = []; From e74ee784c7daf560044dad4a06fae66732ed414b Mon Sep 17 00:00:00 2001 From: Martin Langhoff Date: Fri, 3 Mar 2006 16:57:03 +1300 Subject: [PATCH 4/4] cvsserver: fix checkouts with -d A recent Eclipse compat fix broke checkouts with -d. Fix it so that the server sends the correct module name instead of the destination directory name. --- git-cvsserver.perl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 40b9c2af34..6f10d4c951 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -576,9 +576,9 @@ sub req_co # Eclipse seems to need the Clear-sticky command # to prepare the 'Entries' file for the new directory. print "Clear-sticky $checkout_path/\n"; - print $state->{CVSROOT} . "/$checkout_path/\n"; + print $state->{CVSROOT} . "/$module/\n"; print "Clear-static-directory $checkout_path/\n"; - print $state->{CVSROOT} . "/$checkout_path/\n"; + print $state->{CVSROOT} . "/$module/\n"; # instruct the client that we're checking out to $checkout_path print "E cvs checkout: Updating $checkout_path\n"; @@ -609,11 +609,11 @@ sub req_co # Eclipse seems to need the Clear-sticky command # to prepare the 'Entries' file for the new directory. - print "Clear-sticky $module/$git->{dir}\n"; + print "Clear-sticky $checkout_path/$git->{dir}\n"; print $state->{CVSROOT} . "/$module/$git->{dir}\n"; - print "Clear-static-directory $module/$git->{dir}\n"; + print "Clear-static-directory $checkout_path/$git->{dir}\n"; print $state->{CVSROOT} . "/$module/$git->{dir}\n"; - print "E cvs checkout: Updating /$module/$git->{dir}\n"; + print "E cvs checkout: Updating /$checkout_path/$git->{dir}\n"; $lastdir = $git->{dir}; $seendirs{$git->{dir}} = 1; }