Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/hgweb.py @ 351:9525208e1c1d
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-----
author | mpm@selenic.com |
---|---|
date | Wed, 15 Jun 2005 00:50:44 -0800 |
parents | b4e0e20646bb |
children | 0c4688e9ee5c |
comparison
equal
deleted
inserted
replaced
350:b4e0e20646bb | 351:9525208e1c1d |
---|---|
230 l = [] | 230 l = [] |
231 for f in seq(): | 231 for f in seq(): |
232 if f < self.maxchanges / 2: continue | 232 if f < self.maxchanges / 2: continue |
233 if f > count: break | 233 if f > count: break |
234 r = "%d" % f | 234 r = "%d" % f |
235 if pos + f < count - (f/2): l.append(("+" + r, pos + f)) | 235 if pos + f < count: l.append(("+" + r, pos + f)) |
236 if pos - f >= 0 + (f/2): l.insert(0, ("-" + r, pos - f)) | 236 if pos - f >= 0: l.insert(0, ("-" + r, pos - f)) |
237 | 237 |
238 yield self.t("naventry", rev = 0, label="(0)") | 238 yield self.t("naventry", rev = 0, label="(0)") |
239 | 239 |
240 for label, rev in l: | 240 for label, rev in l: |
241 yield self.t("naventry", label = label, rev = rev) | 241 yield self.t("naventry", label = label, rev = rev) |
244 | 244 |
245 def changelist(): | 245 def changelist(): |
246 parity = (start - end) & 1 | 246 parity = (start - end) & 1 |
247 cl = self.repo.changelog | 247 cl = self.repo.changelog |
248 l = [] # build a list in forward order for efficiency | 248 l = [] # build a list in forward order for efficiency |
249 for i in range(start, end + 1): | 249 for i in range(start, end): |
250 n = cl.node(i) | 250 n = cl.node(i) |
251 changes = cl.read(n) | 251 changes = cl.read(n) |
252 hn = hex(n) | 252 hn = hex(n) |
253 p1, p2 = cl.parents(n) | 253 p1, p2 = cl.parents(n) |
254 t = float(changes[2].split(' ')[0]) | 254 t = float(changes[2].split(' ')[0]) |
274 yield l | 274 yield l |
275 | 275 |
276 cl = self.repo.changelog | 276 cl = self.repo.changelog |
277 mf = cl.read(cl.tip())[0] | 277 mf = cl.read(cl.tip())[0] |
278 count = cl.count() | 278 count = cl.count() |
279 end = min(pos, count - 1) | 279 start = max(0, pos - self.maxchanges + 1) |
280 start = max(0, pos - self.maxchanges) | 280 end = min(count, start + self.maxchanges) |
281 end = min(count - 1, start + self.maxchanges) | 281 pos = end - 1 |
282 | 282 |
283 yield self.t('changelog', | 283 yield self.t('changelog', |
284 header = self.header(), | 284 header = self.header(), |
285 footer = self.footer(), | 285 footer = self.footer(), |
286 repo = self.reponame, | 286 repo = self.reponame, |
579 if os.path.isfile(p): m = p | 579 if os.path.isfile(p): m = p |
580 | 580 |
581 self.t = templater(m, self.filters) | 581 self.t = templater(m, self.filters) |
582 | 582 |
583 if not args.has_key('cmd') or args['cmd'][0] == 'changelog': | 583 if not args.has_key('cmd') or args['cmd'][0] == 'changelog': |
584 hi = self.repo.changelog.count() | 584 hi = self.repo.changelog.count() - 1 |
585 if args.has_key('rev'): | 585 if args.has_key('rev'): |
586 hi = args['rev'][0] | 586 hi = args['rev'][0] |
587 try: | 587 try: |
588 hi = self.repo.changelog.rev(self.repo.lookup(hi)) | 588 hi = self.repo.changelog.rev(self.repo.lookup(hi)) |
589 except KeyError: | 589 except KeyError: pass |
590 hi = self.repo.changelog.count() | |
591 | 590 |
592 write(self.changelog(hi)) | 591 write(self.changelog(hi)) |
593 | 592 |
594 elif args['cmd'][0] == 'changeset': | 593 elif args['cmd'][0] == 'changeset': |
595 write(self.changeset(args['node'][0])) | 594 write(self.changeset(args['node'][0])) |