[PATCH] git-cvsimport-script: add "import only" option

git-cvsimport-script: add "import only" option which tells the script
not to perform a checkout after importing.

This ensures that the working directory and cache remain untouched and
will not create them if they do not exist.

Acked-by: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Sven Verdoolaege
2005-07-11 16:57:49 +02:00
committed by Linus Torvalds
parent 9c1fa70aaa
commit c1c774e796
2 changed files with 17 additions and 8 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> ] [ <CVS_module> ] [ -C <GIT_repository> ] [ -i ] [ <CVS_module> ]
DESCRIPTION DESCRIPTION
@ -29,6 +29,11 @@ OPTIONS
currently, only the :local:, :ext: and :pserver: access methods currently, only the :local:, :ext: and :pserver: access methods
are supported. are supported.
-i::
Import-only: don't perform a checkout after importing. This option
ensures the working directory and cache remain untouched and will
not create them if they do not exist.
-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); our($opt_h,$opt_o,$opt_v,$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 ]
[ CVS_module ] [ -i ] [ CVS_module ]
END END
exit(1); exit(1);
} }
getopts("hvo:d:p:C:z:") or usage(); getopts("hivo:d:p:C:z:") or usage();
usage if $opt_h; usage if $opt_h;
@ARGV <= 1 or usage(); @ARGV <= 1 or usage();
@ -723,8 +723,10 @@ if($orig_branch) {
print "DONE\n" if $opt_v; print "DONE\n" if $opt_v;
system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master") system("cp","$git_dir/refs/heads/$opt_o","$git_dir/refs/heads/master")
if $forward_master; if $forward_master;
system('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD'); unless ($opt_i) {
die "read-tree failed: $?\n" if $?; system('git-read-tree', '-m', '-u', 'CVS2GIT_HEAD', 'HEAD');
die "read-tree failed: $?\n" if $?;
}
} else { } else {
$orig_branch = "master"; $orig_branch = "master";
print "DONE; creating $orig_branch branch\n" if $opt_v; print "DONE; creating $orig_branch branch\n" if $opt_v;
@ -732,7 +734,9 @@ if($orig_branch) {
unless -f "$git_dir/refs/heads/master"; unless -f "$git_dir/refs/heads/master";
unlink("$git_dir/HEAD"); unlink("$git_dir/HEAD");
symlink("refs/heads/$orig_branch","$git_dir/HEAD"); symlink("refs/heads/$orig_branch","$git_dir/HEAD");
system('git checkout'); unless ($opt_i) {
die "checkout failed: $?\n" if $?; system('git checkout');
die "checkout failed: $?\n" if $?;
}
} }
unlink("$git_dir/CVS2GIT_HEAD"); unlink("$git_dir/CVS2GIT_HEAD");