| 1 |
#require serve |
| 2 |
|
| 3 |
Test raw style of hgweb |
| 4 |
|
| 5 |
$ hg init test |
| 6 |
$ cd test |
| 7 |
$ mkdir sub |
| 8 |
$ cat >'sub/some text%.txt' <<ENDSOME |
| 9 |
> This is just some random text |
| 10 |
> that will go inside the file and take a few lines. |
| 11 |
> It is very boring to read, but computers don't |
| 12 |
> care about things like that. |
| 13 |
> ENDSOME |
| 14 |
$ hg add 'sub/some text%.txt' |
| 15 |
$ hg commit -d "1 0" -m "Just some text" |
| 16 |
|
| 17 |
$ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid |
| 18 |
|
| 19 |
$ cat hg.pid >> $DAEMON_PIDS |
| 20 |
$ (get-with-headers.py localhost:$HGPORT 'raw-file/bf0ff59095c9/sub/some%20text%25.txt' content-type content-length content-disposition) >getoutput.txt |
| 21 |
|
| 22 |
$ killdaemons.py hg.pid |
| 23 |
|
| 24 |
$ cat getoutput.txt |
| 25 |
200 Script output follows |
| 26 |
content-type: application/binary |
| 27 |
content-length: 157 |
| 28 |
content-disposition: inline; filename="some text%.txt" |
| 29 |
|
| 30 |
This is just some random text |
| 31 |
that will go inside the file and take a few lines. |
| 32 |
It is very boring to read, but computers don't |
| 33 |
care about things like that. |
| 34 |
$ cat access.log error.log |
| 35 |
$LOCALIP - - [$LOGDATE$] "GET /raw-file/bf0ff59095c9/sub/some%20text%25.txt HTTP/1.1" 200 - (glob) |
| 36 |
|
| 37 |
$ rm access.log error.log |
| 38 |
$ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid \ |
| 39 |
> --config web.guessmime=True |
| 40 |
|
| 41 |
$ cat hg.pid >> $DAEMON_PIDS |
| 42 |
$ (get-with-headers.py localhost:$HGPORT 'raw-file/bf0ff59095c9/sub/some%20text%25.txt' content-type content-length content-disposition) >getoutput.txt |
| 43 |
$ killdaemons.py hg.pid |
| 44 |
|
| 45 |
$ cat getoutput.txt |
| 46 |
200 Script output follows |
| 47 |
content-type: text/plain; charset="ascii" |
| 48 |
content-length: 157 |
| 49 |
content-disposition: inline; filename="some text%.txt" |
| 50 |
|
| 51 |
This is just some random text |
| 52 |
that will go inside the file and take a few lines. |
| 53 |
It is very boring to read, but computers don't |
| 54 |
care about things like that. |
| 55 |
$ cat access.log error.log |
| 56 |
$LOCALIP - - [$LOGDATE$] "GET /raw-file/bf0ff59095c9/sub/some%20text%25.txt HTTP/1.1" 200 - (glob) |
| 57 |
|
| 58 |
>>> with open('sub/binary.bin', 'wb') as fp: |
| 59 |
... fp.write(b'Binary\0file') and None |
| 60 |
|
| 61 |
$ hg ci -Aqm "add binary file" sub/ |
| 62 |
$ hg serve -p $HGPORT -A access.log -E error.log -d --pid-file=hg.pid \ |
| 63 |
> --config web.guessmime=True |
| 64 |
$ cat hg.pid >> $DAEMON_PIDS |
| 65 |
$ (get-with-headers.py localhost:$HGPORT 'annotate/tip/sub/binary.bin' content-type content-length content-disposition) >getoutput.txt |
| 66 |
$ cat getoutput.txt |
| 67 |
200 Script output follows |
| 68 |
content-type: text/html; charset=ascii |
| 69 |
|
| 70 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
| 71 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
| 72 |
<head> |
| 73 |
<link rel="icon" href="/static/hgicon.png" type="image/png" /> |
| 74 |
<meta name="robots" content="index, nofollow" /> |
| 75 |
<link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
| 76 |
<script type="text/javascript" src="/static/mercurial.js"></script> |
| 77 |
|
| 78 |
<title>$TESTTMP/test: sub/binary.bin annotate</title> (glob) |
| 79 |
</head> |
| 80 |
<body> |
| 81 |
|
| 82 |
<div class="container"> |
| 83 |
<div class="menu"> |
| 84 |
<div class="logo"> |
| 85 |
<a href="https://mercurial-scm.org/"> |
| 86 |
<img src="/static/hglogo.png" alt="mercurial" /></a> |
| 87 |
</div> |
| 88 |
<ul> |
| 89 |
<li><a href="/shortlog/tip">log</a></li> |
| 90 |
<li><a href="/graph/tip">graph</a></li> |
| 91 |
<li><a href="/tags">tags</a></li> |
| 92 |
<li><a href="/bookmarks">bookmarks</a></li> |
| 93 |
<li><a href="/branches">branches</a></li> |
| 94 |
</ul> |
| 95 |
|
| 96 |
<ul> |
| 97 |
<li><a href="/rev/tip">changeset</a></li> |
| 98 |
<li><a href="/file/tip/sub/">browse</a></li> |
| 99 |
</ul> |
| 100 |
<ul> |
| 101 |
<li><a href="/file/tip/sub/binary.bin">file</a></li> |
| 102 |
<li><a href="/file/tip/sub/binary.bin">latest</a></li> |
| 103 |
<li><a href="/diff/tip/sub/binary.bin">diff</a></li> |
| 104 |
<li><a href="/comparison/tip/sub/binary.bin">comparison</a></li> |
| 105 |
<li class="active">annotate</li> |
| 106 |
<li><a href="/log/tip/sub/binary.bin">file log</a></li> |
| 107 |
<li><a href="/raw-file/tip/sub/binary.bin">raw</a></li> |
| 108 |
</ul> |
| 109 |
<ul> |
| 110 |
<li><a href="/help">help</a></li> |
| 111 |
</ul> |
| 112 |
</div> |
| 113 |
|
| 114 |
<div class="main"> |
| 115 |
<h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
| 116 |
<h3> |
| 117 |
annotate sub/binary.bin @ 1:<a href="/rev/7dc31308464a">7dc31308464a</a> |
| 118 |
<span class="phase">draft</span> <span class="branchhead">default</span> <span class="tag">tip</span> |
| 119 |
</h3> |
| 120 |
|
| 121 |
|
| 122 |
<form class="search" action="/log"> |
| 123 |
|
| 124 |
<p><input name="rev" id="search1" type="text" size="30" value="" /></p> |
| 125 |
<div id="hint">Find changesets by keywords (author, files, the commit message), revision |
| 126 |
number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
| 127 |
</form> |
| 128 |
|
| 129 |
<div class="description">add binary file</div> |
| 130 |
|
| 131 |
<table id="changesetEntry"> |
| 132 |
<tr> |
| 133 |
<th class="author">author</th> |
| 134 |
<td class="author">test</td> |
| 135 |
</tr> |
| 136 |
<tr> |
| 137 |
<th class="date">date</th> |
| 138 |
<td class="date age">Thu, 01 Jan 1970 00:00:00 +0000</td> |
| 139 |
</tr> |
| 140 |
<tr> |
| 141 |
<th class="author">parents</th> |
| 142 |
<td class="author"></td> |
| 143 |
</tr> |
| 144 |
<tr> |
| 145 |
<th class="author">children</th> |
| 146 |
<td class="author"></td> |
| 147 |
</tr> |
| 148 |
</table> |
| 149 |
|
| 150 |
|
| 151 |
<form id="diffopts-form" |
| 152 |
data-ignorews="0" |
| 153 |
data-ignorewsamount="0" |
| 154 |
data-ignorewseol="0" |
| 155 |
data-ignoreblanklines="0"> |
| 156 |
<span>Ignore whitespace changes - </span> |
| 157 |
<span>Everywhere:</span> |
| 158 |
<input id="ignorews-checkbox" type="checkbox" /> |
| 159 |
<span>Within whitespace:</span> |
| 160 |
<input id="ignorewsamount-checkbox" type="checkbox" /> |
| 161 |
<span>At end of lines:</span> |
| 162 |
<input id="ignorewseol-checkbox" type="checkbox" /> |
| 163 |
</form> |
| 164 |
|
| 165 |
<script type="text/javascript"> |
| 166 |
renderDiffOptsForm(); |
| 167 |
</script> |
| 168 |
|
| 169 |
<div class="overflow"> |
| 170 |
<table class="bigtable"> |
| 171 |
<thead> |
| 172 |
<tr> |
| 173 |
<th class="annotate">rev</th> |
| 174 |
<th class="line"> line source</th> |
| 175 |
</tr> |
| 176 |
</thead> |
| 177 |
<tbody class="stripes2 sourcelines" |
| 178 |
data-logurl="/log/tip/sub/binary.bin" |
| 179 |
data-selectabletag="TR" |
| 180 |
data-ishead="1"> |
| 181 |
|
| 182 |
<tr id="l1" class="thisrev"> |
| 183 |
<td class="annotate parity0"> |
| 184 |
<a href="/annotate/7dc31308464a/sub/binary.bin#l1"> |
| 185 |
1 |
| 186 |
</a> |
| 187 |
<div class="annotate-info"> |
| 188 |
<div> |
| 189 |
<a href="/annotate/7dc31308464a/sub/binary.bin#l1"> |
| 190 |
7dc31308464a</a> |
| 191 |
add binary file |
| 192 |
</div> |
| 193 |
<div><em>test</em></div> |
| 194 |
<div>parents: </div> |
| 195 |
<a href="/diff/7dc31308464a/sub/binary.bin">diff</a> |
| 196 |
<a href="/rev/7dc31308464a">changeset</a> |
| 197 |
</div> |
| 198 |
</td> |
| 199 |
<td class="source followlines-btn-parent"><a href="#l1"> 1</a> (binary:application/octet-stream)</td> |
| 200 |
</tr> |
| 201 |
</tbody> |
| 202 |
</table> |
| 203 |
</div> |
| 204 |
</div> |
| 205 |
</div> |
| 206 |
|
| 207 |
<script type="text/javascript" src="/static/followlines.js"></script> |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
</body> |
| 212 |
</html> |
| 213 |
|
| 214 |
$ (get-with-headers.py localhost:$HGPORT 'comparison/tip/sub/binary.bin' content-type content-length content-disposition) >getoutput.txt |
| 215 |
$ (get-with-headers.py localhost:$HGPORT 'file/tip/sub/binary.bin' content-type content-length content-disposition) >getoutput.txt |
| 216 |
$ (get-with-headers.py localhost:$HGPORT 'static/hgicon.png' content-type content-length content-disposition) >getoutput.txt |
| 217 |
$ killdaemons.py hg.pid |
| 218 |
$ cat access.log error.log |
| 219 |
$LOCALIP - - [$LOGDATE$] "GET /raw-file/bf0ff59095c9/sub/some%20text%25.txt HTTP/1.1" 200 - (glob) |
| 220 |
$LOCALIP - - [$LOGDATE$] "GET /annotate/tip/sub/binary.bin HTTP/1.1" 200 - (glob) |
| 221 |
$LOCALIP - - [$LOGDATE$] "GET /comparison/tip/sub/binary.bin HTTP/1.1" 200 - (glob) |
| 222 |
$LOCALIP - - [$LOGDATE$] "GET /file/tip/sub/binary.bin HTTP/1.1" 200 - (glob) |
| 223 |
$LOCALIP - - [$LOGDATE$] "GET /static/hgicon.png HTTP/1.1" 200 - (glob) |
| 224 |
|
| 225 |
$ cd .. |