summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-04-07 10:22:37 +0000
committerjoerg <joerg@FreeBSD.org>1996-04-07 10:22:37 +0000
commitd3200e4c02e0cae9682b661043d18f9ee1b2215c (patch)
tree2a669d82e89f540996906a20544df294ef828627 /gnu/usr.bin
parent285acf5c8d99d868efc8ba3bfcdd76478d41038c (diff)
downloadFreeBSD-src-d3200e4c02e0cae9682b661043d18f9ee1b2215c.zip
FreeBSD-src-d3200e4c02e0cae9682b661043d18f9ee1b2215c.tar.gz
Make `easy-import' ready for vendor-branch imports.
I'm also going to install the new version on freefall.
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/cvs/contrib/easy-import.pl131
1 files changed, 71 insertions, 60 deletions
diff --git a/gnu/usr.bin/cvs/contrib/easy-import.pl b/gnu/usr.bin/cvs/contrib/easy-import.pl
index 7bcfc39..c12ad3f 100644
--- a/gnu/usr.bin/cvs/contrib/easy-import.pl
+++ b/gnu/usr.bin/cvs/contrib/easy-import.pl
@@ -8,7 +8,7 @@
#
# Written by Jörg Wunsch, 95/03/07, and placed in the public domain.
#
-# $Id: easy-import.pl,v 1.4 1995/12/11 00:45:43 peter Exp $
+# $Id: easy-import.pl,v 1.5 1996/01/02 07:39:03 joerg Exp $
require "complete.pl";
require "getopts.pl";
@@ -22,7 +22,7 @@ sub scan_opts
$dont_do_it = "-n" if $opt_n;
if($opt_v) {
- print STDERR '$Source: /home/ncvs/src/gnu/usr.bin/cvs/contrib/easy-import.pl,v $ $Revision: 1.4 $' . "\n"; # 'emacs kludge
+ print STDERR '$Source: /home/ncvs/src/gnu/usr.bin/cvs/contrib/easy-import.pl,v $ $Revision: 1.5 $' . "\n"; # 'emacs kludge
exit 0;
}
die "usage: $0 [-v] [-n] [moduledir]\n" .
@@ -162,20 +162,20 @@ sub cvs_init
sub lsmodules
{
# list all known CVS modules
- local(@rv, $mname, $_);
+ local(%rv, $mname, $mpath, $_);
- @rv = ();
+ %rv = ();
open(CVS, "cvs co -c|");
while($_ = <CVS>) {
chop;
- ($mname) = split;
+ ($mname,$mpath) = split;
next if $mname eq "";
- @rv = (@rv, $mname);
+ $rv{$mname} = $mpath;
}
close(CVS);
- return @rv;
+ return %rv;
}
@@ -259,56 +259,65 @@ $area = "$rep/$selected";
print "\n${so}[Working on:${se} ${us}$area${ue}${so}]${se}\n";
+%cvsmods = &lsmodules();
+
for(;;) {
$| = 1;
- print "${so}Enter the module path:${se} $area/";
+ print "${so}Gimme the module name:${se} ";
$| = 0;
- $modpath = <>;
- chop $modpath;
- if ($modpath eq "") {
- print "\a${us}You cannot use an empty module path.${ue}\n";
+ $modname = <>;
+ chop $modname;
+ if ($modname eq "") {
+ print "\a${us}You cannot use an empty module name.${ue}\n";
next;
}
- last if ! -d "$cvsroot/$area/$modpath";
- print "\a${us}This module path does already exist; " .
- "choose another one.${ue}\n";
+ last if !$cvsmods{$modname};
+ print "\a${us}This module name does already exist;\n" .
+ "do you intend to create a vendor-branch import?${ue}: ";
+ $rep = <>;
+ if ($rep =~ /\s*[yY]/) {
+ ($area,$modpath) = split(/\//,$cvsmods{$modname},2);
+ $branchimport = 1;
+ last;
+ }
+ print "${us}Choose another name.${ue}\n";
}
-@newdirs = ();
-$dir1 = "$cvsroot/$area";
-$dir2 = "$area";
+if(!$branchimport) {
+ for(;;) {
+ $| = 1;
+ print "${so}Enter the module path:${se} $area/";
+ $| = 0;
+ $modpath = <>;
+ chop $modpath;
+ if ($modpath eq "") {
+ print "\a${us}You cannot use an empty module path.${ue}\n";
+ next;
+ }
+ last if ! -d "$cvsroot/$area/$modpath";
+ print "\a${us}This module path does already exist; " .
+ "choose another one.${ue}\n";
+ }
-@newdirs = (@newdirs, "$dir2") if ! -d $dir1;
-foreach $ele (split(/\//, $modpath)) {
- $dir1 = "$dir1/$ele";
- $dir2 = "$dir2/$ele";
- @newdirs = (@newdirs, "$dir2") if ! -d $dir1;
-}
+ @newdirs = ();
+ $dir1 = "$cvsroot/$area";
+ $dir2 = "$area";
-print "${so}You're going to create the following new directories:${se}\n";
+ @newdirs = (@newdirs, "$dir2") if ! -d $dir1;
-&list(@newdirs);
+ foreach $ele (split(/\//, $modpath)) {
+ $dir1 = "$dir1/$ele";
+ $dir2 = "$dir2/$ele";
+ @newdirs = (@newdirs, "$dir2") if ! -d $dir1;
+ }
-@cvsmods = &lsmodules();
+ print "${so}You're going to create the following new directories:${se}\n";
-for(;;) {
- $| = 1;
- print "${so}Gimme the module name:${se} ";
- $| = 0;
- $modname = <>;
- chop $modname;
- if ($modname eq "") {
- print "\a${us}You cannot use an empty module name.${ue}\n";
- next;
- }
- last if !&contains($modname, @cvsmods);
- print "\a${us}This module name does already exist; " .
- "choose another one.${ue}\n";
+ &list(@newdirs);
}
-
for(;;) {
$| = 1;
print "${so}Enter a \`vendor\' tag (e. g. the authors ID):${se} ";
@@ -342,29 +351,31 @@ foreach $tmp (@cvsmods) {
}
}
-if($mod eq "") {
- # we are going to append our module
- $cmd = "\$\na\n";
-} else {
- # we can insert it
- $cmd = "/^${mod}[ \t]/\ni\n";
-}
+if (!$branchimport) {
+ if($mod eq "") {
+ # we are going to append our module
+ $cmd = "\$\na\n";
+ } else {
+ # we can insert it
+ $cmd = "/^${mod}[ \t]/\ni\n";
+ }
-print "${so}Checking out the modules database...${se}\n";
-system("cvs co modules") && die "${us}failed.\n${ue}";
+ print "${so}Checking out the modules database...${se}\n";
+ system("cvs co modules") && die "${us}failed.\n${ue}";
-print "${so}Inserting new module...${se}\n";
-open(ED, "|ed modules/modules") || die "${us}Cannot start ed${ue}\n";
-print(ED "${cmd}${modname}" . ' ' x (16 - length($modname)) .
- "$area/${modpath}\n.\nw\nq\n");
-close(ED);
+ print "${so}Inserting new module...${se}\n";
+ open(ED, "|ed modules/modules") || die "${us}Cannot start ed${ue}\n";
+ print(ED "${cmd}${modname}" . ' ' x (16 - length($modname)) .
+ "$area/${modpath}\n.\nw\nq\n");
+ close(ED);
-print "${so}Commiting new modules database...${se}\n";
-system("cvs $dont_do_it commit -m \" " .
- "${modname} --> $area/${modpath}\" modules")
- && die "Commit failed\n";
+ print "${so}Commiting new modules database...${se}\n";
+ system("cvs $dont_do_it commit -m \" " .
+ "${modname} --> $area/${modpath}\" modules")
+ && die "Commit failed\n";
-system("cvs $dont_do_it -Q release -d modules");
+ system("cvs $dont_do_it -Q release -d modules");
+}
print "${so}Importing source. Enter a commit message in the editor.${se}\n";
OpenPOWER on IntegriCloud