mirror of
https://github.com/git/git.git
synced 2024-05-12 04:46:08 +02:00
cvsexportcommit: Add switch to specify CVS workdir
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
3e4bb087a1
commit
648ee55009
|
@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
|
'git-cvsexportcommit' [-h] [-u] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-w cvsworkdir] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
@ -16,8 +16,9 @@ DESCRIPTION
|
||||||
Exports a commit from GIT to a CVS checkout, making it easier
|
Exports a commit from GIT to a CVS checkout, making it easier
|
||||||
to merge patches from a git repository into a CVS repository.
|
to merge patches from a git repository into a CVS repository.
|
||||||
|
|
||||||
Execute it from the root of the CVS working copy. GIT_DIR must be defined.
|
Specify the name of a CVS checkout using the -w switch or execute it
|
||||||
See examples below.
|
from the root of the CVS working copy. In the latter case GIT_DIR must
|
||||||
|
be defined. See examples below.
|
||||||
|
|
||||||
It does its best to do the safe thing, it will check that the files are
|
It does its best to do the safe thing, it will check that the files are
|
||||||
unchanged and up to date in the CVS checkout, and it will not autocommit
|
unchanged and up to date in the CVS checkout, and it will not autocommit
|
||||||
|
@ -61,6 +62,11 @@ OPTIONS
|
||||||
-u::
|
-u::
|
||||||
Update affected files from CVS repository before attempting export.
|
Update affected files from CVS repository before attempting export.
|
||||||
|
|
||||||
|
-w::
|
||||||
|
Specify the location of the CVS checkout to use for the export. This
|
||||||
|
option does not require GIT_DIR to be set before execution if the
|
||||||
|
current directory is within a git repository.
|
||||||
|
|
||||||
-v::
|
-v::
|
||||||
Verbose.
|
Verbose.
|
||||||
|
|
||||||
|
@ -76,6 +82,12 @@ $ git-cvsexportcommit -v <commit-sha1>
|
||||||
$ cvs commit -F .msg <files>
|
$ cvs commit -F .msg <files>
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
Merge one patch into CVS (-c and -w options). The working directory is within the Git Repo::
|
||||||
|
+
|
||||||
|
------------
|
||||||
|
$ git-cvsexportcommit -v -c -w ~/project_cvs_checkout <commit-sha1>
|
||||||
|
------------
|
||||||
|
|
||||||
Merge pending patches into CVS automatically -- only if you really know what you are doing::
|
Merge pending patches into CVS automatically -- only if you really know what you are doing::
|
||||||
+
|
+
|
||||||
------------
|
------------
|
||||||
|
@ -86,11 +98,11 @@ $ git-cherry cvshead myhead | sed -n 's/^+ //p' | xargs -l1 git-cvsexportcommit
|
||||||
|
|
||||||
Author
|
Author
|
||||||
------
|
------
|
||||||
Written by Martin Langhoff <martin@catalyst.net.nz>
|
Written by Martin Langhoff <martin@catalyst.net.nz> and others.
|
||||||
|
|
||||||
Documentation
|
Documentation
|
||||||
--------------
|
--------------
|
||||||
Documentation by Martin Langhoff <martin@catalyst.net.nz>
|
Documentation by Martin Langhoff <martin@catalyst.net.nz> and others.
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,28 +1,42 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
# Known limitations:
|
|
||||||
# - does not propagate permissions
|
|
||||||
# - error handling has not been extensively tested
|
|
||||||
#
|
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
use File::Temp qw(tempdir);
|
use File::Temp qw(tempdir);
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use File::Basename qw(basename dirname);
|
use File::Basename qw(basename dirname);
|
||||||
|
|
||||||
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
|
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u, $opt_w);
|
||||||
die "GIT_DIR is not defined or is unreadable";
|
|
||||||
}
|
|
||||||
|
|
||||||
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u);
|
getopts('uhPpvcfam:d:w:');
|
||||||
|
|
||||||
getopts('uhPpvcfam:d:');
|
|
||||||
|
|
||||||
$opt_h && usage();
|
$opt_h && usage();
|
||||||
|
|
||||||
die "Need at least one commit identifier!" unless @ARGV;
|
die "Need at least one commit identifier!" unless @ARGV;
|
||||||
|
|
||||||
|
if ($opt_w) {
|
||||||
|
unless ($ENV{GIT_DIR}) {
|
||||||
|
# Remember where our GIT_DIR is before changing to CVS checkout
|
||||||
|
my $gd =`git-rev-parse --git-dir`;
|
||||||
|
chomp($gd);
|
||||||
|
if ($gd eq '.git') {
|
||||||
|
my $wd = `pwd`;
|
||||||
|
chomp($wd);
|
||||||
|
$gd = $wd."/.git" ;
|
||||||
|
}
|
||||||
|
$ENV{GIT_DIR} = $gd;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! -d $opt_w."/CVS" ) {
|
||||||
|
die "$opt_w is not a CVS checkout";
|
||||||
|
}
|
||||||
|
chdir $opt_w or die "Cannot change to CVS checkout at $opt_w";
|
||||||
|
}
|
||||||
|
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
|
||||||
|
die "GIT_DIR is not defined or is unreadable";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
my @cvs;
|
my @cvs;
|
||||||
if ($opt_d) {
|
if ($opt_d) {
|
||||||
@cvs = ('cvs', '-d', $opt_d);
|
@cvs = ('cvs', '-d', $opt_d);
|
||||||
|
@ -274,6 +288,7 @@
|
||||||
print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
|
print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
|
||||||
print "using a patch program. After applying the patch and resolving the\n";
|
print "using a patch program. After applying the patch and resolving the\n";
|
||||||
print "problems you may commit using:";
|
print "problems you may commit using:";
|
||||||
|
print "\n cd \"$opt_w\"" if $opt_w;
|
||||||
print "\n $cmd\n\n";
|
print "\n $cmd\n\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -301,7 +316,7 @@
|
||||||
|
|
||||||
sub usage {
|
sub usage {
|
||||||
print STDERR <<END;
|
print STDERR <<END;
|
||||||
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-m msgprefix] [ parent ] commit
|
Usage: GIT_DIR=/path/to/.git ${\basename $0} [-h] [-p] [-v] [-c] [-f] [-u] [-w cvsworkdir] [-m msgprefix] [ parent ] commit
|
||||||
END
|
END
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue