Mercurial > hg-stable
changeset 18405:1eaf0d017b2c
hgweb: move hex creation into an object method
This is clearer and allow later overwrite.
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Thu, 10 Jan 2013 18:54:50 +0100 |
parents | 1da84a6b136a |
children | 20cf53932b6f |
files | mercurial/hgweb/webutil.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py Thu Jan 10 18:59:37 2013 +0100 +++ b/mercurial/hgweb/webutil.py Thu Jan 10 18:54:50 2013 +0100 @@ -48,6 +48,9 @@ """ self.nodefunc = nodefunc + def hex(self, rev): + return self.nodefunc(rev).hex() + def gen(self, pos, pagelen, limit): """computes label and revision id for navigation link @@ -69,15 +72,13 @@ if f > limit: break if pos + f < limit: - navafter.append(("+%d" % f, - hex(self.nodefunc(pos + f).node()))) + navafter.append(("+%d" % f, self.hex(pos + f))) if pos - f >= 0: - navbefore.insert(0, ("-%d" % f, - hex(self.nodefunc(pos - f).node()))) + navbefore.insert(0, ("-%d" % f, self.hex(pos - f))) navafter.append(("tip", "tip")) try: - navbefore.insert(0, ("(0)", hex(self.nodefunc(0).node()))) + navbefore.insert(0, ("(0)", self.hex(0))) except error.RepoError: pass