| 1 |
#require serve |
| 2 |
|
| 3 |
Some tests for hgweb in an empty repository and empty archive |
| 4 |
|
| 5 |
$ hg init test |
| 6 |
$ cd test |
| 7 |
$ cat << EOF >> .hg/hgrc |
| 8 |
> [web] |
| 9 |
> allow-archive = zip |
| 10 |
> [ui] |
| 11 |
> archivemeta = False |
| 12 |
> EOF |
| 13 |
$ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
| 14 |
$ cat hg.pid >> $DAEMON_PIDS |
| 15 |
$ (get-with-headers.py localhost:$HGPORT 'shortlog') |
| 16 |
200 Script output follows |
| 17 |
|
| 18 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 19 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
| 20 |
<head> |
| 21 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
| 22 |
<meta name="robots" content="index, nofollow" /> |
| 23 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
| 24 |
<script type="text/javascript" src="/static/mercurial.js"></script> |
| 25 |
|
| 26 |
<title>test: log</title> |
| 27 |
<link rel="alternate" type="application/atom+xml" |
| 28 |
href="/atom-log" title="Atom feed for test" /> |
| 29 |
<link rel="alternate" type="application/rss+xml" |
| 30 |
href="/rss-log" title="RSS feed for test" /> |
| 31 |
</head> |
| 32 |
<body> |
| 33 |
|
| 34 |
<div class="container"> |
| 35 |
<div class="menu"> |
| 36 |
<div class="logo"> |
| 37 |
<a href="https://mercurial-scm.org/"> |
| 38 |
<img src="/static/hglogo.png" alt="mercurial" /></a> |
| 39 |
</div> |
| 40 |
<ul> |
| 41 |
<li class="active">log</li> |
| 42 |
<li><a href="/graph/tip">graph</a></li> |
| 43 |
<li><a href="/tags">tags</a></li> |
| 44 |
<li><a href="/bookmarks">bookmarks</a></li> |
| 45 |
<li><a href="/branches">branches</a></li> |
| 46 |
</ul> |
| 47 |
<ul> |
| 48 |
<li><a href="/rev/tip">changeset</a></li> |
| 49 |
<li><a href="/file/tip">browse</a></li> |
| 50 |
</ul> |
| 51 |
<ul> |
| 52 |
|
| 53 |
<li> |
| 54 |
<a href="/archive/tip.zip">zip</a> |
| 55 |
</li> |
| 56 |
</ul> |
| 57 |
<ul> |
| 58 |
<li><a href="/help">help</a></li> |
| 59 |
</ul> |
| 60 |
<div class="atom-logo"> |
| 61 |
<a href="/atom-log" title="subscribe to atom feed"> |
| 62 |
<img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" /> |
| 63 |
</a> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
|
| 67 |
<div class="main"> |
| 68 |
<h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
| 69 |
<h3>log</h3> |
| 70 |
|
| 71 |
|
| 72 |
<form class="search" action="/log"> |
| 73 |
|
| 74 |
<p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
| 75 |
<div id="hint">Find changesets by keywords (author, files, the commit message), revision |
| 76 |
number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
| 77 |
</form> |
| 78 |
|
| 79 |
<div class="navigate"> |
| 80 |
<a href="/shortlog/tip?revcount=30">less</a> |
| 81 |
<a href="/shortlog/tip?revcount=120">more</a> |
| 82 |
| rev -1: |
| 83 |
</div> |
| 84 |
|
| 85 |
<table class="bigtable"> |
| 86 |
<thead> |
| 87 |
<tr> |
| 88 |
<th class="age">age</th> |
| 89 |
<th class="author">author</th> |
| 90 |
<th class="description">description</th> |
| 91 |
</tr> |
| 92 |
</thead> |
| 93 |
<tbody class="stripes2"> |
| 94 |
|
| 95 |
</tbody> |
| 96 |
</table> |
| 97 |
|
| 98 |
<div class="navigate"> |
| 99 |
<a href="/shortlog/tip?revcount=30">less</a> |
| 100 |
<a href="/shortlog/tip?revcount=120">more</a> |
| 101 |
| rev -1: |
| 102 |
</div> |
| 103 |
|
| 104 |
<script type="text/javascript"> |
| 105 |
ajaxScrollInit( |
| 106 |
'/shortlog/%next%', |
| 107 |
'', <!-- NEXTHASH |
| 108 |
function (htmlText) { |
| 109 |
var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/); |
| 110 |
return m ? m[1] : null; |
| 111 |
}, |
| 112 |
'.bigtable > tbody', |
| 113 |
'<tr class="%class%">\ |
| 114 |
<td colspan="3" style="text-align: center;">%text%</td>\ |
| 115 |
</tr>' |
| 116 |
); |
| 117 |
</script> |
| 118 |
|
| 119 |
</div> |
| 120 |
</div> |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
</body> |
| 125 |
</html> |
| 126 |
|
| 127 |
$ echo babar |
| 128 |
babar |
| 129 |
$ (get-with-headers.py localhost:$HGPORT 'log') |
| 130 |
200 Script output follows |
| 131 |
|
| 132 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 133 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
| 134 |
<head> |
| 135 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
| 136 |
<meta name="robots" content="index, nofollow" /> |
| 137 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
| 138 |
<script type="text/javascript" src="/static/mercurial.js"></script> |
| 139 |
|
| 140 |
<title>test: log</title> |
| 141 |
<link rel="alternate" type="application/atom+xml" |
| 142 |
href="/atom-log" title="Atom feed for test" /> |
| 143 |
<link rel="alternate" type="application/rss+xml" |
| 144 |
href="/rss-log" title="RSS feed for test" /> |
| 145 |
</head> |
| 146 |
<body> |
| 147 |
|
| 148 |
<div class="container"> |
| 149 |
<div class="menu"> |
| 150 |
<div class="logo"> |
| 151 |
<a href="https://mercurial-scm.org/"> |
| 152 |
<img src="/static/hglogo.png" alt="mercurial" /></a> |
| 153 |
</div> |
| 154 |
<ul> |
| 155 |
<li class="active">log</li> |
| 156 |
<li><a href="/graph/tip">graph</a></li> |
| 157 |
<li><a href="/tags">tags</a></li> |
| 158 |
<li><a href="/bookmarks">bookmarks</a></li> |
| 159 |
<li><a href="/branches">branches</a></li> |
| 160 |
</ul> |
| 161 |
<ul> |
| 162 |
<li><a href="/rev/tip">changeset</a></li> |
| 163 |
<li><a href="/file/tip">browse</a></li> |
| 164 |
</ul> |
| 165 |
<ul> |
| 166 |
|
| 167 |
<li> |
| 168 |
<a href="/archive/tip.zip">zip</a> |
| 169 |
</li> |
| 170 |
</ul> |
| 171 |
<ul> |
| 172 |
<li><a href="/help">help</a></li> |
| 173 |
</ul> |
| 174 |
<div class="atom-logo"> |
| 175 |
<a href="/atom-log" title="subscribe to atom feed"> |
| 176 |
<img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" /> |
| 177 |
</a> |
| 178 |
</div> |
| 179 |
</div> |
| 180 |
|
| 181 |
<div class="main"> |
| 182 |
<h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
| 183 |
<h3>log</h3> |
| 184 |
|
| 185 |
|
| 186 |
<form class="search" action="/log"> |
| 187 |
|
| 188 |
<p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
| 189 |
<div id="hint">Find changesets by keywords (author, files, the commit message), revision |
| 190 |
number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
| 191 |
</form> |
| 192 |
|
| 193 |
<div class="navigate"> |
| 194 |
<a href="/shortlog/tip?revcount=5">less</a> |
| 195 |
<a href="/shortlog/tip?revcount=20">more</a> |
| 196 |
| rev -1: |
| 197 |
</div> |
| 198 |
|
| 199 |
<table class="bigtable"> |
| 200 |
<thead> |
| 201 |
<tr> |
| 202 |
<th class="age">age</th> |
| 203 |
<th class="author">author</th> |
| 204 |
<th class="description">description</th> |
| 205 |
</tr> |
| 206 |
</thead> |
| 207 |
<tbody class="stripes2"> |
| 208 |
|
| 209 |
</tbody> |
| 210 |
</table> |
| 211 |
|
| 212 |
<div class="navigate"> |
| 213 |
<a href="/shortlog/tip?revcount=5">less</a> |
| 214 |
<a href="/shortlog/tip?revcount=20">more</a> |
| 215 |
| rev -1: |
| 216 |
</div> |
| 217 |
|
| 218 |
<script type="text/javascript"> |
| 219 |
ajaxScrollInit( |
| 220 |
'/shortlog/%next%', |
| 221 |
'', <!-- NEXTHASH |
| 222 |
function (htmlText) { |
| 223 |
var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/); |
| 224 |
return m ? m[1] : null; |
| 225 |
}, |
| 226 |
'.bigtable > tbody', |
| 227 |
'<tr class="%class%">\ |
| 228 |
<td colspan="3" style="text-align: center;">%text%</td>\ |
| 229 |
</tr>' |
| 230 |
); |
| 231 |
</script> |
| 232 |
|
| 233 |
</div> |
| 234 |
</div> |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
</body> |
| 239 |
</html> |
| 240 |
|
| 241 |
$ (get-with-headers.py localhost:$HGPORT 'graph') |
| 242 |
200 Script output follows |
| 243 |
|
| 244 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 245 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
| 246 |
<head> |
| 247 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
| 248 |
<meta name="robots" content="index, nofollow" /> |
| 249 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
| 250 |
<script type="text/javascript" src="/static/mercurial.js"></script> |
| 251 |
|
| 252 |
<title>test: revision graph</title> |
| 253 |
<link rel="alternate" type="application/atom+xml" |
| 254 |
href="/atom-log" title="Atom feed for test: log" /> |
| 255 |
<link rel="alternate" type="application/rss+xml" |
| 256 |
href="/rss-log" title="RSS feed for test: log" /> |
| 257 |
</head> |
| 258 |
<body> |
| 259 |
|
| 260 |
<div class="container"> |
| 261 |
<div class="menu"> |
| 262 |
<div class="logo"> |
| 263 |
<a href="https://mercurial-scm.org/"> |
| 264 |
<img src="/static/hglogo.png" alt="mercurial" /></a> |
| 265 |
</div> |
| 266 |
<ul> |
| 267 |
<li><a href="/shortlog/tip">log</a></li> |
| 268 |
<li class="active">graph</li> |
| 269 |
<li><a href="/tags">tags</a></li> |
| 270 |
<li><a href="/bookmarks">bookmarks</a></li> |
| 271 |
<li><a href="/branches">branches</a></li> |
| 272 |
</ul> |
| 273 |
<ul> |
| 274 |
<li><a href="/rev/tip">changeset</a></li> |
| 275 |
<li><a href="/file/tip">browse</a></li> |
| 276 |
</ul> |
| 277 |
<ul> |
| 278 |
|
| 279 |
<li> |
| 280 |
<a href="/archive/tip.zip">zip</a> |
| 281 |
</li> |
| 282 |
</ul> |
| 283 |
<ul> |
| 284 |
<li><a href="/help">help</a></li> |
| 285 |
</ul> |
| 286 |
<div class="atom-logo"> |
| 287 |
<a href="/atom-log" title="subscribe to atom feed"> |
| 288 |
<img class="atom-logo" src="/static/feed-icon-14x14.png" alt="atom feed" /> |
| 289 |
</a> |
| 290 |
</div> |
| 291 |
</div> |
| 292 |
|
| 293 |
<div class="main"> |
| 294 |
<h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
| 295 |
<h3>graph</h3> |
| 296 |
|
| 297 |
|
| 298 |
<form class="search" action="/log"> |
| 299 |
|
| 300 |
<p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
| 301 |
<div id="hint">Find changesets by keywords (author, files, the commit message), revision |
| 302 |
number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
| 303 |
</form> |
| 304 |
|
| 305 |
<div class="navigate"> |
| 306 |
<a href="/graph/tip?revcount=30">less</a> |
| 307 |
<a href="/graph/tip?revcount=120">more</a> |
| 308 |
| rev -1: |
| 309 |
</div> |
| 310 |
|
| 311 |
<noscript><p>The revision graph only works with JavaScript-enabled browsers.</p></noscript> |
| 312 |
|
| 313 |
<div id="wrapper"> |
| 314 |
<canvas id="graph"></canvas> |
| 315 |
<ul id="graphnodes" class="stripes2"></ul> |
| 316 |
</div> |
| 317 |
|
| 318 |
<script type="text/javascript"> |
| 319 |
var data = []; |
| 320 |
var graph = new Graph(); |
| 321 |
graph.scale(39); |
| 322 |
graph.render(data); |
| 323 |
</script> |
| 324 |
|
| 325 |
<div class="navigate"> |
| 326 |
<a href="/graph/tip?revcount=30">less</a> |
| 327 |
<a href="/graph/tip?revcount=120">more</a> |
| 328 |
| rev -1: |
| 329 |
</div> |
| 330 |
|
| 331 |
<script type="text/javascript"> |
| 332 |
ajaxScrollInit( |
| 333 |
'/graph/%next%?graphtop=0000000000000000000000000000000000000000', |
| 334 |
'', <!-- NEXTHASH |
| 335 |
function (htmlText) { |
| 336 |
var m = htmlText.match(/'(\w+)', <!-- NEXTHASH/); |
| 337 |
return m ? m[1] : null; |
| 338 |
}, |
| 339 |
'#wrapper', |
| 340 |
'<div class="%class%" style="text-align: center;">%text%</div>', |
| 341 |
'graph' |
| 342 |
); |
| 343 |
</script> |
| 344 |
|
| 345 |
</div> |
| 346 |
</div> |
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
</body> |
| 351 |
</html> |
| 352 |
|
| 353 |
$ (get-with-headers.py localhost:$HGPORT 'file') |
| 354 |
200 Script output follows |
| 355 |
|
| 356 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 357 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
| 358 |
<head> |
| 359 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
| 360 |
<meta name="robots" content="index, nofollow" /> |
| 361 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
| 362 |
<script type="text/javascript" src="/static/mercurial.js"></script> |
| 363 |
|
| 364 |
<title>test: 000000000000 /</title> |
| 365 |
</head> |
| 366 |
<body> |
| 367 |
|
| 368 |
<div class="container"> |
| 369 |
<div class="menu"> |
| 370 |
<div class="logo"> |
| 371 |
<a href="https://mercurial-scm.org/"> |
| 372 |
<img src="/static/hglogo.png" alt="mercurial" /></a> |
| 373 |
</div> |
| 374 |
<ul> |
| 375 |
<li><a href="/shortlog/tip">log</a></li> |
| 376 |
<li><a href="/graph/tip">graph</a></li> |
| 377 |
<li><a href="/tags">tags</a></li> |
| 378 |
<li><a href="/bookmarks">bookmarks</a></li> |
| 379 |
<li><a href="/branches">branches</a></li> |
| 380 |
</ul> |
| 381 |
<ul> |
| 382 |
<li><a href="/rev/tip">changeset</a></li> |
| 383 |
<li class="active">browse</li> |
| 384 |
</ul> |
| 385 |
<ul> |
| 386 |
|
| 387 |
<li> |
| 388 |
<a href="/archive/tip.zip">zip</a> |
| 389 |
</li> |
| 390 |
</ul> |
| 391 |
<ul> |
| 392 |
<li><a href="/help">help</a></li> |
| 393 |
</ul> |
| 394 |
</div> |
| 395 |
|
| 396 |
<div class="main"> |
| 397 |
<h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
| 398 |
<h3> |
| 399 |
directory / @ -1:<a href="/rev/000000000000">000000000000</a> |
| 400 |
<span class="tag">tip</span> |
| 401 |
</h3> |
| 402 |
|
| 403 |
|
| 404 |
<form class="search" action="/log"> |
| 405 |
|
| 406 |
<p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
| 407 |
<div id="hint">Find changesets by keywords (author, files, the commit message), revision |
| 408 |
number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
| 409 |
</form> |
| 410 |
|
| 411 |
<table class="bigtable"> |
| 412 |
<thead> |
| 413 |
<tr> |
| 414 |
<th class="name">name</th> |
| 415 |
<th class="size">size</th> |
| 416 |
<th class="permissions">permissions</th> |
| 417 |
</tr> |
| 418 |
</thead> |
| 419 |
<tbody class="stripes2"> |
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
</tbody> |
| 424 |
</table> |
| 425 |
</div> |
| 426 |
</div> |
| 427 |
|
| 428 |
|
| 429 |
</body> |
| 430 |
</html> |
| 431 |
|
| 432 |
|
| 433 |
$ (get-with-headers.py localhost:$HGPORT 'atom-bookmarks') |
| 434 |
200 Script output follows |
| 435 |
|
| 436 |
<?xml version="1.0" encoding="ascii"?> |
| 437 |
<feed xmlns="http://www.w3.org/2005/Atom"> |
| 438 |
<id>http://*:$HGPORT/</id> (glob) |
| 439 |
<link rel="self" href="http://*:$HGPORT/atom-bookmarks"/> (glob) |
| 440 |
<link rel="alternate" href="http://*:$HGPORT/bookmarks"/> (glob) |
| 441 |
<title>test: bookmarks</title> |
| 442 |
<summary>test bookmark history</summary> |
| 443 |
<author><name>Mercurial SCM</name></author> |
| 444 |
<updated>1970-01-01T00:00:00+00:00</updated> |
| 445 |
|
| 446 |
|
| 447 |
</feed> |
| 448 |
|
| 449 |
Fetching an empty archive |
| 450 |
------------------------- |
| 451 |
|
| 452 |
Test that archiving without matching files is rejected as error, |
| 453 |
not as Internal Server Error. |
| 454 |
|
| 455 |
$ get-with-headers.py --headeronly localhost:$HGPORT archive/null.zip |
| 456 |
403 Forbidden |
| 457 |
[1] |
| 458 |
|
| 459 |
$ cd .. |