Browse Source

cvsserver: Show correct letters for modified, removed and added files

Earlier, cvsserver showed always an 'U', sometimes even without a space
between the 'U' and the name. Now, the correct letter is shown, with a
space.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Johannes Schindelin 19 years ago committed by Junio C Hamano
parent
commit
0a7a9a12d6
  1. 63
      git-cvsserver.perl

63
git-cvsserver.perl

@ -805,7 +805,14 @@ sub req_update
$meta = $updater->getmeta($filename); $meta = $updater->getmeta($filename);
} }


next unless ( $meta->{revision} ); if ( ! defined $meta )
{
$meta = {
name => $filename,
revision => 0,
filehash => 'added'
};
}


my $oldmeta = $meta; my $oldmeta = $meta;


@ -835,7 +842,7 @@ sub req_update
and not exists ( $state->{opt}{C} ) ) and not exists ( $state->{opt}{C} ) )
{ {
$log->info("Tell the client the file is modified"); $log->info("Tell the client the file is modified");
print "MT text U\n"; print "MT text M \n";
print "MT fname $filename\n"; print "MT fname $filename\n";
print "MT newline\n"; print "MT newline\n";
next; next;
@ -855,15 +862,36 @@ sub req_update
} }
} }
elsif ( not defined ( $state->{entries}{$filename}{modified_hash} ) elsif ( not defined ( $state->{entries}{$filename}{modified_hash} )
or $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash} ) or $state->{entries}{$filename}{modified_hash} eq $oldmeta->{filehash}
or $meta->{filehash} eq 'added' )
{ {
$log->info("Updating '$filename'"); # normal update, just send the new revision (either U=Update,
# normal update, just send the new revision (either U=Update, or A=Add, or R=Remove) # or A=Add, or R=Remove)
print "MT +updated\n"; if ( defined($wrev) && $wrev < 0 )
print "MT text U\n"; {
print "MT fname $filename\n"; $log->info("Tell the client the file is scheduled for removal");
print "MT newline\n"; print "MT text R \n";
print "MT -updated\n"; print "MT fname $filename\n";
print "MT newline\n";
next;
}
elsif ( !defined($wrev) || $wrev == 0 )
{
$log->info("Tell the client the file will be added");
print "MT text A \n";
print "MT fname $filename\n";
print "MT newline\n";
next;

}
else {
$log->info("Updating '$filename' $wrev");
print "MT +updated\n";
print "MT text U \n";
print "MT fname $filename\n";
print "MT newline\n";
print "MT -updated\n";
}


my ( $filepart, $dirpart ) = filenamesplit($filename,1); my ( $filepart, $dirpart ) = filenamesplit($filename,1);


@ -1709,6 +1737,17 @@ sub argsfromdir


return if ( scalar ( @{$state->{args}} ) > 1 ); return if ( scalar ( @{$state->{args}} ) > 1 );


my @gethead = @{$updater->gethead};

# push added files
foreach my $file (keys %{$state->{entries}}) {
if ( exists $state->{entries}{$file}{revision} &&
$state->{entries}{$file}{revision} == 0 )
{
push @gethead, { name => $file, filehash => 'added' };
}
}

if ( scalar(@{$state->{args}}) == 1 ) if ( scalar(@{$state->{args}}) == 1 )
{ {
my $arg = $state->{args}[0]; my $arg = $state->{args}[0];
@ -1716,7 +1755,7 @@ sub argsfromdir


$log->info("Only one arg specified, checking for directory expansion on '$arg'"); $log->info("Only one arg specified, checking for directory expansion on '$arg'");


foreach my $file ( @{$updater->gethead} ) foreach my $file ( @gethead )
{ {
next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) ); next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) );
next unless ( $file->{name} =~ /^$arg\// or $file->{name} eq $arg ); next unless ( $file->{name} =~ /^$arg\// or $file->{name} eq $arg );
@ -1729,7 +1768,7 @@ sub argsfromdir


$state->{args} = []; $state->{args} = [];


foreach my $file ( @{$updater->gethead} ) foreach my $file ( @gethead )
{ {
next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) ); next if ( $file->{filehash} eq "deleted" and not defined ( $state->{entries}{$file->{name}} ) );
next unless ( $file->{name} =~ s/^$state->{prependdir}// ); next unless ( $file->{name} =~ s/^$state->{prependdir}// );

Loading…
Cancel
Save