# HG changeset patch # User mpm@selenic.com # Date 1118825444 28800 # Node ID 9525208e1c1da9e8676f31cdddfaa128dc5ffad8 # Parent b4e0e20646bbdd28ff6a7739250d6bd501445822 hgweb: change number navigation tidy up -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hgweb: change number navigation tidy up manifest hash: 9fe0ad4fba9a7a0d4c604299024ce7732198c831 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCr+vkywK+sNU5EO8RAiOyAJ92O9ALuJTbVPPGC/x6vL6yK7GggwCgs4ta 5StdA4D/dOEUvN6O3xicKhk= =fP4C -----END PGP SIGNATURE----- diff -r b4e0e20646bb -r 9525208e1c1d mercurial/hgweb.py --- a/mercurial/hgweb.py Wed Jun 15 00:33:57 2005 -0800 +++ b/mercurial/hgweb.py Wed Jun 15 00:50:44 2005 -0800 @@ -232,8 +232,8 @@ if f < self.maxchanges / 2: continue if f > count: break r = "%d" % f - if pos + f < count - (f/2): l.append(("+" + r, pos + f)) - if pos - f >= 0 + (f/2): l.insert(0, ("-" + r, pos - f)) + if pos + f < count: l.append(("+" + r, pos + f)) + if pos - f >= 0: l.insert(0, ("-" + r, pos - f)) yield self.t("naventry", rev = 0, label="(0)") @@ -246,7 +246,7 @@ parity = (start - end) & 1 cl = self.repo.changelog l = [] # build a list in forward order for efficiency - for i in range(start, end + 1): + for i in range(start, end): n = cl.node(i) changes = cl.read(n) hn = hex(n) @@ -276,9 +276,9 @@ cl = self.repo.changelog mf = cl.read(cl.tip())[0] count = cl.count() - end = min(pos, count - 1) - start = max(0, pos - self.maxchanges) - end = min(count - 1, start + self.maxchanges) + start = max(0, pos - self.maxchanges + 1) + end = min(count, start + self.maxchanges) + pos = end - 1 yield self.t('changelog', header = self.header(), @@ -581,13 +581,12 @@ self.t = templater(m, self.filters) if not args.has_key('cmd') or args['cmd'][0] == 'changelog': - hi = self.repo.changelog.count() + hi = self.repo.changelog.count() - 1 if args.has_key('rev'): hi = args['rev'][0] try: hi = self.repo.changelog.rev(self.repo.lookup(hi)) - except KeyError: - hi = self.repo.changelog.count() + except KeyError: pass write(self.changelog(hi))