{"thread":{"id":"6869","subject":"[PATCH] Allow passing of an alternative CVSROOT via -d.","startedAt":"2007-02-18T17:17:08Z","lastAt":"2007-02-19T11:54:12Z","messageCount":6,"participants":["Simon 'corecode' Schubert","Johannes Schindelin","Martin Langhoff"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"34959","messageId":"45D88A14.4040400@fs.ei.tum.de","threadId":"6869","inReplyTo":null,"subject":"[PATCH] Allow passing of an alternative CVSROOT via -d.","fromName":"Simon 'corecode' Schubert","fromEmail":"corecode@fs.ei.tum.de","sentAt":"2007-02-18T17:17:08Z","receivedAt":"2007-02-18T17:17:08Z","isPatch":true,"sender":{"key":"corecode@fs.ei.tum.de","avatar":"https://gravatar.com/avatar/eff9dbf0cdac0d1e6a6cd7ed0e50763edcb376b493b5253a35ff167918ad79e1?d=mp&s=160"},"body":"This is necessary if using CVS in an asymmetric fashion, i.e. when the\nCVSROOT you are checking out from differs from the CVSROOT you have to\ncommit to.\n\nSigned-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de>\n---\n Documentation/git-cvsexportcommit.txt |    7 ++++++-\n git-cvsexportcommit.perl              |   27 +++++++++++++++++----------\n 2 files changed, 23 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-cvsexportcommit.txt b/Documentation/git-cvsexportcommit.txt\nindex 27d531b..555b823 100644\n--- a/Documentation/git-cvsexportcommit.txt\n+++ b/Documentation/git-cvsexportcommit.txt\n@@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout\n \n SYNOPSIS\n --------\n-'git-cvsexportcommit' [-h] [-v] [-c] [-P] [-p] [-a] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID\n+'git-cvsexportcommit' [-h] [-v] [-c] [-P] [-p] [-a] [-d cvsroot] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID\n \n \n DESCRIPTION\n@@ -43,6 +43,11 @@ OPTIONS\n \tAdd authorship information. Adds Author line, and Committer (if\n \tdifferent from Author) to the message.\n \n+-d::\n+\tSet an alternative CVSROOT to use.  This corresponds to the CVS\n+\t-d parameter.  Usually users will not want to set this, except\n+\tif using CVS in an asymmetric fashion.\n+\n -f::\n \tForce the merge even if the files are not up to date.\n \ndiff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl\nindex 870554e..d08216c 100755\n--- a/git-cvsexportcommit.perl\n+++ b/git-cvsexportcommit.perl\n@@ -15,14 +15,21 @@ unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){\n     die \"GIT_DIR is not defined or is unreadable\";\n }\n \n-our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m );\n+our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d);\n \n-getopts('hPpvcfam:');\n+getopts('hPpvcfam:d:');\n \n $opt_h && usage();\n \n die \"Need at least one commit identifier!\" unless @ARGV;\n \n+my @cvs;\n+if ($opt_d) {\n+\t@cvs = ('cvs', '-d', $opt_d);\n+} else {\n+\t@cvs = ('cvs');\n+}\n+\n # setup a tempdir\n our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX',\n \t\t\t\t     TMPDIR => 1,\n@@ -160,7 +167,7 @@ foreach my $f (@afiles) {\n \tmy $p = $1;\n \tnext if (grep { $_ eq $p } @dirs);\n     }\n-    my @status = grep(m/^File/,  safe_pipe_capture('cvs', '-q', 'status' ,$f));\n+    my @status = grep(m/^File/,  safe_pipe_capture(@cvs, '-q', 'status' ,$f));\n     if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};\n     if (-d dirname $f and $status[0] !~ m/Status: Unknown$/\n \tand $status[0] !~ m/^File: no file /) {\n@@ -173,7 +180,7 @@ foreach my $f (@afiles) {\n foreach my $f (@files) {\n     next if grep { $_ eq $f } @afiles;\n     # TODO:we need to handle removed in cvs\n-    my @status = grep(m/^File/,  safe_pipe_capture('cvs', '-q', 'status' ,$f));\n+    my @status = grep(m/^File/,  safe_pipe_capture(@cvs, '-q', 'status' ,$f));\n     if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};\n     unless ($status[0] =~ m/Status: Up-to-date$/) {\n \t$dirty = 1;\n@@ -194,7 +201,7 @@ print \"Applying\\n\";\n print \"Patch applied successfully. Adding new files and directories to CVS\\n\";\n my $dirtypatch = 0;\n foreach my $d (@dirs) {\n-    if (system('cvs','add',$d)) {\n+    if (system(@cvs,'add',$d)) {\n \t$dirtypatch = 1;\n \twarn \"Failed to cvs add directory $d -- you may need to do it manually\";\n     }\n@@ -202,9 +209,9 @@ foreach my $d (@dirs) {\n \n foreach my $f (@afiles) {\n     if (grep { $_ eq $f } @bfiles) {\n-      system('cvs', 'add','-kb',$f);\n+      system(@cvs, 'add','-kb',$f);\n     } else {\n-      system('cvs', 'add', $f);\n+      system(@cvs, 'add', $f);\n     }\n     if ($?) {\n \t$dirtypatch = 1;\n@@ -213,7 +220,7 @@ foreach my $f (@afiles) {\n }\n \n foreach my $f (@dfiles) {\n-    system('cvs', 'rm', '-f', $f);\n+    system(@cvs, 'rm', '-f', $f);\n     if ($?) {\n \t$dirtypatch = 1;\n \twarn \"Failed to cvs rm -f $f -- you may need to do it manually\";\n@@ -223,7 +230,7 @@ foreach my $f (@dfiles) {\n print \"Commit to CVS\\n\";\n print \"Patch title (first comment line): $title\\n\";\n my @commitfiles = map { unless (m/\\s/) { '\\''.$_.'\\''; } else { $_; }; } (@files);\n-my $cmd = \"cvs commit -F .msg @commitfiles\";\n+my $cmd = join(' ', @cvs).\" commit -F .msg @commitfiles\";\n \n if ($dirtypatch) {\n     print \"NOTE: One or more hunks failed to apply cleanly.\\n\";\n@@ -236,7 +243,7 @@ if ($dirtypatch) {\n \n if ($opt_c) {\n     print \"Autocommit\\n  $cmd\\n\";\n-    print safe_pipe_capture('cvs', 'commit', '-F', '.msg', @files);\n+    print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);\n     if ($?) {\n \tdie \"Exiting: The commit did not succeed\";\n     }\n-- \n1.5.0.50.gb75812-dirty\n\n\n"},{"id":"34961","messageId":"Pine.LNX.4.63.0702181834340.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6869","inReplyTo":"45D88A14.4040400@fs.ei.tum.de","subject":"Re: [PATCH] Allow passing of an alternative CVSROOT via -d.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-18T17:35:43Z","receivedAt":"2007-02-18T17:35:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 18 Feb 2007, Simon 'corecode' Schubert wrote:\n\n> This is necessary if using CVS in an asymmetric fashion, i.e. when the\n> CVSROOT you are checking out from differs from the CVSROOT you have to\n> commit to.\n\nDoes\n\n\tCVSROOT=bla git-cvsexportcommit...\n\nnot work?\n\nCiao,\nDscho\n"},{"id":"34962","messageId":"45D892B4.4000005@fs.ei.tum.de","threadId":"6869","inReplyTo":"Pine.LNX.4.63.0702181834340.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Allow passing of an alternative CVSROOT via -d.","fromName":"Simon 'corecode' Schubert","fromEmail":"corecode@fs.ei.tum.de","sentAt":"2007-02-18T17:53:56Z","receivedAt":"2007-02-18T17:53:56Z","isPatch":true,"sender":{"key":"corecode@fs.ei.tum.de","avatar":"https://gravatar.com/avatar/eff9dbf0cdac0d1e6a6cd7ed0e50763edcb376b493b5253a35ff167918ad79e1?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n>> This is necessary if using CVS in an asymmetric fashion, i.e. when the\n>> CVSROOT you are checking out from differs from the CVSROOT you have to\n>> commit to.\n> \n> Does\n> \n> \tCVSROOT=bla git-cvsexportcommit...\n> \n> not work?\n\nno, cvs seems to ignore the environment variable.  at least export CVSROOT=host:/dir didn't have any effect.\n\ncheers\n  simon\n\n-- \nServe - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /\"\\\nWork - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \\ /\nParty Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \\\nDude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \\\n\n"},{"id":"34978","messageId":"45D934CC.6080707@catalyst.net.nz","threadId":"6869","inReplyTo":"45D88A14.4040400@fs.ei.tum.de","subject":"Re: [PATCH] Allow passing of an alternative CVSROOT via -d.","fromName":"Martin Langhoff","fromEmail":"martin@catalyst.net.nz","sentAt":"2007-02-19T05:25:32Z","receivedAt":"2007-02-19T05:25:32Z","isPatch":true,"sender":{"key":"martin@laptop.org","avatar":null},"body":"Simon 'corecode' Schubert wrote:\n> This is necessary if using CVS in an asymmetric fashion, i.e. when the\n> CVSROOT you are checking out from differs from the CVSROOT you have to\n> commit to.\n\nI guess you have an anon checkout and then use CVSROOT at commit time to\nswitch to cvs-over-ssh perhaps even on a different server. In-te-rest-ing.\n\nI've never in my life used cvs this way -- or thought something like\nthis would work. But if it works for you, I can only ACK it ;-)\n\nis \"Assymmetric CVS\" a known term for this practice? If not, it might be\nuseful to flesh out what this is for in the docs.\n\n\n\nm\n-- \n-----------------------------------------------------------------------\nMartin @ Catalyst .Net .NZ  Ltd, PO Box 11-053, Manners St,  Wellington\nWEB: http://catalyst.net.nz/           PHYS: Level 2, 150-154 Willis St\nOFFICE: +64(4)916-7224  UK: 0845 868 5733 ext 7224  MOB: +64(21)364-017\n      Make things as simple as possible, but no simpler - Einstein\n-----------------------------------------------------------------------\n"},{"id":"35001","messageId":"Pine.LNX.4.63.0702191209200.22628@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"6869","inReplyTo":"45D934CC.6080707@catalyst.net.nz","subject":"Re: [PATCH] Allow passing of an alternative CVSROOT via -d.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-02-19T11:10:34Z","receivedAt":"2007-02-19T11:10:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 19 Feb 2007, Martin Langhoff wrote:\n\n> Simon 'corecode' Schubert wrote:\n> > This is necessary if using CVS in an asymmetric fashion, i.e. when the \n> > CVSROOT you are checking out from differs from the CVSROOT you have to \n> > commit to.\n> \n> I guess you have an anon checkout and then use CVSROOT at commit time to \n> switch to cvs-over-ssh perhaps even on a different server. \n> In-te-rest-ing.\n\nIt was kind of common operation when SourceForge had immense problems with \nSSH checkout, but the anonymous services were up-and-running.\n\nI am still worried why \"CVSROOT=bla git cvsexportcommit ...\" does not run \nas expected, though.\n\nCiao,\nDscho\n"},{"id":"35002","messageId":"45D98FE4.3060906@fs.ei.tum.de","threadId":"6869","inReplyTo":"Pine.LNX.4.63.0702191209200.22628@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Allow passing of an alternative CVSROOT via -d.","fromName":"Simon 'corecode' Schubert","fromEmail":"corecode@fs.ei.tum.de","sentAt":"2007-02-19T11:54:12Z","receivedAt":"2007-02-19T11:54:12Z","isPatch":true,"sender":{"key":"corecode@fs.ei.tum.de","avatar":"https://gravatar.com/avatar/eff9dbf0cdac0d1e6a6cd7ed0e50763edcb376b493b5253a35ff167918ad79e1?d=mp&s=160"},"body":"Johannes Schindelin wrote:\n> On Mon, 19 Feb 2007, Martin Langhoff wrote:\n>>> This is necessary if using CVS in an asymmetric fashion, i.e. when the \n>>> CVSROOT you are checking out from differs from the CVSROOT you have to \n>>> commit to.\n>> I guess you have an anon checkout and then use CVSROOT at commit time to \n>> switch to cvs-over-ssh perhaps even on a different server. \n>> In-te-rest-ing.\n> It was kind of common operation when SourceForge had immense problems with \n> SSH checkout, but the anonymous services were up-and-running.\n\nLarge 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.\n\n> I am still worried why \"CVSROOT=bla git cvsexportcommit ...\" does not run \n> as expected, though.\n\nsweatshorts % cvs status Makefile.inc1                                            /usr/src|12:48:57\n===================================================================\nFile: Makefile.inc1     Status: Up-to-date\n\n   Working revision:    1.101   2007-01-19 08:51:44 +0100\n   Repository revision: 1.101   /home/dcvs/src/Makefile.inc1,v\n   Commit Identifier:   9177lVhuKoFNs53s\n   Sticky Tag:          (none)\n   Sticky Date:         (none)\n   Sticky Options:      (none)\n\nsweatshorts % CVSROOT=crater:/cvs cvs status Makefile.inc1                        /usr/src|12:49:03\n===================================================================\nFile: Makefile.inc1     Status: Up-to-date\n\n   Working revision:    1.101   2007-01-19 08:51:44 +0100\n   Repository revision: 1.101   /home/dcvs/src/Makefile.inc1,v\n   Commit Identifier:   9177lVhuKoFNs53s\n   Sticky Tag:          (none)\n   Sticky Date:         (none)\n   Sticky Options:      (none)\n\nsweatshorts % cvs -d crater:/cvs status Makefile.inc1                             /usr/src|12:49:09\n===================================================================\nFile: Makefile.inc1     Status: Needs Patch\n\n   Working revision:    1.101\n   Repository revision: 1.102   /cvs/src/Makefile.inc1,v\n   Commit Identifier:   zV7uPbXLmK5jW17s\n   Sticky Tag:          (none)\n   Sticky Date:         (none)\n   Sticky Options:      (none)\n\nsweatshorts % rm CVS/Root                                                         /usr/src|12:52:44\nsweatshorts % CVSROOT=crater:/cvs cvs status Makefile.inc1                        /usr/src|12:52:48\n===================================================================\nFile: Makefile.inc1     Status: Needs Patch\n\n   Working revision:    1.101\n   Repository revision: 1.102   /cvs/src/Makefile.inc1,v\n   Commit Identifier:   zV7uPbXLmK5jW17s\n   Sticky Tag:          (none)\n   Sticky Date:         (none)\n   Sticky Options:      (none)\n\nso that only works when there is no CVS/Root file.\n\ncheers\n  simon\n\n-- \nServe - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /\"\\\nWork - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \\ /\nParty Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \\\nDude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \\\n\n"}]}