1 #! /usr/local/bin/perl5
5 # The development branch is where primary development and checkins
6 # are done on a day-to-day basis.
7 $development_branch_prefix = "SpiderMonkey140";
9 # Space-separated list of CVS-controlled directories to tag/merge
13 # When line below uncommented, don't recurse into subdirs
14 #$recurse_flag = '-l';
16 #----------------------------------------------------------------------------
18 # The merge branch is itself a branch off of the development branch
19 # at a point where the development branch is thought to be stable.
20 # (A branch is used rather than a static tag because, inevitably,
21 # the development branch is not quite as stable/buildable as was
22 # thought.) The contents of the merge branch will be copied to
23 # the trunk when merging takes place.
26 # The following tags are created automatically by this script:
30 # A static tag on the development branch (or a branch off the
31 # development branch) that indicates the code that should be merged
32 # into the trunk. This is a "variable" tag in the sense that it is
33 # redefined after each merge.
37 # A static tag that is a copy of what the JS_STABLE_DROP tag was in
38 # the previous merge cycle. This is a "variable" tag that is
39 # redefined after each merge. Changes in the branch can be merged
40 # to the trunk by using:
42 # cvs up -jJS_LAST_STABLE_DROP -jJS_STABLE_DROP
46 # A static tag that identifies the code on the trunk after the merge
47 # from the branch to the trunk takes place. This is a "variable"
48 # tag that is redefined after each merge. Changes on the trunk
49 # since the last branch landing can be seen by using:
51 # cvs diff -rJS_LANDING -rHEAD
55 # This is a tag on the trunk which may be used for archaeological
56 # purposes. This tag is made from the JS_LANDING tag.
59 $development_branch = $development_branch_prefix . "_BRANCH";
60 $development_base = $development_branch_prefix . "_BASE";
64 $0: A tool for merging stable snapshots of JavaScript from a CVS
65 development branch onto the trunk
67 Landing a snapshot of the development branch consists of
70 1) Tag all/some files on the branch to identify files to be merged.
71 2) Merge files from the branch into the trunk using a temporary
73 3) Resolve any conflicts that arise as a result of the merge.
74 4) Commit merged changes to the trunk.
75 5) Make changes to resolve (build) difficulties and re-commit.
77 6) Backpropagate changes on the trunk to the development branch.
79 This script will assist with steps #2, #4 and #6:
81 $0 -merge JS_STABLE_10131998
90 print LOGFILE
$msg if $logfile;
93 # Similar to die built-in
99 $msg .= "\nSee $logfile for details.";
104 # Similar to system() built-in
107 local($cmd) = join(" ", @args);
108 &log("Executing: $cmd\n");
111 $cmd .= " >> $logfile 2>&1";
115 local($result) = 0xffff & system($cmd);
118 open(LOGFILE
, ">>$logfile");
121 return unless ($result);
122 $msg = "Died while executing $cmd";
124 if ($result == 0xff00) {
125 &die("$msg\nWhile executExecution failed due to perl error: $!. ");
128 &die("$msg\nExecution failed; exit status: $result. ");
132 chomp($root_dir = `pwd`);
135 $logfile = $root_dir . "/log";
145 } elsif (/-commit/ || /-ci/) {
147 } elsif (/-backpatch/) {
151 } elsif (/-tag/) { # Debugging option
154 } elsif (/-co/) { # Debugging option
157 print STDERR
"Illegal option: $_\n" unless (/-h/);
163 die "You must set your CVSROOT environment variable" if !$ENV{"CVSROOT"};
166 open(LOGFILE
, ">$logfile") || die "Couldn't open log file \"$logfile\"";
167 print("Logging to file \"$logfile\".\n");
170 $trunk_dir = $root_dir . "/trunk";
174 &die("Must specify tag on command-line\n");
177 print("Tagging tree with tag JS_STABLE_DROP.\n");
178 &system("cvs rtag $recurse_flag -F -r $tag JS_STABLE_DROP $merge_dirs");
183 # Delete trunk subdir if it already exists
185 &log("Deleting directory $trunk_dir\n");
186 rmtree
($trunk_dir, 0, 1);
188 &log("Creating directory $trunk_dir\n");
189 mkdir($trunk_dir, 0777) || die "Couldn't create directory $trunk_dir";
192 print("Checking out $merge_dirs.\n");
194 &system("cvs co $recurse_flag -A $merge_dirs");
199 print("Merging from JS_STABLE_DROP into trunk\n");
200 &system("cvs up -jJS_LAST_STABLE_DROP -jJS_STABLE_DROP");
204 &die("No merged tree found. Wrong directory ?") if (!chdir $trunk_dir);
206 ($_,$_,$_,$day,$mon,$year,$_,$_) = localtime(time());
208 $year = "20" . $year;
210 $year = "19" . $year;
213 $mmddyyyy = sprintf("%02d%02d%s", $mon, $day, $year);
215 print("Checking in code on trunk");
216 &system("cvs ci -m 'Stable drop of JavaScript interpreter code from " .
217 "$development_branch'");
220 &system("cvs tag -F JS_LANDING");
221 &system("cvs tag -F JS_LANDING_$mmddyyyy");
223 # Move JS_LAST_STABLE_DROP tag forward
224 &system("cvs tag -F -rJS_STABLE_DROP JS_LAST_STABLE_DROP");