[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised

Early versions of git-cvsimport defaulted to using preexisting keyword
expansion settings. This change preserves compatibility with existing cvs
imports and allows new repository migrations to kill keyword expansion.

After exploration of the different -k modes in the cvs protocol, we use -kk
which kills keyword expansion wherever possible. Against the protocol
spec, -ko and -kb will sometimes expand keywords.

Should improve our chances of detecting merges and reduce imported
repository size.

Signed-off: Martin Langhoff <martin.langhoff@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Martin Langhoff
2005-08-16 17:39:29 +12:00
committed by Junio C Hamano
parent d920032042
commit abe0582207
2 changed files with 13 additions and 6 deletions

View File

@ -11,7 +11,7 @@ SYNOPSIS
-------- --------
'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] 'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]
[ -d <CVSROOT> ] [ -p <options-for-cvsps> ] [ -d <CVSROOT> ] [ -p <options-for-cvsps> ]
[ -C <GIT_repository> ] [ -i ] [ <CVS_module> ] [ -C <GIT_repository> ] [ -i ] [ -k ] [ <CVS_module> ]
DESCRIPTION DESCRIPTION
@ -38,6 +38,11 @@ OPTIONS
ensures the working directory and cache remain untouched and will ensures the working directory and cache remain untouched and will
not create them if they do not exist. not create them if they do not exist.
-k::
Kill keywords: will extract files with -kk from the CVS archive
to avoid noisy changesets. Highly recommended, but off by default
to preserve compatibility with early imported trees.
-o <branch-for-HEAD>:: -o <branch-for-HEAD>::
The 'HEAD' branch from CVS is imported to the 'origin' branch within The 'HEAD' branch from CVS is imported to the 'origin' branch within
the git repository, as 'HEAD' already has a special meaning for git. the git repository, as 'HEAD' already has a special meaning for git.

View File

@ -28,19 +28,19 @@ use POSIX qw(strftime dup2);
$SIG{'PIPE'}="IGNORE"; $SIG{'PIPE'}="IGNORE";
$ENV{'TZ'}="UTC"; $ENV{'TZ'}="UTC";
our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i); our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);
sub usage() { sub usage() {
print STDERR <<END; print STDERR <<END;
Usage: ${\basename $0} # fetch/update GIT from CVS Usage: ${\basename $0} # fetch/update GIT from CVS
[ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ] [ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ]
[ -p opts-for-cvsps ] [ -C GIT_repository ] [ -z fuzz ] [ -p opts-for-cvsps ] [ -C GIT_repository ] [ -z fuzz ]
[ -i ] [ CVS_module ] [ -i ] [ -k ] [ CVS_module ]
END END
exit(1); exit(1);
} }
getopts("hivo:d:p:C:z:") or usage(); getopts("hivko:d:p:C:z:") or usage();
usage if $opt_h; usage if $opt_h;
@ARGV <= 1 or usage(); @ARGV <= 1 or usage();
@ -218,8 +218,10 @@ sub _file {
my($self,$fn,$rev) = @_; my($self,$fn,$rev) = @_;
$self->{'socketo'}->write("Argument -N\n") or return undef; $self->{'socketo'}->write("Argument -N\n") or return undef;
$self->{'socketo'}->write("Argument -P\n") or return undef; $self->{'socketo'}->write("Argument -P\n") or return undef;
# $self->{'socketo'}->write("Argument -ko\n") or return undef; # -kk: Linus' version doesn't use it - defaults to off
# -ko: Linus' version doesn't use it if ($opt_k) {
$self->{'socketo'}->write("Argument -kk\n") or return undef;
}
$self->{'socketo'}->write("Argument -r\n") or return undef; $self->{'socketo'}->write("Argument -r\n") or return undef;
$self->{'socketo'}->write("Argument $rev\n") or return undef; $self->{'socketo'}->write("Argument $rev\n") or return undef;
$self->{'socketo'}->write("Argument --\n") or return undef; $self->{'socketo'}->write("Argument --\n") or return undef;