Mercurial > hg-stable
diff tests/test-hgweb-commands.t @ 21122:50981ce36236
hgweb: show as same parents as "hg parents -r REV FILE" in pages for file
Before this patch, "parents" in pages for file doesn't show as same
parents as "hg parents -r REV FILE", when the specified file is not
modified in the specified revision.
For example, it is assumed that revision A, B and D change file "f".
changelog (A) ---> (B) ---> (C) ---> (D)
filelog "f" (x) ---> (y) ------------> (z)
"/file/D/f" invokes "webutil.parents()" with filectx(z) gotten from
changectx(D), and it returns changectx(B). This is as same result as
"hg parents -r D f".
In the other hand, "/file/C/f" invokes "webutil.parents()" with
filectx(y') gotten from changectx(C), and it returns changectx(A),
because filectx(y') is linked to changectx(B), and works like
filectx(y) in some cases.
In this case, revision B is hidden from users browsing file "f" in
revision C.
This patch shows as same parents as "hg parents -r REV FILE" in pages
for file, by making "webutil.parents()" return:
- "linkrev()"-ed revision only, if:
- specified context instance is "filectx" (because
"webutil.parents()" is invoked with changectx, too), and
- (1) the revision from which filectx is gotten and (2) the one to
which filectx is linked are different from each other
- revision gotten from "ctx.parents()", otherwise
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 17 Apr 2014 09:36:08 +0900 |
parents | 9ea9e94c7492 |
children | a65714215377 |
line wrap: on
line diff
--- a/tests/test-hgweb-commands.t Thu Apr 17 09:36:08 2014 +0900 +++ b/tests/test-hgweb-commands.t Thu Apr 17 09:36:08 2014 +0900 @@ -928,6 +928,13 @@ -rw-r--r-- 4 foo + $ hg log --template "{file_mods}\n" -r 1 + + $ hg parents --template "{node|short}\n" -r 1 + 2ef0ac749a14 + $ hg parents --template "{node|short}\n" -r 1 foo + 2ef0ac749a14 + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/1/foo' 200 Script output follows @@ -998,7 +1005,7 @@ </tr> <tr> <th class="author">parents</th> - <td class="author"></td> + <td class="author"><a href="/file/2ef0ac749a14/foo">2ef0ac749a14</a> </td> </tr> <tr> <th class="author">children</th> @@ -1045,6 +1052,109 @@ + $ hg log --template "{file_mods}\n" -r 2 + foo + $ hg parents --template "{node|short}\n" -r 2 + a4f92ed23982 + $ hg parents --template "{node|short}\n" -r 2 foo + 2ef0ac749a14 + + $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'file/2/foo' + 200 Script output follows + + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> + <head> + <link rel="icon" href="/static/hgicon.png" type="image/png" /> + <meta name="robots" content="index, nofollow" /> + <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> + <script type="text/javascript" src="/static/mercurial.js"></script> + + <title>test: 1d22e65f027e foo</title> + </head> + <body> + + <div class="container"> + <div class="menu"> + <div class="logo"> + <a href="http://mercurial.selenic.com/"> + <img src="/static/hglogo.png" alt="mercurial" /></a> + </div> + <ul> + <li><a href="/shortlog/1d22e65f027e">log</a></li> + <li><a href="/graph/1d22e65f027e">graph</a></li> + <li><a href="/tags">tags</a></li> + <li><a href="/bookmarks">bookmarks</a></li> + <li><a href="/branches">branches</a></li> + </ul> + <ul> + <li><a href="/rev/1d22e65f027e">changeset</a></li> + <li><a href="/file/1d22e65f027e/">browse</a></li> + </ul> + <ul> + <li class="active">file</li> + <li><a href="/file/tip/foo">latest</a></li> + <li><a href="/diff/1d22e65f027e/foo">diff</a></li> + <li><a href="/comparison/1d22e65f027e/foo">comparison</a></li> + <li><a href="/annotate/1d22e65f027e/foo">annotate</a></li> + <li><a href="/log/1d22e65f027e/foo">file log</a></li> + <li><a href="/raw-file/1d22e65f027e/foo">raw</a></li> + </ul> + <ul> + <li><a href="/help">help</a></li> + </ul> + </div> + + <div class="main"> + <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> + <h3>view foo @ 2:1d22e65f027e</h3> + + <form class="search" action="/log"> + + <p><input name="rev" id="search1" type="text" size="30" /></p> + <div id="hint">Find changesets by keywords (author, files, the commit message), revision + number or hash, or <a href="/help/revsets">revset expression</a>.</div> + </form> + + <div class="description">branch</div> + + <table id="changesetEntry"> + <tr> + <th class="author">author</th> + <td class="author">test</td> + </tr> + <tr> + <th class="date">date</th> + <td class="date age">Thu, 01 Jan 1970 00:00:00 +0000</td> + </tr> + <tr> + <th class="author">parents</th> + <td class="author"><a href="/file/2ef0ac749a14/foo">2ef0ac749a14</a> </td> + </tr> + <tr> + <th class="author">children</th> + <td class="author"></td> + </tr> + </table> + + <div class="overflow"> + <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div> + <div class="sourcefirst"> line source</div> + <pre class="sourcelines stripes4 wrap"> + <span id="l1">another</span><a href="#l1"></a></pre> + <div class="sourcelast"></div> + </div> + </div> + </div> + + <script type="text/javascript">process_dates()</script> + + + </body> + </html> + + + Overviews $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT 'raw-tags'