comparison mercurial/hgweb/webcommands.py @ 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 8c9e84b44221
children b3e51675f98e
comparison
equal deleted inserted replaced
21122:50981ce36236 21123:92fab48dfec1
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import os, mimetypes, re, cgi, copy 8 import os, mimetypes, re, cgi, copy
9 import webutil 9 import webutil
10 from mercurial import error, encoding, archival, templater, templatefilters 10 from mercurial import error, encoding, archival, templater, templatefilters
11 from mercurial.node import short, hex, nullid 11 from mercurial.node import short, hex
12 from mercurial import util 12 from mercurial import util
13 from common import paritygen, staticfile, get_contact, ErrorResponse 13 from common import paritygen, staticfile, get_contact, ErrorResponse
14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND 14 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
15 from mercurial import graphmod, patch 15 from mercurial import graphmod, patch
16 from mercurial import help as helpmod 16 from mercurial import help as helpmod
710 if not mt: 710 if not mt:
711 mt = 'application/octet-stream' 711 mt = 'application/octet-stream'
712 return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))] 712 return [_('(binary file %s, hash: %s)') % (mt, hex(f.filenode()))]
713 return f.data().splitlines() 713 return f.data().splitlines()
714 714
715 parent = ctx.p1()
716 leftrev = parent.rev()
717 leftnode = parent.node()
718 rightrev = ctx.rev()
719 rightnode = ctx.node()
715 if path in ctx: 720 if path in ctx:
716 fctx = ctx[path] 721 fctx = ctx[path]
717 rightrev = fctx.filerev()
718 rightnode = fctx.filenode()
719 rightlines = filelines(fctx) 722 rightlines = filelines(fctx)
720 parent = ctx.p1()
721 if path not in parent: 723 if path not in parent:
722 leftrev = -1
723 leftnode = nullid
724 leftlines = () 724 leftlines = ()
725 else: 725 else:
726 pfctx = parent[path] 726 pfctx = parent[path]
727 leftrev = pfctx.filerev()
728 leftnode = pfctx.filenode()
729 leftlines = filelines(pfctx) 727 leftlines = filelines(pfctx)
730 else: 728 else:
731 rightrev = -1
732 rightnode = nullid
733 rightlines = () 729 rightlines = ()
734 fctx = ctx.parents()[0][path] 730 fctx = ctx.parents()[0][path]
735 leftrev = fctx.filerev()
736 leftnode = fctx.filenode()
737 leftlines = filelines(fctx) 731 leftlines = filelines(fctx)
738 732
739 comparison = webutil.compare(tmpl, context, leftlines, rightlines) 733 comparison = webutil.compare(tmpl, context, leftlines, rightlines)
740 return tmpl('filecomparison', 734 return tmpl('filecomparison',
741 file=path, 735 file=path,