Thread (8 messages) flat view 8 messages, 4 authors, 2016-06-15

Re: cvsimport still not working with cvsnt

From: Guy Rouillier <hidden>
Date: 2016-06-15 22:50:21

On 12/22/2010 12:43 AM, Guy Rouillier wrote:
Emil and Jonathan, thanks for the feedback. Perl is not my strong point,
but I'll take a crack at it over the upcoming holidays. I'm inclined not
to get too fancy and try to second-guess the user's environment. Perhaps
he has both cvs and cvsnt installed for some reason (testing one, using
the other for regular work); perhaps a tool installed one or the other
and he doesn't even know he has them both. Etc.

So, at most I can see, as Emil suggested, seeing if the entry exists in
both files and is the same in both. If so, or if the entry is only in
one of them, then just use the entry. However, if the entry is in both
files and is different, I'd prefer to just exit with an error and have
the user clarify his environment.
Here is my patch for accomplishing the above.  As this is my first time
submitting a patch, please let me know the correct procedure if
submitting a diff here is not appropriate.  Thanks.
--- git-cvsimport.org	2011-01-09 03:52:39.000000000 -0500
+++ git-cvsimport.cvsnt	2011-01-10 01:42:29.000000000 -0500
@@ -260,6 +260,8 @@
  		if ($pass) {
  			$pass = $self->_scramble($pass);
  		} else {
+			# First try the original CVS location.
+
  			open(H,$ENV{'HOME'}."/.cvspass") and do {
  				# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
  				while (<H>) {
@@ -272,7 +274,30 @@
  					}
  				}
  			};
-			$pass = "A" unless $pass;
+
+			# Now try the CVSNT location.
+
+			open(H,$ENV{'HOME'}."/.cvs/cvspass") and do {
+				# :pserver:cvs@mea.tmt.tele.fi:/cvsroot/zmailer Ah<Z
+				while (<H>) {
+					chomp;
+					s/^\/\d+\s+//;
+					my ($w,$p) = split(/=/,$_,2);
+					if ($w eq $rr or $w eq $rr2) {
+						my $cvsntpass = $p;
+
+						if (!$pass) {
+							$pass = $cvsntpass;
+						} elsif ($pass ne $cvsntpass) {
+							die("CVSROOT found in both CVS and CVSNT cvspass files, passwords do not match\n");
+						}
+						last;
+					}
+				}
+			};
+
+
+			die("Password not found for CVSROOT: $opt_d\n") unless $pass;
  		}

  		my ($s, $rep);


-- 
Guy Rouillier
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help