* [PATCH] Allow passing of an alternative CVSROOT via -d.
@ 2007-02-18 17:17 Simon 'corecode' Schubert
2007-02-18 17:35 ` Johannes Schindelin
2007-02-19 5:25 ` Martin Langhoff
0 siblings, 2 replies; 6+ messages in thread
From: Simon 'corecode' Schubert @ 2007-02-18 17:17 UTC (permalink / raw)
To: git; +Cc: Martin Langhoff
[-- Attachment #1: Type: text/plain, Size: 4747 bytes --]
This is necessary if using CVS in an asymmetric fashion, i.e. when the
CVSROOT you are checking out from differs from the CVSROOT you have to
commit to.
Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>
---
Documentation/git-cvsexportcommit.txt | 7 ++++++-
git-cvsexportcommit.perl | 27 +++++++++++++++++----------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt
index 27d531b..555b823 100644
--- a/Documentation/git-cvsexportcommit.txt
+++ b/Documentation/git-cvsexportcommit.txt
@@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout
SYNOPSIS
--------
-'git-cvsexportcommit' [-h] [-v] [-c] [-P] [-p] [-a] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
+'git-cvsexportcommit' [-h] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
DESCRIPTION
@@ -43,6 +43,11 @@ OPTIONS
Add authorship information. Adds Author line, and Committer (if
different from Author) to the message.
+-d::
+ Set an alternative CVSROOT to use. This corresponds to the CVS
+ -d parameter. Usually users will not want to set this, except
+ if using CVS in an asymmetric fashion.
+
-f::
Force the merge even if the files are not up to date.
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 870554e..d08216c 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -15,14 +15,21 @@ unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
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 );
+our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d);
-getopts('hPpvcfam:');
+getopts('hPpvcfam:d:');
$opt_h && usage();
die "Need at least one commit identifier!" unless @ARGV;
+my @cvs;
+if ($opt_d) {
+ @cvs = ('cvs', '-d', $opt_d);
+} else {
+ @cvs = ('cvs');
+}
+
# setup a tempdir
our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX',
TMPDIR => 1,
@@ -160,7 +167,7 @@ foreach my $f (@afiles) {
my $p = $1;
next if (grep { $_ eq $p } @dirs);
}
- my @status = grep(m/^File/, safe_pipe_capture('cvs', '-q', 'status' ,$f));
+ my @status = grep(m/^File/, safe_pipe_capture(@cvs, '-q', 'status' ,$f));
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
if (-d dirname $f and $status[0] !~ m/Status: Unknown$/
and $status[0] !~ m/^File: no file /) {
@@ -173,7 +180,7 @@ foreach my $f (@afiles) {
foreach my $f (@files) {
next if grep { $_ eq $f } @afiles;
# TODO:we need to handle removed in cvs
- my @status = grep(m/^File/, safe_pipe_capture('cvs', '-q', 'status' ,$f));
+ my @status = grep(m/^File/, safe_pipe_capture(@cvs, '-q', 'status' ,$f));
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
unless ($status[0] =~ m/Status: Up-to-date$/) {
$dirty = 1;
@@ -194,7 +201,7 @@ print "Applying\n";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;
foreach my $d (@dirs) {
- if (system('cvs','add',$d)) {
+ if (system(@cvs,'add',$d)) {
$dirtypatch = 1;
warn "Failed to cvs add directory $d -- you may need to do it manually";
}
@@ -202,9 +209,9 @@ foreach my $d (@dirs) {
foreach my $f (@afiles) {
if (grep { $_ eq $f } @bfiles) {
- system('cvs', 'add','-kb',$f);
+ system(@cvs, 'add','-kb',$f);
} else {
- system('cvs', 'add', $f);
+ system(@cvs, 'add', $f);
}
if ($?) {
$dirtypatch = 1;
@@ -213,7 +220,7 @@ foreach my $f (@afiles) {
}
foreach my $f (@dfiles) {
- system('cvs', 'rm', '-f', $f);
+ system(@cvs, 'rm', '-f', $f);
if ($?) {
$dirtypatch = 1;
warn "Failed to cvs rm -f $f -- you may need to do it manually";
@@ -223,7 +230,7 @@ foreach my $f (@dfiles) {
print "Commit to CVS\n";
print "Patch title (first comment line): $title\n";
my @commitfiles = map { unless (m/\s/) { '\''.$_.'\''; } else { $_; }; } (@files);
-my $cmd = "cvs commit -F .msg @commitfiles";
+my $cmd = join(' ', @cvs)." commit -F .msg @commitfiles";
if ($dirtypatch) {
print "NOTE: One or more hunks failed to apply cleanly.\n";
@@ -236,7 +243,7 @@ if ($dirtypatch) {
if ($opt_c) {
print "Autocommit\n $cmd\n";
- print safe_pipe_capture('cvs', 'commit', '-F', '.msg', @files);
+ print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
if ($?) {
die "Exiting: The commit did not succeed";
}
--
1.5.0.50.gb75812-dirty
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] Allow passing of an alternative CVSROOT via -d.
2007-02-18 17:17 [PATCH] Allow passing of an alternative CVSROOT via -d Simon 'corecode' Schubert
@ 2007-02-18 17:35 ` Johannes Schindelin
2007-02-18 17:53 ` Simon 'corecode' Schubert
2007-02-19 5:25 ` Martin Langhoff
1 sibling, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-02-18 17:35 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git, Martin Langhoff
Hi,
On Sun, 18 Feb 2007, Simon 'corecode' Schubert wrote:
> This is necessary if using CVS in an asymmetric fashion, i.e. when the
> CVSROOT you are checking out from differs from the CVSROOT you have to
> commit to.
Does
CVSROOT=bla git-cvsexportcommit...
not work?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Allow passing of an alternative CVSROOT via -d.
2007-02-18 17:35 ` Johannes Schindelin
@ 2007-02-18 17:53 ` Simon 'corecode' Schubert
0 siblings, 0 replies; 6+ messages in thread
From: Simon 'corecode' Schubert @ 2007-02-18 17:53 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Martin Langhoff
[-- Attachment #1: Type: text/plain, Size: 702 bytes --]
Johannes Schindelin wrote:
>> This is necessary if using CVS in an asymmetric fashion, i.e. when the
>> CVSROOT you are checking out from differs from the CVSROOT you have to
>> commit to.
>
> Does
>
> CVSROOT=bla git-cvsexportcommit...
>
> not work?
no, cvs seems to ignore the environment variable. at least export CVSROOT=host:/dir didn't have any effect.
cheers
simon
--
Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\
Work - Mac +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Allow passing of an alternative CVSROOT via -d.
2007-02-18 17:17 [PATCH] Allow passing of an alternative CVSROOT via -d Simon 'corecode' Schubert
2007-02-18 17:35 ` Johannes Schindelin
@ 2007-02-19 5:25 ` Martin Langhoff
2007-02-19 11:10 ` Johannes Schindelin
1 sibling, 1 reply; 6+ messages in thread
From: Martin Langhoff @ 2007-02-19 5:25 UTC (permalink / raw)
To: Simon 'corecode' Schubert; +Cc: git
Simon 'corecode' Schubert wrote:
> This is necessary if using CVS in an asymmetric fashion, i.e. when the
> CVSROOT you are checking out from differs from the CVSROOT you have to
> commit to.
I guess you have an anon checkout and then use CVSROOT at commit time to
switch to cvs-over-ssh perhaps even on a different server. In-te-rest-ing.
I've never in my life used cvs this way -- or thought something like
this would work. But if it works for you, I can only ACK it ;-)
is "Assymmetric CVS" a known term for this practice? If not, it might be
useful to flesh out what this is for in the docs.
m
--
-----------------------------------------------------------------------
Martin @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
OFFICE: +64(4)916-7224 UK: 0845 868 5733 ext 7224 MOB: +64(21)364-017
Make things as simple as possible, but no simpler - Einstein
-----------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Allow passing of an alternative CVSROOT via -d.
2007-02-19 5:25 ` Martin Langhoff
@ 2007-02-19 11:10 ` Johannes Schindelin
2007-02-19 11:54 ` Simon 'corecode' Schubert
0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-02-19 11:10 UTC (permalink / raw)
To: Martin Langhoff; +Cc: Simon 'corecode' Schubert, git
Hi,
On Mon, 19 Feb 2007, Martin Langhoff wrote:
> Simon 'corecode' Schubert wrote:
> > This is necessary if using CVS in an asymmetric fashion, i.e. when the
> > CVSROOT you are checking out from differs from the CVSROOT you have to
> > commit to.
>
> I guess you have an anon checkout and then use CVSROOT at commit time to
> switch to cvs-over-ssh perhaps even on a different server.
> In-te-rest-ing.
It was kind of common operation when SourceForge had immense problems with
SSH checkout, but the anonymous services were up-and-running.
I am still worried why "CVSROOT=bla git cvsexportcommit ..." does not run
as expected, though.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Allow passing of an alternative CVSROOT via -d.
2007-02-19 11:10 ` Johannes Schindelin
@ 2007-02-19 11:54 ` Simon 'corecode' Schubert
0 siblings, 0 replies; 6+ messages in thread
From: Simon 'corecode' Schubert @ 2007-02-19 11:54 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Martin Langhoff, git
[-- Attachment #1: Type: text/plain, Size: 3165 bytes --]
Johannes Schindelin wrote:
> On Mon, 19 Feb 2007, Martin Langhoff wrote:
>>> This is necessary if using CVS in an asymmetric fashion, i.e. when the
>>> CVSROOT you are checking out from differs from the CVSROOT you have to
>>> commit to.
>> I guess you have an anon checkout and then use CVSROOT at commit time to
>> switch to cvs-over-ssh perhaps even on a different server.
>> In-te-rest-ing.
> It was kind of common operation when SourceForge had immense problems with
> SSH checkout, but the anonymous services were up-and-running.
Large projects like *BSD are using cvsup to distribute the repos, and you checkout from a local copy then. To commmit, you obviously have to use the master cvs server, though.
> I am still worried why "CVSROOT=bla git cvsexportcommit ..." does not run
> as expected, though.
sweatshorts % cvs status Makefile.inc1 /usr/src|12:48:57
===================================================================
File: Makefile.inc1 Status: Up-to-date
Working revision: 1.101 2007-01-19 08:51:44 +0100
Repository revision: 1.101 /home/dcvs/src/Makefile.inc1,v
Commit Identifier: 9177lVhuKoFNs53s
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
sweatshorts % CVSROOT=crater:/cvs cvs status Makefile.inc1 /usr/src|12:49:03
===================================================================
File: Makefile.inc1 Status: Up-to-date
Working revision: 1.101 2007-01-19 08:51:44 +0100
Repository revision: 1.101 /home/dcvs/src/Makefile.inc1,v
Commit Identifier: 9177lVhuKoFNs53s
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
sweatshorts % cvs -d crater:/cvs status Makefile.inc1 /usr/src|12:49:09
===================================================================
File: Makefile.inc1 Status: Needs Patch
Working revision: 1.101
Repository revision: 1.102 /cvs/src/Makefile.inc1,v
Commit Identifier: zV7uPbXLmK5jW17s
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
sweatshorts % rm CVS/Root /usr/src|12:52:44
sweatshorts % CVSROOT=crater:/cvs cvs status Makefile.inc1 /usr/src|12:52:48
===================================================================
File: Makefile.inc1 Status: Needs Patch
Working revision: 1.101
Repository revision: 1.102 /cvs/src/Makefile.inc1,v
Commit Identifier: zV7uPbXLmK5jW17s
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
so that only works when there is no CVS/Root file.
cheers
simon
--
Serve - BSD +++ RENT this banner advert +++ ASCII Ribbon /"\
Work - Mac +++ space for low €€€ NOW!1 +++ Campaign \ /
Party Enjoy Relax | http://dragonflybsd.org Against HTML \
Dude 2c 2 the max ! http://golden-apple.biz Mail + News / \
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-02-19 11:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-18 17:17 [PATCH] Allow passing of an alternative CVSROOT via -d Simon 'corecode' Schubert
2007-02-18 17:35 ` Johannes Schindelin
2007-02-18 17:53 ` Simon 'corecode' Schubert
2007-02-19 5:25 ` Martin Langhoff
2007-02-19 11:10 ` Johannes Schindelin
2007-02-19 11:54 ` Simon 'corecode' Schubert
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.