Mercurial > hg
changeset 21123:92fab48dfec1
hgweb: show revisions and hashes gotten from changelog in "comparison" page
Before this patch, revision numbers and hash values in "comparison"
page are gotten from not changelog but filelog.
Such filelog information is useful only for hgweb debugging, and may
confuse users.
This patch shows revision numbers and hash values gotten from
changelog in "comparison" page.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 17 Apr 2014 09:36:09 +0900 |
parents | 50981ce36236 |
children | a65714215377 |
files | mercurial/hgweb/webcommands.py tests/test-hgweb-diffs.t |
diffstat | 2 files changed, 35 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py Thu Apr 17 09:36:08 2014 +0900 +++ b/mercurial/hgweb/webcommands.py Thu Apr 17 09:36:09 2014 +0900 @@ -8,7 +8,7 @@ import os, mimetypes, re, cgi, copy import webutil from mercurial import error, encoding, archival, templater, templatefilters -from mercurial.node import short, hex, nullid +from mercurial.node import short, hex from mercurial import util from common import paritygen, staticfile, get_contact, ErrorResponse from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND @@ -712,28 +712,22 @@ return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))] return f.data().splitlines() + parent = ctx.p1() + leftrev = parent.rev() + leftnode = parent.node() + rightrev = ctx.rev() + rightnode = ctx.node() if path in ctx: fctx = ctx[path] - rightrev = fctx.filerev() - rightnode = fctx.filenode() rightlines = filelines(fctx) - parent = ctx.p1() if path not in parent: - leftrev = -1 - leftnode = nullid leftlines = () else: pfctx = parent[path] - leftrev = pfctx.filerev() - leftnode = pfctx.filenode() leftlines = filelines(pfctx) else: - rightrev = -1 - rightnode = nullid rightlines = () fctx = ctx.parents()[0][path] - leftrev = fctx.filerev() - leftnode = fctx.filenode() leftlines = filelines(fctx) comparison = webutil.compare(tmpl, context, leftlines, rightlines)
--- a/tests/test-hgweb-diffs.t Thu Apr 17 09:36:08 2014 +0900 +++ b/tests/test-hgweb-diffs.t Thu Apr 17 09:36:09 2014 +0900 @@ -576,6 +576,10 @@ comparison new file + $ hg parents --template "{rev}:{node|short}\n" -r 0 + $ hg log --template "{rev}:{node|short}\n" -r 0 + 0:0cd96de13884 + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/0/a' 200 Script output follows @@ -667,7 +671,7 @@ <thead class="header"> <tr> <th>-1:000000000000</th> - <th>0:b789fdd96dc2</th> + <th>0:0cd96de13884</th> </tr> </thead> @@ -697,6 +701,12 @@ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo a >> a $ hg ci -mc + + $ hg parents --template "{rev}:{node|short}\n" -r tip + 1:559edbd9ed20 + $ hg log --template "{rev}:{node|short}\n" -r tip + 2:d73db4d812ff + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/a' 200 Script output follows @@ -787,8 +797,8 @@ <table class="bigtable"> <thead class="header"> <tr> - <th>0:b789fdd96dc2</th> - <th>1:a80d06849b33</th> + <th>1:559edbd9ed20</th> + <th>2:d73db4d812ff</th> </tr> </thead> @@ -820,6 +830,12 @@ $ hg rm a $ hg ci -md + + $ hg parents --template "{rev}:{node|short}\n" -r tip + 2:d73db4d812ff + $ hg log --template "{rev}:{node|short}\n" -r tip + 3:20e80271eb7a + $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/a' 200 Script output follows @@ -910,8 +926,8 @@ <table class="bigtable"> <thead class="header"> <tr> - <th>1:a80d06849b33</th> - <th>-1:000000000000</th> + <th>2:d73db4d812ff</th> + <th>3:20e80271eb7a</th> </tr> </thead> @@ -947,13 +963,13 @@ $ echo f > f $ hg add f $ hg ci -m f - $ hg tip --template "{node|short}\n" - 41d9fc4a6ae1 + $ hg tip --template "{rev}:{node|short}\n" + 5:41d9fc4a6ae1 $ hg diff -c tip e - $ hg parents --template "{node|short}\n" -r tip - 402bea3b0976 - $ hg parents --template "{node|short}\n" -r tip e - 402bea3b0976 + $ hg parents --template "{rev}:{node|short}\n" -r tip + 4:402bea3b0976 + $ hg parents --template "{rev}:{node|short}\n" -r tip e + 4:402bea3b0976 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'comparison/tip/e' 200 Script output follows @@ -1045,8 +1061,8 @@ <table class="bigtable"> <thead class="header"> <tr> - <th>0:6b67ccefd5ce</th> - <th>0:6b67ccefd5ce</th> + <th>4:402bea3b0976</th> + <th>5:41d9fc4a6ae1</th> </tr> </thead>