# HG changeset patch # User Pierre-Yves David # Date 1357840490 -3600 # Node ID 1eaf0d017b2cb9c9b09247ef3c4bb3af7938734f # Parent 1da84a6b136ad58d4b1ea1f1cce2f883b22cf9bb hgweb: move hex creation into an object method This is clearer and allow later overwrite. diff -r 1da84a6b136a -r 1eaf0d017b2c mercurial/hgweb/webutil.py --- 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