make/scripts/webrev.ksh
author sundar
Mon, 02 Dec 2013 18:19:26 +0530
changeset 22370 c150d042ffff
parent 21511 4be11da17625
permissions -rw-r--r--
8029364: NashornException to expose thrown object Reviewed-by: lagergren, jlaskey
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     1
#!/bin/ksh -p
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     2
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     3
# CDDL HEADER START
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     4
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     8
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    11
# See the License for the specific language governing permissions
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    12
# and limitations under the License.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    13
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    19
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    20
# CDDL HEADER END
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    21
#
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
    22
# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    23
# Use is subject to license terms.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    24
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    25
# This script takes a file list and a workspace and builds a set of html files
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    26
# suitable for doing a code review of source changes via a web page.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    27
# Documentation is available via 'webrev -h'.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    28
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    29
21511
4be11da17625 8027836: Webrev should handle files that has been moved from a directory which now is removed.
ihse
parents: 20637
diff changeset
    30
WEBREV_UPDATED=25.1-hg+openjdk.java.net
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    31
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    32
HTML='<?xml version="1.0"?>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    33
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    34
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    35
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    36
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    37
FRAMEHTML='<?xml version="1.0"?>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    38
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    39
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    40
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    41
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
    42
STDHEAD='<meta charset="utf-8">
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
    43
<meta http-equiv="cache-control" content="no-cache" />
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    44
<meta http-equiv="Pragma" content="no-cache" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    45
<meta http-equiv="Expires" content="-1" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    46
<!--
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    47
   Note to customizers: the body of the webrev is IDed as SUNWwebrev
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    48
   to allow easy overriding by users of webrev via the userContent.css
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    49
   mechanism available in some browsers.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    50
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    51
   For example, to have all "removed" information be red instead of
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    52
   brown, set a rule in your userContent.css file like:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    53
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    54
       body#SUNWwebrev span.removed { color: red ! important; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    55
-->
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    56
<style type="text/css" media="screen">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    57
body {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    58
    background-color: #eeeeee;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    59
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    60
hr {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    61
    border: none 0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    62
    border-top: 1px solid #aaa;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    63
    height: 1px;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    64
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    65
div.summary {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    66
    font-size: .8em;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    67
    border-bottom: 1px solid #aaa;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    68
    padding-left: 1em;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    69
    padding-right: 1em;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    70
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    71
div.summary h2 {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    72
    margin-bottom: 0.3em;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    73
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    74
div.summary table th {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    75
    text-align: right;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    76
    vertical-align: top;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    77
    white-space: nowrap;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    78
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    79
span.lineschanged {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    80
    font-size: 0.7em;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    81
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    82
span.oldmarker {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    83
    color: red;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    84
    font-size: large;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    85
    font-weight: bold;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    86
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    87
span.newmarker {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    88
    color: green;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    89
    font-size: large;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    90
    font-weight: bold;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    91
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    92
span.removed {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    93
    color: brown;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    94
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    95
span.changed {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    96
    color: blue;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    97
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    98
span.new {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
    99
    color: blue;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   100
    font-weight: bold;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   101
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   102
a.print { font-size: x-small; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   103
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   104
</style>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   105
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   106
<style type="text/css" media="print">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   107
pre { font-size: 0.8em; font-family: courier, monospace; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   108
span.removed { color: #444; font-style: italic }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   109
span.changed { font-weight: bold; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   110
span.new { font-weight: bold; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   111
span.newmarker { font-size: 1.2em; font-weight: bold; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   112
span.oldmarker { font-size: 1.2em; font-weight: bold; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   113
a.print {display: none}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   114
hr { border: none 0; border-top: 1px solid #aaa; height: 1px; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   115
</style>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   116
'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   117
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   118
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   119
# UDiffs need a slightly different CSS rule for 'new' items (we don't
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   120
# want them to be bolded as we do in cdiffs or sdiffs).
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   121
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   122
UDIFFCSS='
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   123
<style type="text/css" media="screen">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   124
span.new {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   125
    color: blue;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   126
    font-weight: normal;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   127
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   128
</style>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   129
'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   130
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   131
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   132
# input_cmd | html_quote | output_cmd
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   133
# or
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   134
# html_quote filename | output_cmd
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   135
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   136
# Make a piece of source code safe for display in an HTML <pre> block.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   137
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   138
html_quote()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   139
{
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   140
	sed -e "s/&/\&amp;/g" -e "s/&amp;#\([x]*[0-9A-Fa-f]\{2,5\}\);/\&#\1;/g" -e "s/</\&lt;/g" -e "s/>/\&gt;/g" "$@" | expand
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   141
}
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   142
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   143
#
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   144
# input_cmd | html_quote | output_cmd
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   145
# or
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   146
# html_dequote filename | output_cmd
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   147
#
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   148
# Replace HTML entities with literals
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   149
#
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   150
html_dequote()
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   151
{
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
   152
	sed -e "s/&quot;/\"/g" -e "s/&apos;/\'/g" -e "s/&amp;/\&/g" -e "s/&lt;/<'/g" -e "s/&gt;/>/g" "$@" | expand
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   153
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   154
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   155
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   156
# input_cmd | bug2url | output_cmd
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   157
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   158
# Scan for bugids and insert <a> links to the relevent bug database.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   159
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   160
bug2url()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   161
{
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
   162
	sed -e 's|[0-9]\{5,\}|<a href=\"'$BUGURL$IDPREFIX'&\">&</a>|g'
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   163
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   164
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   165
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   166
# strip_unchanged <infile> | output_cmd
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   167
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   168
# Removes chunks of sdiff documents that have not changed. This makes it
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   169
# easier for a code reviewer to find the bits that have changed.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   170
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   171
# Deleted lines of text are replaced by a horizontal rule. Some
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   172
# identical lines are retained before and after the changed lines to
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   173
# provide some context.  The number of these lines is controlled by the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   174
# variable C in the $AWK script below.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   175
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   176
# The script detects changed lines as any line that has a "<span class="
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   177
# string embedded (unchanged lines have no particular class and are not
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   178
# part of a <span>).  Blank lines (without a sequence number) are also
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   179
# detected since they flag lines that have been inserted or deleted.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   180
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   181
strip_unchanged()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   182
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   183
	$AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   184
	BEGIN	{ C = c = 20 }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   185
	NF == 0 || /span class=/ {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   186
		if (c > C) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   187
			c -= C
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   188
			inx = 0
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   189
			if (c > C) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   190
				print "\n</pre><hr></hr><pre>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   191
				inx = c % C
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   192
				c = C
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   193
			}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   194
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   195
			for (i = 0; i < c; i++)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   196
				print ln[(inx + i) % C]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   197
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   198
		c = 0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   199
		print
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   200
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   201
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   202
	{	if (c >= C) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   203
			ln[c % C] = $0
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   204
			c++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   205
			next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   206
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   207
		c++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   208
		print
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   209
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   210
	END	{ if (c > (C * 2)) print "\n</pre><hr></hr>" }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   211
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   212
	' $1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   213
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   214
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   215
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   216
# sdiff_to_html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   217
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   218
# This function takes two files as arguments, obtains their diff, and
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   219
# processes the diff output to present the files as an HTML document with
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   220
# the files displayed side-by-side, differences shown in color.  It also
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   221
# takes a delta comment, rendered as an HTML snippet, as the third
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   222
# argument.  The function takes two files as arguments, then the name of
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   223
# file, the path, and the comment.  The HTML will be delivered on stdout,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   224
# e.g.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   225
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   226
#   $ sdiff_to_html old/usr/src/tools/scripts/webrev.sh \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   227
#         new/usr/src/tools/scripts/webrev.sh \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   228
#         webrev.sh usr/src/tools/scripts \
19754
76f369edc1ca 8024201: Update bugdatabase url
mduigou
parents: 16821
diff changeset
   229
#         '<a href="https://bugs.openjdk.java.net/browse/JDK-1234567">
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
   230
#          JDK-1234567</a> my bugid' > <file>.html
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   231
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   232
# framed_sdiff() is then called which creates $2.frames.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   233
# in the webrev tree.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   234
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   235
# FYI: This function is rather unusual in its use of awk.  The initial
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   236
# diff run produces conventional diff output showing changed lines mixed
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   237
# with editing codes.  The changed lines are ignored - we're interested in
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   238
# the editing codes, e.g.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   239
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   240
#      8c8
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   241
#      57a61
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   242
#      63c66,76
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   243
#      68,93d80
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   244
#      106d90
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   245
#      108,110d91
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   246
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   247
#  These editing codes are parsed by the awk script and used to generate
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   248
#  another awk script that generates HTML, e.g the above lines would turn
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   249
#  into something like this:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   250
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   251
#      BEGIN { printf "<pre>\n" }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   252
#      function sp(n) {for (i=0;i<n;i++)printf "\n"}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   253
#      function wl(n) {printf "<font color=%s>%4d %s </font>\n", n, NR, $0}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   254
#      NR==8           {wl("#7A7ADD");next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   255
#      NR==54          {wl("#7A7ADD");sp(3);next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   256
#      NR==56          {wl("#7A7ADD");next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   257
#      NR==57          {wl("black");printf "\n"; next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   258
#        :               :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   259
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   260
#  This script is then run on the original source file to generate the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   261
#  HTML that corresponds to the source file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   262
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   263
#  The two HTML files are then combined into a single piece of HTML that
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   264
#  uses an HTML table construct to present the files side by side.  You'll
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   265
#  notice that the changes are color-coded:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   266
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   267
#   black     - unchanged lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   268
#   blue      - changed lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   269
#   bold blue - new lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   270
#   brown     - deleted lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   271
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   272
#  Blank lines are inserted in each file to keep unchanged lines in sync
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   273
#  (side-by-side).  This format is familiar to users of sdiff(1) or
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   274
#  Teamware's filemerge tool.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   275
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   276
sdiff_to_html()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   277
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   278
	diff -b $1 $2 > /tmp/$$.diffs
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   279
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   280
	TNAME=$3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   281
	TPATH=$4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   282
	COMMENT=$5
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   283
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   284
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   285
	#  Now we have the diffs, generate the HTML for the old file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   286
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   287
	$AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   288
	BEGIN	{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   289
		printf "function sp(n) {for (i=0;i<n;i++)printf \"\\n\"}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   290
		printf "function removed() "
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   291
		printf "{printf \"<span class=\\\"removed\\\">%%4d %%s</span>\\n\", NR, $0}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   292
		printf "function changed() "
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   293
		printf "{printf \"<span class=\\\"changed\\\">%%4d %%s</span>\\n\", NR, $0}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   294
		printf "function bl() {printf \"%%4d %%s\\n\", NR, $0}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   295
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   296
	/^</	{next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   297
	/^>/	{next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   298
	/^---/	{next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   299
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   300
	{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   301
	split($1, a, /[cad]/) ;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   302
	if (index($1, "a")) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   303
		if (a[1] == 0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   304
			n = split(a[2], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   305
			if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   306
				printf "BEGIN\t\t{sp(1)}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   307
			else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   308
				printf "BEGIN\t\t{sp(%d)}\n",\
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   309
				(r[2] - r[1]) + 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   310
			next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   311
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   312
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   313
		printf "NR==%s\t\t{", a[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   314
		n = split(a[2], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   315
		s = r[1];
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   316
		if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   317
			printf "bl();printf \"\\n\"; next}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   318
		else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   319
			n = r[2] - r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   320
			printf "bl();sp(%d);next}\n",\
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   321
			(r[2] - r[1]) + 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   322
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   323
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   324
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   325
	if (index($1, "d")) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   326
		n = split(a[1], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   327
		n1 = r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   328
		n2 = r[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   329
		if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   330
			printf "NR==%s\t\t{removed(); next}\n" , n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   331
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   332
			printf "NR==%s,NR==%s\t{removed(); next}\n" , n1, n2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   333
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   334
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   335
	if (index($1, "c")) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   336
		n = split(a[1], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   337
		n1 = r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   338
		n2 = r[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   339
		final = n2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   340
		d1 = 0
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   341
		if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   342
			printf "NR==%s\t\t{changed();" , n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   343
		else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   344
			d1 = n2 - n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   345
			printf "NR==%s,NR==%s\t{changed();" , n1, n2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   346
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   347
		m = split(a[2], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   348
		n1 = r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   349
		n2 = r[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   350
		if (m > 1) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   351
			d2  = n2 - n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   352
			if (d2 > d1) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   353
				if (n > 1) printf "if (NR==%d)", final
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   354
				printf "sp(%d);", d2 - d1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   355
			}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   356
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   357
		printf "next}\n" ;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   358
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   359
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   360
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   361
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   362
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   363
	END	{ printf "{printf \"%%4d %%s\\n\", NR, $0 }\n" }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   364
	' /tmp/$$.diffs > /tmp/$$.file1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   365
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   366
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   367
	#  Now generate the HTML for the new file
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   368
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   369
	$AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   370
	BEGIN	{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   371
		printf "function sp(n) {for (i=0;i<n;i++)printf \"\\n\"}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   372
		printf "function new() "
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   373
		printf "{printf \"<span class=\\\"new\\\">%%4d %%s</span>\\n\", NR, $0}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   374
		printf "function changed() "
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   375
		printf "{printf \"<span class=\\\"changed\\\">%%4d %%s</span>\\n\", NR, $0}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   376
		printf "function bl() {printf \"%%4d %%s\\n\", NR, $0}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   377
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   378
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   379
	/^</	{next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   380
	/^>/	{next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   381
	/^---/	{next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   382
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   383
	{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   384
	split($1, a, /[cad]/) ;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   385
	if (index($1, "d")) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   386
		if (a[2] == 0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   387
			n = split(a[1], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   388
			if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   389
				printf "BEGIN\t\t{sp(1)}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   390
			else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   391
				printf "BEGIN\t\t{sp(%d)}\n",\
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   392
				(r[2] - r[1]) + 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   393
			next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   394
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   395
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   396
		printf "NR==%s\t\t{", a[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   397
		n = split(a[1], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   398
		s = r[1];
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   399
		if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   400
			printf "bl();printf \"\\n\"; next}\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   401
		else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   402
			n = r[2] - r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   403
			printf "bl();sp(%d);next}\n",\
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   404
			(r[2] - r[1]) + 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   405
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   406
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   407
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   408
	if (index($1, "a")) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   409
		n = split(a[2], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   410
		n1 = r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   411
		n2 = r[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   412
		if (n == 1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   413
			printf "NR==%s\t\t{new() ; next}\n" , n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   414
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   415
			printf "NR==%s,NR==%s\t{new() ; next}\n" , n1, n2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   416
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   417
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   418
	if (index($1, "c")) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   419
		n = split(a[2], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   420
		n1 = r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   421
		n2 = r[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   422
		final = n2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   423
		d2 = 0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   424
		if (n == 1) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   425
			final = n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   426
			printf "NR==%s\t\t{changed();" , n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   427
		} else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   428
			d2 = n2 - n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   429
			printf "NR==%s,NR==%s\t{changed();" , n1, n2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   430
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   431
		m = split(a[1], r, /,/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   432
		n1 = r[1]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   433
		n2 = r[2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   434
		if (m > 1) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   435
			d1  = n2 - n1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   436
			if (d1 > d2) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   437
				if (n > 1) printf "if (NR==%d)", final
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   438
				printf "sp(%d);", d1 - d2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   439
			}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   440
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   441
		printf "next}\n" ;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   442
		next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   443
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   444
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   445
	END	{ printf "{printf \"%%4d %%s\\n\", NR, $0 }\n" }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   446
	' /tmp/$$.diffs > /tmp/$$.file2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   447
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   448
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   449
	# Post-process the HTML files by running them back through $AWK
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   450
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   451
	html_quote < $1 | $AWK -f /tmp/$$.file1 > /tmp/$$.file1.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   452
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   453
	html_quote < $2 | $AWK -f /tmp/$$.file2 > /tmp/$$.file2.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   454
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   455
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   456
	# Now combine into a valid HTML file and side-by-side into a table
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   457
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   458
	print "$HTML<head>$STDHEAD"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   459
	print "<title>$WNAME Sdiff $TPATH </title>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   460
	print "</head><body id=\"SUNWwebrev\">"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   461
	print "<h2>$TPATH/$TNAME</h2>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   462
        print "<a class=\"print\" href=\"javascript:print()\">Print this page</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   463
	print "<pre>$COMMENT</pre>\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   464
	print "<table><tr valign=\"top\">"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   465
	print "<td><pre>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   466
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   467
	strip_unchanged /tmp/$$.file1.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   468
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   469
	print "</pre></td><td><pre>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   470
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   471
	strip_unchanged /tmp/$$.file2.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   472
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   473
	print "</pre></td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   474
	print "</tr></table>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   475
	print "</body></html>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   476
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   477
	framed_sdiff $TNAME $TPATH /tmp/$$.file1.html /tmp/$$.file2.html \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   478
	    "$COMMENT"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   479
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   480
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   481
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   482
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   483
# framed_sdiff <filename> <filepath> <lhsfile> <rhsfile> <comment>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   484
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   485
# Expects lefthand and righthand side html files created by sdiff_to_html.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   486
# We use insert_anchors() to augment those with HTML navigation anchors,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   487
# and then emit the main frame.  Content is placed into:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   488
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   489
#    $WDIR/DIR/$TNAME.lhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   490
#    $WDIR/DIR/$TNAME.rhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   491
#    $WDIR/DIR/$TNAME.frames.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   492
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   493
# NOTE: We rely on standard usage of $WDIR and $DIR.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   494
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   495
function framed_sdiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   496
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   497
	typeset TNAME=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   498
	typeset TPATH=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   499
	typeset lhsfile=$3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   500
	typeset rhsfile=$4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   501
	typeset comments=$5
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   502
	typeset RTOP
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   503
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   504
	# Enable html files to access WDIR via a relative path.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   505
	RTOP=$(relative_dir $TPATH $WDIR)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   506
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   507
	# Make the rhs/lhs files and output the frameset file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   508
	print "$HTML<head>$STDHEAD" > $WDIR/$DIR/$TNAME.lhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   509
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   510
	cat >> $WDIR/$DIR/$TNAME.lhs.html <<-EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   511
	    <script type="text/javascript" src="$RTOP/ancnav.js"></script>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   512
	    </head>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   513
	    <body id="SUNWwebrev" onkeypress="keypress(event);">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   514
	    <a name="0"></a>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   515
	    <pre>$comments</pre><hr></hr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   516
	EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   517
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   518
	cp $WDIR/$DIR/$TNAME.lhs.html $WDIR/$DIR/$TNAME.rhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   519
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   520
	insert_anchors $lhsfile >> $WDIR/$DIR/$TNAME.lhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   521
	insert_anchors $rhsfile >> $WDIR/$DIR/$TNAME.rhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   522
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   523
	close='</body></html>'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   524
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   525
	print $close >> $WDIR/$DIR/$TNAME.lhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   526
	print $close >> $WDIR/$DIR/$TNAME.rhs.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   527
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   528
	print "$FRAMEHTML<head>$STDHEAD" > $WDIR/$DIR/$TNAME.frames.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   529
	print "<title>$WNAME Framed-Sdiff " \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   530
	    "$TPATH/$TNAME</title> </head>" >> $WDIR/$DIR/$TNAME.frames.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   531
	cat >> $WDIR/$DIR/$TNAME.frames.html <<-EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   532
	  <frameset rows="*,60">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   533
	    <frameset cols="50%,50%">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   534
	      <frame src="$TNAME.lhs.html" scrolling="auto" name="lhs" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   535
	      <frame src="$TNAME.rhs.html" scrolling="auto" name="rhs" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   536
	    </frameset>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   537
	  <frame src="$RTOP/ancnav.html" scrolling="no" marginwidth="0"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   538
	   marginheight="0" name="nav" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   539
	  <noframes>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   540
            <body id="SUNWwebrev">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   541
	      Alas 'frames' webrev requires that your browser supports frames
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   542
	      and has the feature enabled.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   543
            </body>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   544
	  </noframes>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   545
	  </frameset>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   546
	</html>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   547
	EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   548
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   549
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   550
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   551
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   552
# fix_postscript
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   553
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   554
# Merge codereview output files to a single conforming postscript file, by:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   555
# 	- removing all extraneous headers/trailers
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   556
#	- making the page numbers right
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   557
#	- removing pages devoid of contents which confuse some
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   558
#	  postscript readers.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   559
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   560
# From Casper.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   561
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   562
function fix_postscript
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   563
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   564
	infile=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   565
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   566
	cat > /tmp/$$.crmerge.pl << \EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   567
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   568
	print scalar(<>);		# %!PS-Adobe---
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   569
	print "%%Orientation: Landscape\n";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   570
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   571
	$pno = 0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   572
	$doprint = 1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   573
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   574
	$page = "";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   575
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   576
	while (<>) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   577
		next if (/^%%Pages:\s*\d+/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   578
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   579
		if (/^%%Page:/) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   580
			if ($pno == 0 || $page =~ /\)S/) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   581
				# Header or single page containing text
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   582
				print "%%Page: ? $pno\n" if ($pno > 0);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   583
				print $page;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   584
				$pno++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   585
			} else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   586
				# Empty page, skip it.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   587
			}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   588
			$page = "";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   589
			$doprint = 1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   590
			next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   591
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   592
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   593
		# Skip from %%Trailer of one document to Endprolog
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   594
		# %%Page of the next
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   595
		$doprint = 0 if (/^%%Trailer/);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   596
		$page .= $_ if ($doprint);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   597
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   598
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   599
	if ($page =~ /\)S/) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   600
		print "%%Page: ? $pno\n";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   601
		print $page;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   602
	} else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   603
		$pno--;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   604
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   605
	print "%%Trailer\n%%Pages: $pno\n";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   606
EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   607
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   608
	$PERL /tmp/$$.crmerge.pl < $infile
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   609
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   610
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   611
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   612
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   613
# input_cmd | insert_anchors | output_cmd
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   614
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   615
# Flag blocks of difference with sequentially numbered invisible
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   616
# anchors.  These are used to drive the frames version of the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   617
# sdiffs output.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   618
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   619
# NOTE: Anchor zero flags the top of the file irrespective of changes,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   620
# an additional anchor is also appended to flag the bottom.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   621
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   622
# The script detects changed lines as any line that has a "<span
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   623
# class=" string embedded (unchanged lines have no class set and are
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   624
# not part of a <span>.  Blank lines (without a sequence number)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   625
# are also detected since they flag lines that have been inserted or
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   626
# deleted.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   627
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   628
function insert_anchors
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   629
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   630
	$AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   631
	function ia() {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   632
		# This should be able to be a singleton <a /> but that
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   633
		# seems to trigger a bug in firefox a:hover rule processing
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   634
		printf "<a name=\"%d\" id=\"anc%d\"></a>", anc, anc++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   635
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   636
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   637
	BEGIN {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   638
		anc=1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   639
		inblock=1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   640
		printf "<pre>\n";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   641
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   642
	NF == 0 || /^<span class=/ {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   643
		if (inblock == 0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   644
			ia();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   645
			inblock=1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   646
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   647
		print;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   648
		next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   649
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   650
	{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   651
		inblock=0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   652
		print;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   653
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   654
	END {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   655
		ia();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   656
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   657
		printf "<b style=\"font-size: large; color: red\">";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   658
		printf "--- EOF ---</b>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   659
        	for(i=0;i<8;i++) printf "\n\n\n\n\n\n\n\n\n\n";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   660
		printf "</pre>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   661
		printf "<form name=\"eof\">";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   662
		printf "<input name=\"value\" value=\"%d\" type=\"hidden\" />",
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   663
		    anc - 1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   664
		printf "</form>";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   665
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   666
	' $1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   667
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   668
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   669
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   670
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   671
# relative_dir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   672
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   673
# Print a relative return path from $1 to $2.  For example if
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   674
# $1=/tmp/myreview/raw_files/usr/src/tools/scripts and $2=/tmp/myreview,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   675
# this function would print "../../../../".
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   676
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   677
# In the event that $1 is not in $2 a warning is printed to stderr,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   678
# and $2 is returned-- the result of this is that the resulting webrev
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   679
# is not relocatable.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   680
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   681
function relative_dir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   682
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   683
    d1=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   684
    d2=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   685
    if [[ "$d1" == "." ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   686
	print "."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   687
    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   688
	typeset cur="${d1##$d2?(/)}"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   689
	typeset ret=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   690
	if [[ $d2 == $cur ]]; then   # Should never happen.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   691
		# Should never happen.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   692
		print -u2 "\nWARNING: relative_dir: \"$1\" not relative "
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   693
		print -u2 "to \"$2\".  Check input paths.  Framed webrev "
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   694
		print -u2 "will not be relocatable!"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   695
		print $2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   696
		return
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   697
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   698
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   699
	while [[ -n ${cur} ]];
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   700
	do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   701
		cur=${cur%%*(/)*([!/])}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   702
		if [[ -z $ret ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   703
			ret=".."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   704
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   705
			ret="../$ret"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   706
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   707
	done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   708
	print $ret
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   709
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   710
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   711
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   712
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   713
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   714
# frame_nav_js
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   715
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   716
# Emit javascript for frame navigation
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   717
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   718
function frame_nav_js
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   719
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   720
cat << \EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   721
var myInt;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   722
var scrolling=0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   723
var sfactor = 3;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   724
var scount=10;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   725
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   726
function scrollByPix() {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   727
	if (scount<=0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   728
		sfactor*=1.2;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   729
		scount=10;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   730
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   731
	parent.lhs.scrollBy(0,sfactor);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   732
	parent.rhs.scrollBy(0,sfactor);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   733
	scount--;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   734
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   735
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   736
function scrollToAnc(num) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   737
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   738
	// Update the value of the anchor in the form which we use as
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   739
	// storage for this value.  setAncValue() will take care of
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   740
	// correcting for overflow and underflow of the value and return
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   741
	// us the new value.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   742
	num = setAncValue(num);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   743
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   744
	// Set location and scroll back a little to expose previous
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   745
	// lines.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   746
	//
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   747
	// Note that this could be improved: it is possible although
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   748
	// complex to compute the x and y position of an anchor, and to
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   749
	// scroll to that location directly.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   750
	//
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   751
	parent.lhs.location.replace(parent.lhs.location.pathname + "#" + num);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   752
	parent.rhs.location.replace(parent.rhs.location.pathname + "#" + num);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   753
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   754
	parent.lhs.scrollBy(0,-30);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   755
	parent.rhs.scrollBy(0,-30);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   756
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   757
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   758
function getAncValue()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   759
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   760
	return (parseInt(parent.nav.document.diff.real.value));
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   761
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   762
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   763
function setAncValue(val)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   764
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   765
	if (val <= 0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   766
		val = 0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   767
		parent.nav.document.diff.real.value = val;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   768
		parent.nav.document.diff.display.value = "BOF";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   769
		return (val);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   770
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   771
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   772
	//
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   773
	// The way we compute the max anchor value is to stash it
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   774
	// inline in the left and right hand side pages-- it's the same
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   775
	// on each side, so we pluck from the left.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   776
	//
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   777
	maxval = parent.lhs.document.eof.value.value;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   778
	if (val < maxval) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   779
		parent.nav.document.diff.real.value = val;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   780
		parent.nav.document.diff.display.value = val.toString();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   781
		return (val);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   782
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   783
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   784
	// this must be: val >= maxval
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   785
	val = maxval;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   786
	parent.nav.document.diff.real.value = val;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   787
	parent.nav.document.diff.display.value = "EOF";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   788
	return (val);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   789
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   790
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   791
function stopScroll() {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   792
	if (scrolling==1) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   793
		clearInterval(myInt);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   794
		scrolling=0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   795
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   796
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   797
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   798
function startScroll() {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   799
	stopScroll();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   800
	scrolling=1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   801
	myInt=setInterval("scrollByPix()",10);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   802
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   803
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   804
function handlePress(b) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   805
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   806
	switch (b) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   807
	    case 1 :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   808
		scrollToAnc(-1);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   809
		break;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   810
	    case 2 :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   811
		scrollToAnc(getAncValue() - 1);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   812
		break;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   813
	    case 3 :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   814
		sfactor=-3;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   815
		startScroll();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   816
		break;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   817
	    case 4 :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   818
		sfactor=3;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   819
		startScroll();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   820
		break;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   821
	    case 5 :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   822
		scrollToAnc(getAncValue() + 1);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   823
		break;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   824
	    case 6 :
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   825
		scrollToAnc(999999);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   826
		break;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   827
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   828
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   829
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   830
function handleRelease(b) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   831
	stopScroll();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   832
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   833
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   834
function keypress(ev) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   835
	var keynum;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   836
	var keychar;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   837
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   838
	if (window.event) { // IE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   839
		keynum = ev.keyCode;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   840
	} else if (ev.which) { // non-IE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   841
		keynum = ev.which;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   842
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   843
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   844
	keychar = String.fromCharCode(keynum);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   845
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   846
	if (keychar == "k") {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   847
		handlePress(2);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   848
		return (0);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   849
	} else if (keychar == "j" || keychar == " ") {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   850
		handlePress(5);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   851
		return (0);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   852
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   853
	return (1);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   854
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   855
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   856
function ValidateDiffNum(){
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   857
	val = parent.nav.document.diff.display.value;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   858
	if (val == "EOF") {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   859
		scrollToAnc(999999);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   860
		return;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   861
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   862
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   863
	if (val == "BOF") {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   864
		scrollToAnc(0);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   865
		return;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   866
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   867
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   868
        i=parseInt(val);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   869
        if (isNaN(i)) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   870
                parent.nav.document.diff.display.value = getAncValue();
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   871
        } else {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   872
                scrollToAnc(i);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   873
        }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   874
        return false;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   875
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   876
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   877
EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   878
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   879
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   880
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   881
# frame_navigation
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   882
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   883
# Output anchor navigation file for framed sdiffs.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   884
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   885
function frame_navigation
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   886
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   887
	print "$HTML<head>$STDHEAD"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   888
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   889
	cat << \EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   890
<title>Anchor Navigation</title>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   891
<meta http-equiv="Content-Script-Type" content="text/javascript" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   892
<meta http-equiv="Content-Type" content="text/html" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   893
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   894
<style type="text/css">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   895
    div.button td { padding-left: 5px; padding-right: 5px;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   896
		    background-color: #eee; text-align: center;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   897
		    border: 1px #444 outset; cursor: pointer; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   898
    div.button a { font-weight: bold; color: black }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   899
    div.button td:hover { background: #ffcc99; }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   900
</style>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   901
EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   902
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   903
	print "<script type=\"text/javascript\" src=\"ancnav.js\"></script>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   904
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   905
	cat << \EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   906
</head>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   907
<body id="SUNWwebrev" bgcolor="#eeeeee" onload="document.diff.real.focus();"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   908
	onkeypress="keypress(event);">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   909
    <noscript lang="javascript">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   910
      <center>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   911
	<p><big>Framed Navigation controls require Javascript</big><br />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   912
	Either this browser is incompatable or javascript is not enabled</p>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   913
      </center>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   914
    </noscript>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   915
    <table width="100%" border="0" align="center">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   916
	<tr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   917
          <td valign="middle" width="25%">Diff navigation:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   918
          Use 'j' and 'k' for next and previous diffs; or use buttons
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   919
          at right</td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   920
	  <td align="center" valign="top" width="50%">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   921
	    <div class="button">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   922
	      <table border="0" align="center">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   923
                  <tr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   924
		    <td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   925
		      <a onMouseDown="handlePress(1);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   926
			 onMouseUp="handleRelease(1);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   927
			 onMouseOut="handleRelease(1);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   928
			 onClick="return false;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   929
			 title="Go to Beginning Of file">BOF</a></td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   930
		    <td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   931
		      <a onMouseDown="handlePress(3);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   932
			 onMouseUp="handleRelease(3);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   933
			 onMouseOut="handleRelease(3);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   934
			 title="Scroll Up: Press and Hold to accelerate"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   935
			 onClick="return false;">Scroll Up</a></td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   936
		    <td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   937
		      <a onMouseDown="handlePress(2);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   938
			 onMouseUp="handleRelease(2);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   939
			 onMouseOut="handleRelease(2);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   940
			 title="Go to previous Diff"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   941
			 onClick="return false;">Prev Diff</a>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   942
		    </td></tr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   943
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   944
		  <tr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   945
		    <td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   946
		      <a onMouseDown="handlePress(6);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   947
			 onMouseUp="handleRelease(6);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   948
			 onMouseOut="handleRelease(6);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   949
			 onClick="return false;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   950
			 title="Go to End Of File">EOF</a></td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   951
		    <td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   952
		      <a onMouseDown="handlePress(4);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   953
			 onMouseUp="handleRelease(4);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   954
			 onMouseOut="handleRelease(4);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   955
			 title="Scroll Down: Press and Hold to accelerate"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   956
			 onClick="return false;">Scroll Down</a></td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   957
		    <td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   958
		      <a onMouseDown="handlePress(5);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   959
			 onMouseUp="handleRelease(5);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   960
			 onMouseOut="handleRelease(5);return true;"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   961
			 title="Go to next Diff"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   962
			 onClick="return false;">Next Diff</a></td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   963
		  </tr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   964
              </table>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   965
	    </div>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   966
	  </td>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   967
	  <th valign="middle" width="25%">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   968
	    <form action="" name="diff" onsubmit="return ValidateDiffNum();">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   969
		<input name="display" value="BOF" size="8" type="text" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   970
		<input name="real" value="0" size="8" type="hidden" />
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   971
	    </form>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   972
	  </th>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   973
	</tr>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   974
    </table>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   975
  </body>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   976
</html>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   977
EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   978
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   979
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   980
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   981
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   982
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   983
# diff_to_html <filename> <filepath> { U | C } <comment>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   984
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   985
# Processes the output of diff to produce an HTML file representing either
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   986
# context or unified diffs.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   987
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   988
diff_to_html()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   989
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   990
	TNAME=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   991
	TPATH=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   992
	DIFFTYPE=$3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   993
	COMMENT=$4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   994
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   995
	print "$HTML<head>$STDHEAD"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   996
	print "<title>$WNAME ${DIFFTYPE}diff $TPATH</title>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   997
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   998
	if [[ $DIFFTYPE == "U" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
   999
		print "$UDIFFCSS"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1000
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1001
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1002
	cat <<-EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1003
	</head>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1004
	<body id="SUNWwebrev">
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1005
	<h2>$TPATH</h2>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1006
        <a class="print" href="javascript:print()">Print this page</a>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1007
	<pre>$COMMENT</pre>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1008
        <pre>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1009
EOF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1010
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1011
	html_quote | $AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1012
	/^--- new/	{ next }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1013
	/^\+\+\+ new/	{ next }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1014
	/^--- old/	{ next }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1015
	/^\*\*\* old/	{ next }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1016
	/^\*\*\*\*/	{ next }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1017
	/^-------/	{ printf "<center><h1>%s</h1></center>\n", $0; next }
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1018
	/^\@\@.*\@\@$/	{ printf "</pre><hr /><pre>\n";
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1019
			  printf "<span class=\"newmarker\">%s</span>\n", $0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1020
			  next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1021
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1022
	/^\*\*\*/	{ printf "<hr /><span class=\"oldmarker\">%s</span>\n", $0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1023
			  next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1024
	/^---/		{ printf "<span class=\"newmarker\">%s</span>\n", $0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1025
			  next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1026
	/^\+/		{printf "<span class=\"new\">%s</span>\n", $0; next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1027
	/^!/		{printf "<span class=\"changed\">%s</span>\n", $0; next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1028
	/^-/		{printf "<span class=\"removed\">%s</span>\n", $0; next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1029
			{printf "%s\n", $0; next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1030
	'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1031
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1032
	print "</pre></body></html>\n"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1033
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1034
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1035
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1036
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1037
# source_to_html { new | old } <filename>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1038
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1039
# Process a plain vanilla source file to transform it into an HTML file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1040
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1041
source_to_html()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1042
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1043
	WHICH=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1044
	TNAME=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1045
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1046
	print "$HTML<head>$STDHEAD"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1047
	print "<title>$WHICH $TNAME</title>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1048
	print "<body id=\"SUNWwebrev\">"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1049
	print "<pre>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1050
	html_quote | $AWK '{line += 1 ; printf "%4d %s\n", line, $0 }'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1051
	print "</pre></body></html>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1052
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1053
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1054
comments_from_mercurial()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1055
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1056
	fmt=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1057
	pfile=$PWS/$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1058
	cfile=$CWS/$3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1059
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1060
        logdir=`dirname $cfile`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1061
        logf=`basename $cfile`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1062
        if [ -d $logdir ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1063
            ( cd $logdir;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1064
	        active=`hg status $logf 2>/dev/null`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1065
                # If the output from 'hg status' is not empty, it means the file
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1066
                # hasn't been committed, so don't fetch comments.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1067
	        if [[ -z $active ]] ; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1068
                    if [[ -n $ALL_CREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1069
                        rev_opt=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1070
                        for rev in $ALL_CREV; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1071
                            rev_opt="$rev_opt --rev $rev"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1072
                        done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1073
                        comm=`hg log $rev_opt --follow --template 'rev {rev} : {desc}\n' $logf`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1074
                    elif [[ -n $FIRST_CREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1075
		        comm=`hg log --rev $FIRST_CREV:tip --follow --template 'rev {rev} : {desc}\n' $logf`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1076
                    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1077
		        comm=`hg log -l1 --follow --template 'rev {rev} : {desc}\n' $logf`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1078
                    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1079
	        else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1080
	            comm=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1081
	        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1082
	        if [[ $fmt == "text" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1083
	            print "$comm"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1084
	            return
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1085
	        fi
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1086
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1087
	        print "$comm" | html_quote | bug2url
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1088
                )
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1089
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1090
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1091
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1092
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1093
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1094
# getcomments {text|html} filepath parentpath
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1095
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1096
# Fetch the comments depending on what SCM mode we're in.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1097
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1098
getcomments()
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1099
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1100
	typeset fmt=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1101
	typeset p=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1102
	typeset pp=$3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1103
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1104
	comments_from_mercurial $fmt $pp $p
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1105
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1106
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1107
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1108
# printCI <total-changed> <inserted> <deleted> <modified> <unchanged>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1109
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1110
# Print out Code Inspection figures similar to sccs-prt(1) format.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1111
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1112
function printCI
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1113
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1114
	integer tot=$1 ins=$2 del=$3 mod=$4 unc=$5
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1115
	typeset str
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1116
	if (( tot == 1 )); then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1117
		str="line"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1118
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1119
		str="lines"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1120
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1121
	printf '%d %s changed: %d ins; %d del; %d mod; %d unchg' \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1122
	    $tot $str $ins $del $mod $unc
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1123
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1124
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1125
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1126
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1127
# difflines <oldfile> <newfile>
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1128
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1129
# Calculate and emit number of added, removed, modified and unchanged lines,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1130
# and total lines changed, the sum of added + removed + modified.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1131
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1132
function difflines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1133
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1134
	integer tot mod del ins unc err
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1135
	typeset filename
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1136
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1137
	eval $( diff -e $1 $2 | $AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1138
	# Change range of lines: N,Nc
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1139
	/^[0-9]*,[0-9]*c$/ {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1140
		n=split(substr($1,1,length($1)-1), counts, ",");
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1141
		if (n != 2) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1142
		    error=2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1143
		    exit;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1144
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1145
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1146
		# 3,5c means lines 3 , 4 and 5 are changed, a total of 3 lines.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1147
		# following would be 5 - 3 = 2! Hence +1 for correction.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1148
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1149
		r=(counts[2]-counts[1])+1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1150
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1151
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1152
		# Now count replacement lines: each represents a change instead
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1153
		# of a delete, so increment c and decrement r.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1154
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1155
		while (getline != /^\.$/) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1156
			c++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1157
			r--;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1158
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1159
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1160
		# If there were more replacement lines than original lines,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1161
		# then r will be negative; in this case there are no deletions,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1162
		# but there are r changes that should be counted as adds, and
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1163
		# since r is negative, subtract it from a and add it to c.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1164
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1165
		if (r < 0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1166
			a-=r;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1167
			c+=r;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1168
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1169
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1170
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1171
		# If there were more original lines than replacement lines, then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1172
		# r will be positive; in this case, increment d by that much.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1173
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1174
		if (r > 0) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1175
			d+=r;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1176
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1177
		next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1178
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1179
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1180
	# Change lines: Nc
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1181
	/^[0-9].*c$/ {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1182
		# The first line is a replacement; any more are additions.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1183
		if (getline != /^\.$/) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1184
			c++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1185
			while (getline != /^\.$/) a++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1186
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1187
		next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1188
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1189
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1190
	# Add lines: both Na and N,Na
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1191
	/^[0-9].*a$/ {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1192
		while (getline != /^\.$/) a++;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1193
		next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1194
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1195
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1196
	# Delete range of lines: N,Nd
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1197
	/^[0-9]*,[0-9]*d$/ {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1198
		n=split(substr($1,1,length($1)-1), counts, ",");
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1199
		if (n != 2) {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1200
			error=2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1201
			exit;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1202
		}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1203
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1204
		# 3,5d means lines 3 , 4 and 5 are deleted, a total of 3 lines.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1205
		# following would be 5 - 3 = 2! Hence +1 for correction.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1206
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1207
		r=(counts[2]-counts[1])+1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1208
		d+=r;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1209
		next;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1210
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1211
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1212
	# Delete line: Nd.   For example 10d says line 10 is deleted.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1213
	/^[0-9]*d$/ {d++; next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1214
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1215
	# Should not get here!
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1216
	{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1217
		error=1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1218
		exit;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1219
	}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1220
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1221
	# Finish off - print results
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1222
	END {
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1223
		printf("tot=%d;mod=%d;del=%d;ins=%d;err=%d\n",
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1224
		    (c+d+a), c, d, a, error);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1225
	}' )
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1226
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1227
	# End of $AWK, Check to see if any trouble occurred.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1228
	if (( $? > 0 || err > 0 )); then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1229
		print "Unexpected Error occurred reading" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1230
		    "\`diff -e $1 $2\`: \$?=$?, err=" $err
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1231
		return
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1232
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1233
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1234
	# Accumulate totals
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1235
	(( TOTL += tot ))
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1236
	(( TMOD += mod ))
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1237
	(( TDEL += del ))
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1238
	(( TINS += ins ))
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1239
	# Calculate unchanged lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1240
	unc=`wc -l < $1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1241
	if (( unc > 0 )); then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1242
		(( unc -= del + mod ))
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1243
		(( TUNC += unc ))
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1244
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1245
	# print summary
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1246
	print "<span class=\"lineschanged\">\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1247
	printCI $tot $ins $del $mod $unc
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1248
	print "</span>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1249
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1250
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1251
function outgoing_from_mercurial_forest
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1252
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1253
    hg foutgoing --template 'rev: {rev}\n' $OUTPWS | $FILTER | $AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1254
        BEGIN           {ntree=0}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1255
        /^comparing/    {next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1256
        /^no changes/   {next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1257
        /^searching/    {next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1258
	/^\[.*\]$/	{tree=substr($1,2,length($1)-2);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1259
                         trees[ntree++] = tree;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1260
                         revs[tree]=-1;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1261
                         next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1262
        /^rev:/   {rev=$2+0;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1263
                   if (revs[tree] == -1 || rev < revs[tree])
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1264
                        { revs[tree] = rev; };
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1265
                  next;}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1266
        END       {for (tree in trees)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1267
                        { rev=revs[trees[tree]];
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1268
                          if (rev > 0)
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1269
                                {printf("%s %d\n",trees[tree],rev-1)}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1270
                        }}' | while read LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1271
    do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1272
        set - $LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1273
        TREE=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1274
        REV=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1275
        A=`hg -R $CWS/$TREE log --rev $REV --template '{node}'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1276
        FSTAT_OPT="--rev $A"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1277
        print "Revision: $A $REV" >> $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1278
        treestatus $TREE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1279
    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1280
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1281
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1282
function flist_from_mercurial_forest
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1283
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1284
    rm -f $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1285
    if [ -z "$Nflag" ]; then
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1286
        print " File list from hg foutgoing $PWS ..."
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1287
        outgoing_from_mercurial_forest
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1288
        HG_LIST_FROM_COMMIT=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1289
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1290
    if [ ! -f $FLIST ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1291
        # hg commit hasn't been run see what is lying around
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1292
        print "\n No outgoing, perhaps you haven't commited."
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1293
        print " File list from hg fstatus -mard ...\c"
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1294
        FSTAT_OPT=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1295
        fstatus
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  1296
        HG_LIST_FROM_COMMIT=
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1297
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1298
    print " Done."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1299
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1300
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1301
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1302
# Used when dealing with the result of 'hg foutgoing'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1303
# When now go down the tree and generate the change list
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1304
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1305
function treestatus
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1306
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1307
    TREE=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1308
    HGCMD="hg -R $CWS/$TREE status $FSTAT_OPT"
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1309
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1310
    $HGCMD -mdn 2>/dev/null | $FILTER | while read F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1311
    do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1312
        echo $TREE/$F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1313
    done >> $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1314
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1315
    # Then all the added files
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1316
    # But some of these could have been "moved" or renamed ones or copied ones
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1317
    # so let's make sure we get the proper info
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1318
    # hg status -aC will produce something like:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1319
    #	A subdir/File3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1320
    #	A subdir/File4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1321
    #	  File4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1322
    #	A subdir/File5
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1323
    # The first and last are simple addition while the middle one
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1324
    # is a move/rename or a copy.  We can't distinguish from a rename vs a copy
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1325
    # without also getting the status of removed files.  The middle case above
19754
76f369edc1ca 8024201: Update bugdatabase url
mduigou
parents: 16821
diff changeset
  1326
    # is a rename if File4 is also shown a being removed.  If File4 is not a
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1327
    # removed file, then the middle case is a copy from File4 to subdir/File4
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1328
    # FIXME - we're not distinguishing copy from rename
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1329
    $HGCMD -aC | $FILTER | while read LINE; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1330
	ldone=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1331
	while [ -z "$ldone" ]; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1332
	    ldone="1"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1333
	    set - $LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1334
	    if [ $# -eq 2 -a "$1" == "A" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1335
		AFILE=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1336
		if read LINE2; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1337
		    set - $LINE2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1338
		    if [ $# -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1339
			echo $TREE/$AFILE $TREE/$1 >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1340
		    elif [ $# -eq 2 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1341
			echo $TREE/$AFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1342
			LINE=$LINE2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1343
			ldone=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1344
		    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1345
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1346
		    echo $TREE/$AFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1347
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1348
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1349
	done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1350
    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1351
    $HGCMD -rn | $FILTER | while read RFILE; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1352
	grep "$TREE/$RFILE" $FLIST >/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1353
	if [ $? -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1354
	    echo $TREE/$RFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1355
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1356
    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1357
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1358
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1359
function fstatus
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1360
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1361
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1362
    # forest extension is still being changed. For instance the output
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1363
    # of fstatus used to no prepend the tree path to filenames, but
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1364
    # this has changed recently. AWK code below does try to handle both
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1365
    # cases
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1366
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1367
    hg fstatus -mdn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1368
	/^\[.*\]$/	{tree=substr($1,2,length($1)-2); next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1369
	$1 != ""	{n=index($1,tree);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1370
			 if (n == 0)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1371
				{ printf("%s/%s\n",tree,$1)}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1372
			 else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1373
				{ printf("%s\n",$1)}}' >> $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1374
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1375
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1376
    # There is a bug in the output of fstatus -aC on recent versions: it
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1377
    # inserts a space between the name of the tree and the filename of the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1378
    # old file. e.g.:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1379
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1380
    # $ hg fstatus -aC
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1381
    # [.]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1382
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1383
    # [MyWS]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1384
    # A MyWS/subdir/File2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1385
    #  MyWS/ File2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1386
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1387
    # [MyWS2]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1388
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1389
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1390
    hg fstatus -aC $FSTAT_OPT 2>/dev/null | $FILTER | $AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1391
	/^\[.*\]$/	{tree=substr($1,2,length($1)-2); next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1392
	/^A .*/		{n=index($2,tree);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1393
			 if (n == 0)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1394
				{ printf("A %s/%s\n",tree,$2)}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1395
			 else
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1396
				{ printf("A %s\n",$2)};
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1397
			 next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1398
	/^ /		{n=index($1,tree);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1399
			 if (n == 0)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1400
				{ printf("%s/%s\n",tree,$1)}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1401
			 else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1402
				{ if (NF == 2)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1403
					printf("%s/%s\n",tree,$2)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1404
				  else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1405
					printf("%s\n",$1)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1406
				};
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1407
			 next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1408
	' | while read LINE; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1409
	ldone=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1410
	while [ -z "$ldone" ]; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1411
	    ldone="1"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1412
	    set - $LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1413
	    if [ $# -eq 2 -a "$1" == "A" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1414
		AFILE=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1415
		if read LINE2; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1416
		    set - $LINE2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1417
		    if [ $# -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1418
			echo $AFILE $1 >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1419
		    elif [ $# -eq 2 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1420
			echo $AFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1421
			LINE=$LINE2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1422
			ldone=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1423
		    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1424
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1425
		    echo $AFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1426
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1427
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1428
	done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1429
    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1430
    hg fstatus -rn $FSTAT_OPT 2>/dev/null | $FILTER | $AWK '
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1431
	/^\[.*\]$/	{tree=substr($1,2,length($1)-2); next}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1432
	$1 != ""	{n=index($1,tree);
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1433
			 if (n == 0)
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1434
				{ printf("%s/%s\n",tree,$1)}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1435
			 else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1436
				{ printf("%s\n",$1)}}' | while read RFILE; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1437
	grep "$RFILE" $FLIST >/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1438
	if [ $? -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1439
	    echo $RFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1440
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1441
    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1442
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1443
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1444
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1445
# flist_from_mercurial $PWS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1446
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1447
# Only local file based repositories are supported at present
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1448
# since even though we can determine the list from the parent finding
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1449
# the changes is harder.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1450
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1451
# We first look for any outgoing files, this is for when the user has
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1452
# run hg commit.  If we don't find any then we look with hg status.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1453
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1454
# We need at least one of default-push or default paths set in .hg/hgrc
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1455
# If neither are set we don't know who to compare with.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1456
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1457
function flist_from_mercurial
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1458
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1459
#	if [ "${PWS##ssh://}" != "$PWS" -o \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1460
#	     "${PWS##http://}" != "$PWS" -o \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1461
#	     "${PWS##https://}" != "$PWS" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1462
#		print "Remote Mercurial repositories not currently supported."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1463
#		print "Set default and/or default-push to a local repository"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1464
#		exit
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1465
#	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1466
    if [[ -n $forestflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1467
        HG_LIST_FROM_COMMIT=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1468
	flist_from_mercurial_forest
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1469
    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1470
        STATUS_REV=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1471
        if [[ -n $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1472
            STATUS_REV="--rev $PARENT_REV"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1473
        elif [[ -n $OUTREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1474
            STATUS_REV="--rev $OUTREV"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1475
        else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1476
            # hg commit hasn't been run see what is lying around
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1477
            print "\n No outgoing, perhaps you haven't commited."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1478
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1479
	# First let's list all the modified or deleted files
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1480
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1481
	hg status $STATUS_REV -mdn | $FILTER > $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1482
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1483
	# Then all the added files
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1484
	# But some of these could have been "moved" or renamed ones
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1485
	# so let's make sure we get the proper info
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1486
	# hg status -aC will produce something like:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1487
	#	A subdir/File3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1488
	#	A subdir/File4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1489
	#	  File4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1490
	#	A subdir/File5
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1491
        # The first and last are simple addition while the middle one
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1492
        # is a move/rename or a copy.  We can't distinguish from a rename vs a copy
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1493
        # without also getting the status of removed files.  The middle case above
19754
76f369edc1ca 8024201: Update bugdatabase url
mduigou
parents: 16821
diff changeset
  1494
        # is a rename if File4 is also shown a being removed.  If File4 is not a
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1495
        # removed file, then the middle case is a copy from File4 to subdir/File4
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1496
        # FIXME - we're not distinguishing copy from rename
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1497
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1498
	hg status $STATUS_REV -aC | $FILTER >$FLIST.temp
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1499
	while read LINE; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1500
	    ldone=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1501
	    while [ -z "$ldone" ]; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1502
		ldone="1"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1503
		set - $LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1504
		if [ $# -eq 2 -a "$1" == "A" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1505
		    AFILE=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1506
		    if read LINE2; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1507
			set - $LINE2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1508
			if [ $# -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1509
			    echo $AFILE $1 >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1510
			elif [ $# -eq 2 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1511
			    echo $AFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1512
			    LINE=$LINE2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1513
			    ldone=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1514
			fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1515
		    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1516
			echo $AFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1517
		    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1518
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1519
	    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1520
	done < $FLIST.temp
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1521
	hg status $STATUS_REV -rn | $FILTER > $FLIST.temp
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1522
	while read RFILE; do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1523
	    grep "$RFILE" $FLIST >/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1524
	    if [ $? -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1525
		echo $RFILE >>$FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1526
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1527
	done < $FLIST.temp
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1528
	rm -f $FLIST.temp
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1529
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1530
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1531
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1532
function env_from_flist
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1533
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1534
	[[ -r $FLIST ]] || return
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1535
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1536
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1537
	# Use "eval" to set env variables that are listed in the file
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1538
	# list.  Then copy those into our local versions of those
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1539
	# variables if they have not been set already.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1540
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1541
	eval `sed -e "s/#.*$//" $FLIST | grep = `
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1542
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1543
	[[ -z $codemgr_ws && -n $CODEMGR_WS ]] && codemgr_ws=$CODEMGR_WS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1544
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1545
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1546
	# Check to see if CODEMGR_PARENT is set in the flist file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1547
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1548
	[[ -z $codemgr_parent && -n $CODEMGR_PARENT ]] && \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1549
	    codemgr_parent=$CODEMGR_PARENT
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1550
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1551
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1552
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1553
# detect_scm
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1554
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1555
# We dynamically test the SCM type; this allows future extensions to
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1556
# new SCM types
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1557
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1558
function detect_scm
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1559
{
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1560
	if hg root >/dev/null ; then
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1561
		print "mercurial"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1562
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1563
		print "unknown"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1564
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1565
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1566
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1567
function look_for_prog
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1568
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1569
	typeset path
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1570
	typeset ppath
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1571
	typeset progname=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1572
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1573
	DEVTOOLS=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1574
	OS=`uname`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1575
	if [[ "$OS" == "SunOS" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1576
	    DEVTOOLS="/java/devtools/`uname -p`/bin"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1577
	elif [[ "$OS" == "Linux" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1578
	    DEVTOOLS="/java/devtools/linux/bin"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1579
	fi
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1580
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1581
	ppath=$PATH
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1582
	ppath=$ppath:/usr/sfw/bin:/usr/bin:/usr/sbin
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1583
	ppath=$ppath:/opt/teamware/bin:/opt/onbld/bin
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1584
	ppath=$ppath:/opt/onbld/bin/`uname -p`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1585
	ppath=$ppath:/java/devtools/share/bin:$DEVTOOLS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1586
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1587
	PATH=$ppath prog=`whence $progname`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1588
	if [[ -n $prog ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1589
		print $prog
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1590
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1591
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1592
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1593
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1594
# Find the parent for $1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1595
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1596
function find_outrev
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1597
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1598
    crev=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1599
    prev=`hg log -r $crev --template '{parents}\n'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1600
    if [[ -z "$prev" ]]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1601
    then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1602
	# No specific parent means previous changeset is parent
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1603
	prev=`expr $crev - 1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1604
    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1605
	# Format is either of the following two:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1606
	# 546:7df6fcf1183b
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1607
	# 548:16f1915bb5cd 547:ffaa4e775815
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1608
	prev=`echo $prev | sed -e 's/\([0-9]*\):.*/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1609
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1610
    print $prev
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1611
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1612
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1613
function extract_ssh_infos
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1614
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1615
    CMD=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1616
    if expr "$CMD" : 'ssh://[^/]*@' >/dev/null; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1617
	ssh_user=`echo $CMD | sed -e 's/ssh:\/\/\(.*\)@.*/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1618
	ssh_host=`echo $CMD | sed -e 's/ssh:\/\/.*@\([^/]*\)\/.*/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1619
	ssh_dir=`echo $CMD | sed -e 's/ssh:\/\/.*@[^/]*\/\(.*\)/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1620
    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1621
	ssh_user=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1622
	ssh_host=`echo $CMD | sed -e 's/ssh:\/\/\([^/]*\)\/.*/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1623
	ssh_dir=`echo $CMD | sed -e 's/ssh:\/\/[^/]*\/\(.*\)/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1624
    fi
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1625
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1626
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1627
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1628
function build_old_new_mercurial
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1629
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1630
	olddir=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1631
	newdir=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1632
	DIR=$3
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1633
	F=$4
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1634
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1635
	# new version of the file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1636
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1637
	rm -rf $newdir/$DIR/$F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1638
	if [ -f $F ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1639
	    cp $F  $newdir/$DIR/$F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1640
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1641
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1642
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1643
	# Old version of the file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1644
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1645
	rm -rf $olddir/$DIR/$F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1646
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1647
	if [ -n "$PWS" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1648
	    if expr "$PWS" : 'ssh://' >/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1649
	    then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1650
		extract_ssh_infos $PWS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1651
		if [ -n "$ssh_user" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1652
		    parent="ssh -l $ssh_user $ssh_host hg -R $ssh_dir --cwd $ssh_dir"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1653
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1654
		    parent="ssh $ssh_host hg -R $ssh_dir --cwd $ssh_dir"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1655
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1656
	    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1657
		parent="hg -R $PWS --cwd $PWS"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1658
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1659
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1660
	    parent=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1661
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1662
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1663
	if [ -z "$rename" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1664
	    if [ -n "$rflag" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1665
		parentrev=$PARENT_REV
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1666
	    elif [ "$HG_LIST_FROM_COMMIT" -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1667
                parentrev=$OUTREV
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1668
	    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1669
                if [[ -n $HG_BRANCH ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1670
                    parentrev=$HG_BRANCH
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1671
                else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1672
		    parentrev="tip"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1673
                fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1674
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1675
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1676
	    if [ -n "$parentrev" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1677
		if [ -z "$parent" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1678
		    hg cat --rev $parentrev --output $olddir/$DIR/$F $F 2>/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1679
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1680
		    # when specifying a workspace we have to provide
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1681
		    # the full path
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1682
		    $parent cat --rev $parentrev --output $olddir/$DIR/$F $DIR/$F 2>/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1683
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1684
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1685
	else
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  1686
	    # It's a rename (or a move), or a copy, so let's make sure we move
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1687
	    # to the right directory first, then restore it once done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1688
	    current_dir=`pwd`
21511
4be11da17625 8027836: Webrev should handle files that has been moved from a directory which now is removed.
ihse
parents: 20637
diff changeset
  1689
	    hg_root=`hg root`
4be11da17625 8027836: Webrev should handle files that has been moved from a directory which now is removed.
ihse
parents: 20637
diff changeset
  1690
	    cd $CWS
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1691
	    if [ -n "$rflag" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1692
		parentrev=$PARENT_REV
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1693
	    elif [ "$HG_LIST_FROM_COMMIT" -eq 1 ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1694
                parentrev=$OUTREV
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1695
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1696
	    if [ -z "$parentrev" ]; then
21511
4be11da17625 8027836: Webrev should handle files that has been moved from a directory which now is removed.
ihse
parents: 20637
diff changeset
  1697
		parentrev=`hg log -l1 $PDIR/$PF | $AWK -F: '/changeset/ {print $2}'`
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1698
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1699
	    if [ -n "$parentrev" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1700
		mkdir -p $olddir/$PDIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1701
		if [ -z "$parent" ]; then
21511
4be11da17625 8027836: Webrev should handle files that has been moved from a directory which now is removed.
ihse
parents: 20637
diff changeset
  1702
		    hg cat -R $hg_root --rev $parentrev --output $olddir/$PDIR/$PF $PDIR/$PF 2>/dev/null
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1703
		else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1704
		    $parent cat --rev $parentrev --output $olddir/$PDIR/$PF $PDIR/$PF 2>/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1705
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1706
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1707
	    cd $current_dir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1708
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1709
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1710
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1711
function build_old_new
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1712
{
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1713
	if [[ $SCM_MODE == "mercurial" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1714
		build_old_new_mercurial $@
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1715
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1716
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1717
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1718
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1719
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1720
# Usage message.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1721
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1722
function usage
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1723
{
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1724
	print "Usage:\twebrev [options]
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1725
	webrev [options] ( <file> | - )
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1726
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1727
Options:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1728
	-v: Print the version of this tool.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1729
        -b: Do not ignore changes in the amount of white space.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1730
        -c <CR#>: Include link to CR (aka bugid) in the main page.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1731
	-i <filename>: Include <filename> in the index.html file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1732
	-o <outdir>: Output webrev to specified directory.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1733
	-p <compare-against>: Use specified parent wkspc or basis for comparison
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1734
        -u <username>: Use that username instead of 'guessing' one.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1735
	-m: Forces the use of Mercurial
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1736
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1737
Mercurial only options:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1738
	-r rev: Compare against a specified revision
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1739
	-N: Skip 'hg outgoing', use only 'hg status'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1740
	-f: Use the forest extension
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1741
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1742
Arguments:
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1743
	<file>: Optional file containing list of files to include in webrev
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1744
        -: read list of files to include in webrev from standard input
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1745
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1746
Environment:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1747
	WDIR: Control the output directory.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1748
	WEBREV_BUGURL: Control the URL prefix for bugids.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1749
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1750
"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1751
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1752
	exit 2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1753
}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1754
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1755
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1756
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1757
# Main program starts here
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1758
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1759
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1760
LANG="C"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1761
LC_ALL="C"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1762
export LANG LC_ALL
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1763
trap "rm -f /tmp/$$.* ; exit" 0 1 2 3 15
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1764
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1765
set +o noclobber
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1766
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1767
[[ -z $WDIFF ]] && WDIFF=`look_for_prog wdiff`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1768
[[ -z $CODEREVIEW ]] && CODEREVIEW=`look_for_prog codereview`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1769
[[ -z $PS2PDF ]] && PS2PDF=`look_for_prog ps2pdf`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1770
[[ -z $PERL ]] && PERL=`look_for_prog perl`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1771
[[ -z $SCCS ]] && SCCS=`look_for_prog sccs`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1772
[[ -z $AWK ]] && AWK=`look_for_prog nawk`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1773
[[ -z $AWK ]] && AWK=`look_for_prog gawk`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1774
[[ -z $AWK ]] && AWK=`look_for_prog awk`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1775
[[ -z $JAR ]] && JAR=`look_for_prog jar`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1776
[[ -z $ZIP ]] && ZIP=`look_for_prog zip`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1777
[[ -z $GETENT ]] && GETENT=`look_for_prog getent`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1778
[[ -z $WGET ]] && WGET=`look_for_prog wget`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1779
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1780
if uname | grep CYGWIN >/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1781
then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1782
        ISWIN=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1783
        # Under windows mercurial outputs '\' instead of '/'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1784
        FILTER="tr '\\\\' '/'"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1785
else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1786
        FILTER="cat"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1787
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1788
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1789
if [[ ! -x $PERL ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1790
	print -u2 "Error: No perl interpreter found.  Exiting."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1791
	exit 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1792
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1793
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1794
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1795
# These aren't fatal, but we want to note them to the user.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1796
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1797
# [[ ! -x $CODEREVIEW ]] && print -u2 "WARNING: codereview(1) not found."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1798
# [[ ! -x $PS2PDF ]] && print -u2 "WARNING: ps2pdf(1) not found."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1799
# [[ ! -x $WDIFF ]] && print -u2 "WARNING: wdiff not found."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1800
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1801
# Declare global total counters.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1802
integer TOTL TINS TDEL TMOD TUNC
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1803
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1804
flist_mode=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1805
flist_file=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1806
bflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1807
iflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1808
oflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1809
pflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1810
uflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1811
Oflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1812
rflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1813
Nflag=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1814
forestflag=
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1815
while getopts "c:i:o:p:r:u:mONvfb" opt
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1816
do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1817
	case $opt in
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1818
        b)      bflag=1;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1819
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1820
	i)	iflag=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1821
		INCLUDE_FILE=$OPTARG;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1822
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1823
	o)	oflag=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1824
		WDIR=$OPTARG;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1825
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1826
	p)	pflag=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1827
		codemgr_parent=$OPTARG;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1828
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1829
	u)      uflag=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1830
		username=$OPTARG;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1831
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1832
        c)      if [[ -z $CRID ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1833
                   CRID=$OPTARG
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1834
                else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1835
                   CRID="$CRID $OPTARG"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1836
                fi;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1837
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1838
	m)	SCM_MODE="mercurial";;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1839
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1840
	O)	Oflag=1;; # ignored (bugs are now all visible at bugs.openjdk.java.net)
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1841
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1842
	N)	Nflag=1;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1843
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1844
	f)	forestflag=1;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1845
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1846
	r)	rflag=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1847
		PARENT_REV=$OPTARG;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1848
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1849
	v)	print "$0 version: $WEBREV_UPDATED";;
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  1850
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1851
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1852
	?)	usage;;
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1853
	esac
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1854
done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1855
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1856
FLIST=/tmp/$$.flist
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  1857
HG_LIST_FROM_COMMIT=
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1858
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1859
if [[ -n $forestflag && -n $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1860
    print "The -r <rev> flag is incompatible with the use of forests"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1861
    exit 2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1862
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1863
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1864
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1865
# If this manually set as the parent, and it appears to be an earlier webrev,
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1866
# then note that fact and set the parent to the raw_files/new subdirectory.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1867
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1868
if [[ -n $pflag && -d $codemgr_parent/raw_files/new ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1869
	parent_webrev="$codemgr_parent"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1870
	codemgr_parent="$codemgr_parent/raw_files/new"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1871
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1872
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1873
shift $(($OPTIND - 1))
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1874
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1875
if [[ $1 == "-" ]]; then
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1876
	cat > $FLIST
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1877
	flist_mode="stdin"
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1878
	flist_done=1
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1879
	shift
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1880
elif [[ -n $1 ]]; then
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1881
	if [[ ! -r $1 ]]; then
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1882
		print -u2 "$1: no such file or not readable"
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1883
		usage
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1884
	fi
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1885
	cat $1 > $FLIST
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1886
	flist_mode="file"
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1887
	flist_file=$1
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1888
	flist_done=1
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1889
	shift
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1890
else
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1891
	flist_mode="auto"
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1892
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1893
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1894
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1895
# Before we go on to further consider -l and -w, work out which SCM we think
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1896
# is in use.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1897
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1898
if [[ -z $SCM_MODE ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1899
    SCM_MODE=`detect_scm $FLIST`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1900
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1901
if [[ $SCM_MODE == "unknown" ]]; then
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1902
       print -u2 "Unable to determine SCM type currently in use."
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1903
       print -u2 "For mercurial: webrev runs 'hg root'."
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1904
       exit 1
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1905
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1906
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1907
print -u2 "   SCM detected: $SCM_MODE"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1908
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1909
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1910
if [[ $SCM_MODE == "mercurial" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1911
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1912
    # determine Workspace and parent workspace paths
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1913
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1914
    CWS=`hg root | $FILTER`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1915
    if [[ -n $pflag && -z "$PWS" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1916
	OUTPWS=$codemgr_parent
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1917
        # Let's try to expand it if it's an alias defined in [paths]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1918
        tmp=`hg path $OUTPWS 2>/dev/null | $FILTER`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1919
        if [[ -n $tmp ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1920
            OUTPWS="$tmp"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1921
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1922
        if [[ -n $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1923
	    if expr "$codemgr_parent" : 'ssh://.*' >/dev/null; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1924
	        PWS=$codemgr_parent
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1925
	    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1926
	        PWS=`hg -R "$codemgr_parent" root 2>/dev/null | $FILTER`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1927
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1928
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1929
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1930
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1931
    # OUTPWS is the parent repository to use when using 'hg outgoing'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1932
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1933
    if [[ -z $Nflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1934
        if [[ -n $forestflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1935
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1936
            # for forest we have to rely on properly set default and
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1937
            # default-push because they can be different from the top one.
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  1938
            # unless of course it was explicitly specified with -p
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1939
            if [[ -z $pflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1940
                OUTPWS=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1941
            fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1942
        else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1943
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1944
            # Unfortunately mercurial is bugged and doesn't handle
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1945
            # aliases correctly in 'hg path default'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1946
            # So let's do it ourselves. Sigh...
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1947
            if [[ -z "$OUTPWS" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1948
                OUTPWS=`grep default-push $CWS/.hg/hgrc | $AWK '{print $3}' | $FILTER`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1949
            fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1950
            # Still empty, means no default-push
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1951
            if [[ -z "$OUTPWS" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1952
                OUTPWS=`grep 'default =' $CWS/.hg/hgrc | $AWK '{print $3}' | $FILTER`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1953
            fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1954
            # Let's try to expand it if it's an alias defined in [paths]
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1955
            tmp=`hg path $OUTPWS 2>/dev/null | $FILTER`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1956
            if [[ -n $tmp ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1957
                OUTPWS="$tmp"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1958
            fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1959
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1960
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1961
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1962
    # OUTPWS may contain username:password, let's make sure we remove the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1963
    # sensitive information before we print out anything in the HTML
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1964
    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1965
    OUTPWS2=$OUTPWS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1966
    if [[ -n $OUTPWS ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1967
	if [[ `expr "$OUTPWS" : '.*://[^/]*@.*'` -gt 0 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1968
	    # Remove everything between '://' and '@'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1969
	    OUTPWS2=`echo $OUTPWS | sed -e 's/\(.*:\/\/\).*@\(.*\)/\1\2/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1970
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1971
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1972
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1973
    if [[ -z $HG_BRANCH ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1974
        HG_BRANCH=`hg branch`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1975
        if [ "$HG_BRANCH" == "default" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1976
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1977
            # 'default' means no particular branch, so let's cancel that
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1978
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1979
            HG_BRANCH=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1980
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1981
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1982
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1983
    if [[ -z $forestflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1984
        if [[ -z $Nflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1985
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1986
            # If no "-N", always do "hg outgoing" against parent
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1987
            # repository to determine list of outgoing revisions.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1988
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1989
            ALL_CREV=`hg outgoing -q --template '{rev}\n' $OUTPWS | sort -n`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1990
            if [[ -n $ALL_CREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1991
                FIRST_CREV=`echo "$ALL_CREV" | head -1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1992
                #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1993
                # If no "-r", choose revision to compare against by
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1994
                # finding the latest revision not in the outgoing list.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1995
                #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1996
                if [[ -z $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1997
                    OUTREV=`find_outrev "$FIRST_CREV"`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1998
                    if [[ -n $OUTREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  1999
                        HG_LIST_FROM_COMMIT=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2000
                    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2001
                fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2002
            fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2003
        elif [[ -n $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2004
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2005
            # If skipping "hg outgoing" but still comparing against a
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2006
            # specific revision (not the tip), set revision for comment
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2007
            # accumulation.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2008
            #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2009
            FIRST_CREV=`hg log --rev $PARENT_REV --template '{rev}'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2010
            FIRST_CREV=`expr $FIRST_CREV + 1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2011
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2012
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2013
    #Let's check if a merge is needed, if so, issue a warning
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2014
    PREV=`hg parent | grep '^tag:.*tip$'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2015
    if [[ -z $PREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2016
        print "WARNING: parent rev is not tip. Maybe an update or merge is needed"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2017
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2018
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2019
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2020
if [[ $flist_mode == "stdin" ]]; then
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2021
	print -u2 " File list from: standard input"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2022
elif [[ $flist_mode == "file" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2023
	print -u2 " File list from: $flist_file"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2024
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2025
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2026
if [[ $# -gt 0 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2027
	print -u2 "WARNING: unused arguments: $*"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2028
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2029
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2030
if [[ $SCM_MODE == "mercurial" ]]; then
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2031
    if [[ -z $flist_done ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2032
	flist_from_mercurial $PWS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2033
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2034
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2035
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2036
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2037
# If the user didn't specify a -i option, check to see if there is a
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2038
# webrev-info file in the workspace directory.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2039
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2040
if [[ -z $iflag && -r "$CWS/webrev-info" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2041
	iflag=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2042
	INCLUDE_FILE="$CWS/webrev-info"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2043
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2044
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2045
if [[ -n $iflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2046
	if [[ ! -r $INCLUDE_FILE ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2047
		print -u2 "include file '$INCLUDE_FILE' does not exist or is" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2048
		    "not readable."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2049
		exit 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2050
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2051
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2052
		# $INCLUDE_FILE may be a relative path, and the script alters
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2053
		# PWD, so we just stash a copy in /tmp.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2054
		#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2055
		cp $INCLUDE_FILE /tmp/$$.include
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2056
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2057
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2058
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2059
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2060
# Output directory.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2061
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2062
if [[ -z $WDIR ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2063
    WDIR=$CWS/webrev
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2064
else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2065
    # If the output directory doesn't end with '/webrev' or '/webrev/'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2066
    # then add '/webrev'. This is for backward compatibility
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2067
    if ! expr $WDIR : '.*/webrev/\?$' >/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2068
    then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2069
	WDIR=$WDIR/webrev
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2070
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2071
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2072
# WDIR=${WDIR:-$CWS/webrev}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2073
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2074
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2075
# Name of the webrev, derived from the workspace name; in the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2076
# future this could potentially be an option.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2077
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2078
# Let's keep what's after the last '/'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2079
WNAME=${CWS##*/}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2080
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2081
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2082
# If WDIR doesn't start with '/' or 'x:' prepend the current dir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2083
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2084
if [ ${WDIR%%/*} ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2085
    if [[ -n $ISWIN ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2086
        if [ ${WDIR%%[A-Za-z]:*} ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2087
	    WDIR=$PWD/$WDIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2088
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2089
    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2090
	WDIR=$PWD/$WDIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2091
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2092
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2093
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2094
if [[ ! -d $WDIR ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2095
	mkdir -p $WDIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2096
	[[ $? != 0 ]] && exit 1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2097
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2098
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2099
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2100
# Summarize what we're going to do.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2101
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2102
print "      Workspace: $CWS"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2103
if [[ -n $parent_webrev ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2104
    print "Compare against: webrev at $parent_webrev"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2105
elif [[ -n $OUTPWS2 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2106
    print "Compare against: $OUTPWS2"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2107
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2108
if [[ -n $HG_BRANCH ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2109
    print "         Branch: $HG_BRANCH"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2110
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2111
if [[ -n $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2112
        print "Compare against version: $PARENT_REV"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2113
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2114
[[ -n $INCLUDE_FILE ]] && print "      Including: $INCLUDE_FILE"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2115
print "      Output to: $WDIR"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2116
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2117
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2118
# Save the file list in the webrev dir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2119
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2120
[[ ! $FLIST -ef $WDIR/file.list ]] && cp $FLIST $WDIR/file.list
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2121
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2122
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2123
#    Bug IDs will be replaced by a URL.  Order of precedence
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2124
#    is: default location, $WEBREV_BUGURL
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2125
#
19754
76f369edc1ca 8024201: Update bugdatabase url
mduigou
parents: 16821
diff changeset
  2126
BUGURL='https://bugs.openjdk.java.net/browse/'
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2127
[[ -n $WEBREV_BUGURL ]] && BUGURL="$WEBREV_BUGURL"
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2128
IDPREFIX='JDK-'
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2129
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2130
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2131
rm -f $WDIR/$WNAME.patch
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  2132
rm -f $WDIR/$WNAME.changeset
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2133
rm -f $WDIR/$WNAME.ps
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2134
rm -f $WDIR/$WNAME.pdf
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2135
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2136
touch $WDIR/$WNAME.patch
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2137
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2138
print "   Output Files:"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2139
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2140
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2141
# Clean up the file list: Remove comments, blank lines and env variables.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2142
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2143
sed -e "s/#.*$//" -e "/=/d" -e "/^[   ]*$/d" $FLIST > /tmp/$$.flist.clean
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2144
FLIST=/tmp/$$.flist.clean
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2145
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2146
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2147
# Clean up residual raw files
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2148
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2149
if [ -d $WDIR/raw_files ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2150
    rm -rf $WDIR/raw_files 2>/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2151
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2152
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2153
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2154
# Should we ignore changes in white spaces when generating diffs?
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2155
#
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2156
if [[ -n $bflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2157
    DIFFOPTS="-t"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2158
else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2159
    DIFFOPTS="-bt"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2160
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2161
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2162
# First pass through the files: generate the per-file webrev HTML-files.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2163
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2164
while read LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2165
do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2166
	set - $LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2167
	P=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2168
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2169
        if [[ $1 == "Revision:" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2170
            OUTREV=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2171
            continue
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2172
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2173
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2174
	# Normally, each line in the file list is just a pathname of a
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2175
	# file that has been modified or created in the child.  A file
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2176
	# that is renamed in the child workspace has two names on the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2177
	# line: new name followed by the old name.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2178
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2179
	oldname=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2180
	oldpath=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2181
	rename=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2182
	if [[ $# -eq 2 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2183
		PP=$2			# old filename
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2184
		oldname=" (was $PP)"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2185
		oldpath="$PP"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2186
		rename=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2187
        	PDIR=${PP%/*}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2188
        	if [[ $PDIR == $PP ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2189
			PDIR="."   # File at root of workspace
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2190
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2191
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2192
		PF=${PP##*/}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2193
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2194
	        DIR=${P%/*}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2195
	        if [[ $DIR == $P ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2196
			DIR="."   # File at root of workspace
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2197
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2198
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2199
		F=${P##*/}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2200
        else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2201
	        DIR=${P%/*}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2202
	        if [[ "$DIR" == "$P" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2203
			DIR="."   # File at root of workspace
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2204
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2205
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2206
		F=${P##*/}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2207
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2208
		PP=$P
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2209
		PDIR=$DIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2210
		PF=$F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2211
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2212
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2213
        # Make the webrev directory if necessary as it may have been
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2214
        # removed because it was empty
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2215
        if [ ! -d $CWS/$DIR ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2216
	    mkdir -p $CWS/$DIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2217
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2218
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2219
	COMM=`getcomments html $P $PP`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2220
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2221
	print "\t$P$oldname\n\t\t\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2222
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2223
	# Make the webrev mirror directory if necessary
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2224
	mkdir -p $WDIR/$DIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2225
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2226
	# cd to the directory so the names are short
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2227
	cd $CWS/$DIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2228
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2229
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2230
	# We stash old and new files into parallel directories in /tmp
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2231
	# and do our diffs there.  This makes it possible to generate
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2232
	# clean looking diffs which don't have absolute paths present.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2233
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2234
	olddir=$WDIR/raw_files/old
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2235
	newdir=$WDIR/raw_files/new
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2236
	mkdir -p $olddir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2237
	mkdir -p $newdir
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2238
	mkdir -p $olddir/$PDIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2239
	mkdir -p $newdir/$DIR
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2240
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2241
	build_old_new $olddir $newdir $DIR $F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2242
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2243
	if [[ ! -f $F && ! -f $olddir/$DIR/$F ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2244
		print "*** Error: file not in parent or child"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2245
		continue
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2246
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2247
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2248
	cd $WDIR/raw_files
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2249
	ofile=old/$PDIR/$PF
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2250
	nfile=new/$DIR/$F
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2251
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2252
	mv_but_nodiff=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2253
	cmp $ofile $nfile > /dev/null 2>&1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2254
	if [[ $? == 0 && $rename == 1 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2255
		mv_but_nodiff=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2256
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2257
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2258
        #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2259
        # Cleaning up
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2260
        #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2261
        rm -f $WDIR/$DIR/$F.cdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2262
        rm -f $WDIR/$DIR/$F.udiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2263
        rm -f $WDIR/$DIR/$F.wdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2264
        rm -f $WDIR/$DIR/$F.sdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2265
        rm -f $WDIR/$DIR/$F-.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2266
        rm -f $WDIR/$DIR/$F.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2267
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2268
	its_a_jar=
20274
b76b26641346 8025920: webrev.ksh does not provide any details about changes in zip files
thurka
parents: 19754
diff changeset
  2269
	if expr $F : '.*\.jar' \| $F : '.*\.zip' >/dev/null; then
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2270
	    its_a_jar=1
20274
b76b26641346 8025920: webrev.ksh does not provide any details about changes in zip files
thurka
parents: 19754
diff changeset
  2271
	    # It's a JAR or ZIP file, let's do it differently
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2272
	    if [[ -z $JAR ]]; then
20274
b76b26641346 8025920: webrev.ksh does not provide any details about changes in zip files
thurka
parents: 19754
diff changeset
  2273
		print "No access to jar, so can't produce diffs for jar or zip files"
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2274
	    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2275
		if [ -f $ofile ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2276
		    $JAR -tvf $ofile >"$ofile".lst
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2277
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2278
		if [ -f $nfile ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2279
		    $JAR -tvf $nfile >"$nfile".lst
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2280
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2281
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2282
		if [[ -f $ofile && -f $nfile && -z $mv_but_nodiff ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2283
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2284
		    ${CDIFFCMD:-diff -bt -C 5} $ofile.lst $nfile.lst > $WDIR/$DIR/$F.cdiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2285
		    diff_to_html $F $DIR/$F "C" "$COMM" < $WDIR/$DIR/$F.cdiff \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2286
			> $WDIR/$DIR/$F.cdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2287
		    print " cdiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2288
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2289
		    ${UDIFFCMD:-diff -bt -U 5} $ofile.lst $nfile.lst > $WDIR/$DIR/$F.udiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2290
		    diff_to_html $F $DIR/$F "U" "$COMM" < $WDIR/$DIR/$F.udiff \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2291
			> $WDIR/$DIR/$F.udiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2292
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2293
		    print " udiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2294
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2295
		    if [[ -x $WDIFF ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2296
			$WDIFF -c "$COMM" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2297
			    -t "$WNAME Wdiff $DIR/$F" $ofile.lst $nfile.lst > \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2298
			    $WDIR/$DIR/$F.wdiff.html 2>/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2299
			if [[ $? -eq 0 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2300
			    print " wdiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2301
			else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2302
			    print " wdiffs[fail]\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2303
			fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2304
		    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2305
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2306
		    sdiff_to_html $ofile $nfile $F $DIR "$COMM" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2307
			> $WDIR/$DIR/$F.sdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2308
		    print " sdiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2309
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2310
		    print " frames\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2311
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2312
		    rm -f $WDIR/$DIR/$F.cdiff $WDIR/$DIR/$F.udiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2313
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2314
		    difflines $ofile.lst $nfile.lst > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2315
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2316
		elif [[ -f $ofile && -f $nfile && -n $mv_but_nodiff ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2317
		# renamed file: may also have differences
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2318
		    difflines $ofile.lst $nfile.lst > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2319
		elif [[ -f $nfile ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2320
		# new file: count added lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2321
		    difflines /dev/null $nfile.lst > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2322
		elif [[ -f $ofile ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2323
		# old file: count deleted lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2324
		    difflines $ofile.lst /dev/null > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2325
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2326
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2327
	else
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2328
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2329
	    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2330
	    # If we have old and new versions of the file then run the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2331
	    # appropriate diffs.  This is complicated by a couple of factors:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2332
	    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2333
	    #	- renames must be handled specially: we emit a 'remove'
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2334
	    #	  diff and an 'add' diff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2335
	    #	- new files and deleted files must be handled specially
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2336
	    #	- Solaris patch(1m) can't cope with file creation
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2337
	    #	  (and hence renames) as of this writing.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2338
	    #   - To make matters worse, gnu patch doesn't interpret the
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2339
	    #	  output of Solaris diff properly when it comes to
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2340
	    #	  adds and deletes.  We need to do some "cleansing"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2341
	    #     transformations:
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2342
	    # 	    [to add a file] @@ -1,0 +X,Y @@  -->  @@ -0,0 +X,Y @@
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2343
	    #	    [to del a file] @@ -X,Y +1,0 @@  -->  @@ -X,Y +0,0 @@
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2344
	    #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2345
	    cleanse_rmfile="sed 's/^\(@@ [0-9+,-]*\) [0-9+,-]* @@$/\1 +0,0 @@/'"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2346
	    cleanse_newfile="sed 's/^@@ [0-9+,-]* \([0-9+,-]* @@\)$/@@ -0,0 \1/'"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2347
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  2348
            if [[ ! "$HG_LIST_FROM_COMMIT" -eq 1 || ! $flist_mode == "auto" ]];
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2349
            then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2350
              # Only need to generate a patch file here if there are no commits in outgoing
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  2351
              # or if we've specified a file list
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2352
              rm -f $WDIR/$DIR/$F.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2353
              if [[ -z $rename ]]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2354
                  if [ ! -f $ofile ]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2355
                      diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2356
                          > $WDIR/$DIR/$F.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2357
                  elif [ ! -f $nfile ]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2358
                      diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2359
                          > $WDIR/$DIR/$F.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2360
                  else
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2361
                      diff -u $ofile $nfile > $WDIR/$DIR/$F.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2362
                  fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2363
              else
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2364
                  diff -u $ofile /dev/null | sh -c "$cleanse_rmfile" \
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2365
                      > $WDIR/$DIR/$F.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2366
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2367
                  diff -u /dev/null $nfile | sh -c "$cleanse_newfile" \
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2368
                      >> $WDIR/$DIR/$F.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2369
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2370
              fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2371
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2372
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2373
            #
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2374
            # Tack the patch we just made onto the accumulated patch for the
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2375
            # whole wad.
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2376
            #
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2377
              cat $WDIR/$DIR/$F.patch >> $WDIR/$WNAME.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2378
            fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2379
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2380
            print " patch\c"
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2381
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2382
	    if [[ -f $ofile && -f $nfile && -z $mv_but_nodiff ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2383
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2384
		${CDIFFCMD:-diff -bt -C 5} $ofile $nfile > $WDIR/$DIR/$F.cdiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2385
		diff_to_html $F $DIR/$F "C" "$COMM" < $WDIR/$DIR/$F.cdiff \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2386
		    > $WDIR/$DIR/$F.cdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2387
		print " cdiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2388
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2389
		${UDIFFCMD:-diff -bt -U 5} $ofile $nfile > $WDIR/$DIR/$F.udiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2390
		diff_to_html $F $DIR/$F "U" "$COMM" < $WDIR/$DIR/$F.udiff \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2391
		    > $WDIR/$DIR/$F.udiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2392
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2393
		print " udiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2394
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2395
		if [[ -x $WDIFF ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2396
		    $WDIFF -c "$COMM" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2397
			-t "$WNAME Wdiff $DIR/$F" $ofile $nfile > \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2398
			$WDIR/$DIR/$F.wdiff.html 2>/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2399
		    if [[ $? -eq 0 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2400
			print " wdiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2401
		    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2402
			print " wdiffs[fail]\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2403
		    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2404
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2405
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2406
		sdiff_to_html $ofile $nfile $F $DIR "$COMM" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2407
		    > $WDIR/$DIR/$F.sdiff.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2408
		print " sdiffs\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2409
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2410
		print " frames\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2411
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2412
		rm -f $WDIR/$DIR/$F.cdiff $WDIR/$DIR/$F.udiff
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2413
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2414
		difflines $ofile $nfile > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2415
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2416
	    elif [[ -f $ofile && -f $nfile && -n $mv_but_nodiff ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2417
		# renamed file: may also have differences
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2418
		difflines $ofile $nfile > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2419
	    elif [[ -f $nfile ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2420
		# new file: count added lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2421
		difflines /dev/null $nfile > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2422
	    elif [[ -f $ofile ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2423
		# old file: count deleted lines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2424
		difflines $ofile /dev/null > $WDIR/$DIR/$F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2425
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2426
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2427
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2428
	# Now we generate the postscript for this file.  We generate diffs
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2429
	# only in the event that there is delta, or the file is new (it seems
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2430
	# tree-killing to print out the contents of deleted files).
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2431
	#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2432
	if [[ -f $nfile ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2433
		ocr=$ofile
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2434
		[[ ! -f $ofile ]] && ocr=/dev/null
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2435
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2436
		if [[ -z $mv_but_nodiff ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2437
			textcomm=`getcomments text $P $PP`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2438
			if [[ -x $CODEREVIEW ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2439
				$CODEREVIEW -y "$textcomm" \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2440
				    -e $ocr $nfile \
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2441
				    > /tmp/$$.psfile 2>/dev/null &&
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2442
				    cat /tmp/$$.psfile >> $WDIR/$WNAME.ps
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2443
				if [[ $? -eq 0 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2444
					print " ps\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2445
				else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2446
					print " ps[fail]\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2447
				fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2448
			fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2449
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2450
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2451
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2452
	if [[ -f $ofile && -z $mv_but_nodiff ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2453
	    if [[ -n $its_a_jar ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2454
		source_to_html Old $P < $ofile.lst > $WDIR/$DIR/$F-.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2455
	    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2456
		source_to_html Old $P < $ofile > $WDIR/$DIR/$F-.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2457
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2458
		print " old\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2459
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2460
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2461
	if [[ -f $nfile ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2462
	    if [[ -n $its_a_jar ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2463
		source_to_html New $P < $nfile.lst > $WDIR/$DIR/$F.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2464
	    else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2465
		source_to_html New $P < $nfile > $WDIR/$DIR/$F.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2466
	    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2467
		print " new\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2468
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2469
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2470
	print
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2471
done < $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2472
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2473
# Create the new style mercurial patch here using hg export -r [all-revs] -g -o $CHANGESETPATH
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2474
if [[ $SCM_MODE == "mercurial" ]]; then
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  2475
  if [[ "$HG_LIST_FROM_COMMIT" -eq 1 && $flist_mode == "auto" ]]; then
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2476
    EXPORTCHANGESET="$WNAME.changeset"
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2477
    CHANGESETPATH=${WDIR}/${EXPORTCHANGESET}
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2478
    rm -f $CHANGESETPATH
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2479
    touch $CHANGESETPATH
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2480
    if [[ -n $ALL_CREV ]]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2481
      rev_opt=
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2482
      for rev in $ALL_CREV; do
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2483
        rev_opt="$rev_opt --rev $rev"
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2484
      done
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2485
    elif [[ -n $FIRST_CREV ]]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2486
      rev_opt="--rev $FIRST_CREV"
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2487
    fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2488
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2489
    if [[ -n $rev_opt ]]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2490
      (cd $CWS;hg export -g $rev_opt -o $CHANGESETPATH)
16821
a7d69ce6432c 8011347: JKD-8009824 has broken webrev with some ksh versions
jgish
parents: 16654
diff changeset
  2491
      echo "Created changeset: $CHANGESETPATH" 1>&2
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2492
      # Use it in place of the jdk.patch created above
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2493
      rm -f $WDIR/$WNAME.patch
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2494
    fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2495
  set +x
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2496
  fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2497
fi
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2498
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2499
frame_nav_js > $WDIR/ancnav.js
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2500
frame_navigation > $WDIR/ancnav.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2501
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2502
if [[ -f $WDIR/$WNAME.ps && -x $CODEREVIEW && -x $PS2PDF ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2503
	print " Generating PDF: \c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2504
	fix_postscript $WDIR/$WNAME.ps | $PS2PDF - > $WDIR/$WNAME.pdf
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2505
	print "Done."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2506
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2507
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2508
# Now build the index.html file that contains
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2509
# links to the source files and their diffs.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2510
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2511
cd $CWS
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2512
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2513
# Save total changed lines for Code Inspection.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2514
print "$TOTL" > $WDIR/TotalChangedLines
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2515
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2516
print "     index.html: \c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2517
INDEXFILE=$WDIR/index.html
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2518
exec 3<&1			# duplicate stdout to FD3.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2519
exec 1<&-			# Close stdout.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2520
exec > $INDEXFILE		# Open stdout to index file.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2521
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2522
print "$HTML<head>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2523
print "<meta name=\"scm\" content=\"$SCM_MODE\" />"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2524
print "$STDHEAD"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2525
print "<title>$WNAME</title>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2526
print "</head>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2527
print "<body id=\"SUNWwebrev\">"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2528
print "<div class=\"summary\">"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2529
print "<h2>Code Review for $WNAME</h2>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2530
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2531
print "<table>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2532
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2533
if [[ -z $uflag ]]; then
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2534
    if [[ $SCM_MODE == "mercurial" ]]; then
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2535
        #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2536
        # Let's try to extract the user name from the .hgrc file
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2537
        #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2538
	username=`grep '^username' $HOME/.hgrc | sed 's/^username[ ]*=[ ]*\(.*\)/\1/'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2539
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2540
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2541
    if [[ -z $username ]]; then
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2542
        #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2543
        # Figure out the username and gcos name.  To maintain compatibility
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2544
        # with passwd(4), we must support '&' substitutions.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2545
        #
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2546
	username=`id | cut -d '(' -f 2 | cut -d ')' -f 1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2547
	if [[ -x $GETENT ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2548
	    realname=`$GETENT passwd $username | cut -d':' -f 5 | cut -d ',' -f 1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2549
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2550
	userupper=`print "$username" | sed 's/\<./\u&/g'`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2551
	realname=`print $realname | sed s/\&/$userupper/`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2552
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2553
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2554
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2555
date="on `date`"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2556
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2557
if [[ -n "$username" && -n "$realname" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2558
	print "<tr><th>Prepared by:</th>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2559
	print "<td>$realname ($username) $date</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2560
elif [[ -n "$username" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2561
	print "<tr><th>Prepared by:</th><td>$username $date</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2562
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2563
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2564
print "<tr><th>Workspace:</th><td>$CWS</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2565
if [[ -n $parent_webrev ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2566
        print "<tr><th>Compare against:</th><td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2567
	print "webrev at $parent_webrev"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2568
else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2569
    if [[ -n $OUTPWS2 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2570
        print "<tr><th>Compare against:</th><td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2571
	print "$OUTPWS2"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2572
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2573
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2574
print "</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2575
if [[ -n $rflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2576
    print "<tr><th>Compare against version:</th><td>$PARENT_REV</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2577
elif [[ -n $OUTREV ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2578
    if [[ -z $forestflag ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2579
        print "<tr><th>Compare against version:</th><td>$OUTREV</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2580
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2581
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2582
if [[ -n $HG_BRANCH ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2583
    print "<tr><th>Branch:</th><td>$HG_BRANCH</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2584
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2585
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2586
print "<tr><th>Summary of changes:</th><td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2587
printCI $TOTL $TINS $TDEL $TMOD $TUNC
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2588
print "</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2589
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2590
if [[ -f $WDIR/$WNAME.patch ]]; then
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2591
  print "<tr><th>Patch of changes:</th><td>"
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2592
  print "<a href=\"$WNAME.patch\">$WNAME.patch</a></td></tr>"
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2593
elif [[ -f $CHANGESETPATH ]]; then
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2594
  print "<tr><th>Changeset:</th><td>"
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2595
  print "<a href=\"$EXPORTCHANGESET\">$EXPORTCHANGESET</a></td></tr>"
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2596
fi
16654
09c4f110096c 8009824: webrev.ksh generated jdk.patch files do not handle renames, copies, and shouldn't be applied
jgish
parents: 15901
diff changeset
  2597
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2598
if [[ -f $WDIR/$WNAME.pdf ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2599
	print "<tr><th>Printable review:</th><td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2600
	print "<a href=\"$WNAME.pdf\">$WNAME.pdf</a></td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2601
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2602
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2603
if [[ -n "$iflag" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2604
	print "<tr><th>Author comments:</th><td><div>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2605
	cat /tmp/$$.include
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2606
	print "</div></td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2607
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2608
# Add links to referenced CRs, if any
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2609
# URL has a <title> like:
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2610
# <title>[#JDK-8024688] b106-lambda: j.u.Map.merge doesn&#39;t work as specified if contains key:null pair - Java Bug System</title>
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2611
# we format this to:
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2612
# JDK-8024688: b106-lambda: j.u.Map.merge doesn't work as specified if contains key:null pair
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2613
if [[ -n $CRID ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2614
    for id in $CRID
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2615
    do
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2616
        #add "JDK-" to raw bug id for openjdk.java.net links.
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2617
        id=`echo ${id} | sed 's/^\([0-9]\{5,\}\)$/JDK-\1/'`
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2618
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2619
        print "<tr><th>Bug id:</th><td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2620
        url="${BUGURL}${id}"
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2621
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2622
        if [[ -n $WGET ]]; then
20637
3cf7db6a1586 8026062: webrev.ksh: fix bug title web scraping, remove teamware, sac, "open bug", -l and wxfile support
mduigou
parents: 20274
diff changeset
  2623
            msg=`$WGET --timeout=10 --tries=1 -q $url -O - | grep '<title>' | sed 's/<title>\[#\(.*\)\] \(.*\) - Java Bug System<\/title>/\1 : \2/' | html_dequote | html_quote`
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2624
        fi
15576
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2625
        if [[ -z $msg ]]; then
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2626
            msg="${id}"
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2627
        fi
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2628
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2629
        print "<a href=\"$url\">$msg</a>"
9bceeb53e794 8004726: Link bug ids to jbs rather than monaco.
mduigou
parents: 8442
diff changeset
  2630
8442
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2631
        print "</td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2632
    done
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2633
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2634
print "<tr><th>Legend:</th><td>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2635
print "<b>Modified file</b><br><font color=red><b>Deleted file</b></font><br><font color=green><b>New file</b></font></td></tr>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2636
print "</table>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2637
print "</div>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2638
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2639
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2640
# Second pass through the files: generate the rest of the index file
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2641
#
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2642
while read LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2643
do
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2644
	set - $LINE
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2645
        if [[ $1 == "Revision:" ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2646
            FIRST_CREV=`expr $3 + 1`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2647
            continue
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2648
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2649
	P=$1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2650
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2651
	if [[ $# == 2 ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2652
		PP=$2
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2653
		oldname=" <i>(was $PP)</i>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2654
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2655
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2656
		PP=$P
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2657
		oldname=""
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2658
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2659
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2660
	DIR=${P%/*}
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2661
	if [[ $DIR == $P ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2662
		DIR="."   # File at root of workspace
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2663
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2664
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2665
	# Avoid processing the same file twice.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2666
	# It's possible for renamed files to
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2667
	# appear twice in the file list
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2668
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2669
	F=$WDIR/$P
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2670
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2671
	print "<p><code>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2672
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2673
	# If there's a diffs file, make diffs links
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2674
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2675
        NODIFFS=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2676
	if [[ -f $F.cdiff.html ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2677
		print "<a href=\"$P.cdiff.html\">Cdiffs</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2678
		print "<a href=\"$P.udiff.html\">Udiffs</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2679
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2680
		if [[ -f $F.wdiff.html && -x $WDIFF ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2681
			print "<a href=\"$P.wdiff.html\">Wdiffs</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2682
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2683
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2684
		print "<a href=\"$P.sdiff.html\">Sdiffs</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2685
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2686
		print "<a href=\"$P.frames.html\">Frames</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2687
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2688
                NODIFFS=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2689
		print " ------ ------ ------"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2690
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2691
		if [[ -x $WDIFF ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2692
			print " ------"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2693
		fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2694
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2695
		print " ------"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2696
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2697
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2698
	# If there's an old file, make the link
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2699
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2700
        NOOLD=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2701
	if [[ -f $F-.html ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2702
		print "<a href=\"$P-.html\">Old</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2703
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2704
                NOOLD=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2705
		print " ---"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2706
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2707
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2708
	# If there's an new file, make the link
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2709
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2710
        NONEW=
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2711
	if [[ -f $F.html ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2712
		print "<a href=\"$P.html\">New</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2713
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2714
                NONEW=1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2715
		print " ---"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2716
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2717
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2718
	if [[ -f $F.patch ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2719
		print "<a href=\"$P.patch\">Patch</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2720
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2721
		print " -----"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2722
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2723
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2724
	if [[ -f $WDIR/raw_files/new/$P ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2725
		print "<a href=\"raw_files/new/$P\">Raw</a>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2726
	else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2727
		print " ---"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2728
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2729
        print "</code>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2730
        if [[ -n $NODIFFS && -z $oldname ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2731
            if [[ -n $NOOLD ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2732
                print "<font color=green><b>$P</b></font>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2733
            elif [[ -n $NONEW ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2734
                print "<font color=red><b>$P</b></font>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2735
            fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2736
        else
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2737
	    print "<b>$P</b> $oldname"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2738
        fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2739
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2740
	print "</p><blockquote>\c"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2741
	# Insert delta comments if any
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2742
	comments=`getcomments html $P $PP`
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2743
	if [ -n "$comments" ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2744
	    print "<pre>$comments</pre>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2745
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2746
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2747
	# Add additional comments comment
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2748
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2749
	print "<!-- Add comments to explain changes in $P here -->"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2750
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2751
	# Add count of changes.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2752
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2753
	if [[ -f $F.count ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2754
	    cat $F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2755
	    rm $F.count
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2756
	fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2757
        print "</blockquote>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2758
done < $FLIST
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2759
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2760
print
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2761
print
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2762
print "<hr />"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2763
print "<p style=\"font-size: small\">"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2764
print "This code review page was prepared using <b>$0</b>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2765
print "(vers $WEBREV_UPDATED)."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2766
print "</body>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2767
print "</html>"
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2768
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2769
if [[ -n $ZIP ]]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2770
    # Let's generate a zip file for convenience
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2771
    cd $WDIR/..
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2772
    if [ -f webrev.zip ]; then
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2773
	rm webrev.zip
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2774
    fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2775
    $ZIP -r webrev webrev >/dev/null 2>&1
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2776
fi
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2777
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2778
exec 1<&-			# Close FD 1.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2779
exec 1<&3			# dup FD 3 to restore stdout.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2780
exec 3<&-			# close FD 3.
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2781
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2782
print "Done."
0be681587b9c 7023111: Add webrev script to make/scripts
ohair
parents:
diff changeset
  2783
print "Output to: $WDIR"