{"thread":{"id":"1532","subject":"[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised","startedAt":"2005-08-16T05:39:29Z","lastAt":"2005-08-16T05:39:29Z","messageCount":1,"participants":["Martin Langhoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7349","messageId":"20050816053929.A97DD3300AD@ng.eduforge.org","threadId":"1532","inReplyTo":null,"subject":"[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised","fromName":"Martin Langhoff","fromEmail":"martin@ng.eduforge.org","sentAt":"2005-08-16T05:39:29Z","receivedAt":"2005-08-16T05:39:29Z","isPatch":true,"sender":{"key":"martin@ng.eduforge.org","avatar":null},"body":"[PATCH] Add -k kill keyword expansion option to git-cvsimport - revised\n\nEarly versions of git-cvsimport defaulted to using preexisting keyword\nexpansion settings. This change preserves compatibility with existing cvs\nimports and allows new repository migrations to kill keyword expansion.\n\nAfter exploration of the different -k modes in the cvs protocol, we use -kk\nwhich kills keyword expansion wherever possible. Against the protocol\nspec, -ko and -kb will sometimes expand keywords.\n\nShould improve our chances of detecting merges and reduce imported\nrepository size.\n\nSigned-off: Martin Langhoff <martin.langhoff@gmail.com>\n---\n\n Documentation/git-cvsimport-script.txt |    7 ++++++-\n git-cvsimport-script                   |   12 +++++++-----\n 2 files changed, 13 insertions(+), 6 deletions(-)\n\n3be96ff6fee32974b66fe1743eb701e93032fee5\ndiff --git a/Documentation/git-cvsimport-script.txt b/Documentation/git-cvsimport-script.txt\n--- a/Documentation/git-cvsimport-script.txt\n+++ b/Documentation/git-cvsimport-script.txt\n@@ -11,7 +11,7 @@ SYNOPSIS\n --------\n 'git-cvsimport-script' [ -o <branch-for-HEAD> ] [ -h ] [ -v ]\n \t\t\t[ -d <CVSROOT> ] [ -p <options-for-cvsps> ]\n-\t\t\t[ -C <GIT_repository> ] [ -i ] [ <CVS_module> ]\n+\t\t\t[ -C <GIT_repository> ] [ -i ] [ -k ] [ <CVS_module> ]\n \n \n DESCRIPTION\n@@ -38,6 +38,11 @@ OPTIONS\n \tensures the working directory and cache remain untouched and will\n \tnot create them if they do not exist.\n \n+-k::\n+\tKill keywords: will extract files with -kk from the CVS archive\n+\tto avoid noisy changesets. Highly recommended, but off by default\n+\tto preserve compatibility with early imported trees. \n+\n -o <branch-for-HEAD>::\n \tThe 'HEAD' branch from CVS is imported to the 'origin' branch within\n \tthe git repository, as 'HEAD' already has a special meaning for git.\ndiff --git a/git-cvsimport-script b/git-cvsimport-script\n--- a/git-cvsimport-script\n+++ b/git-cvsimport-script\n@@ -28,19 +28,19 @@ use POSIX qw(strftime dup2);\n $SIG{'PIPE'}=\"IGNORE\";\n $ENV{'TZ'}=\"UTC\";\n \n-our($opt_h,$opt_o,$opt_v,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);\n+our($opt_h,$opt_o,$opt_v,$opt_k,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i);\n \n sub usage() {\n \tprint STDERR <<END;\n Usage: ${\\basename $0}     # fetch/update GIT from CVS\n        [ -o branch-for-HEAD ] [ -h ] [ -v ] [ -d CVSROOT ]\n        [ -p opts-for-cvsps ] [ -C GIT_repository ] [ -z fuzz ]\n-       [ -i ] [ CVS_module ]\n+       [ -i ] [ -k ] [ CVS_module ]\n END\n \texit(1);\n }\n \n-getopts(\"hivo:d:p:C:z:\") or usage();\n+getopts(\"hivko:d:p:C:z:\") or usage();\n usage if $opt_h;\n \n @ARGV <= 1 or usage();\n@@ -218,8 +218,10 @@ sub _file {\n \tmy($self,$fn,$rev) = @_;\n \t$self->{'socketo'}->write(\"Argument -N\\n\") or return undef;\n \t$self->{'socketo'}->write(\"Argument -P\\n\") or return undef;\n-\t# $self->{'socketo'}->write(\"Argument -ko\\n\") or return undef;\n-\t# -ko: Linus' version doesn't use it\n+\t# -kk: Linus' version doesn't use it - defaults to off\n+\tif ($opt_k) {\n+\t    $self->{'socketo'}->write(\"Argument -kk\\n\") or return undef;\n+\t}\n \t$self->{'socketo'}->write(\"Argument -r\\n\") or return undef;\n \t$self->{'socketo'}->write(\"Argument $rev\\n\") or return undef;\n \t$self->{'socketo'}->write(\"Argument --\\n\") or return undef;\n"}]}