mercurial/hgweb/webcommands.py
changeset 6747 f6c00b17387c
parent 6720 084c9f1ef2bd
child 6750 fb42030d79d6
equal deleted inserted replaced
6746:1dca460e7d1e 6747:f6c00b17387c
   111 
   111 
   112         def revgen():
   112         def revgen():
   113             for i in xrange(cl.count() - 1, 0, -100):
   113             for i in xrange(cl.count() - 1, 0, -100):
   114                 l = []
   114                 l = []
   115                 for j in xrange(max(0, i - 100), i + 1):
   115                 for j in xrange(max(0, i - 100), i + 1):
   116                     ctx = web.repo.changectx(j)
   116                     ctx = web.repo[j]
   117                     l.append(ctx)
   117                     l.append(ctx)
   118                 l.reverse()
   118                 l.reverse()
   119                 for e in l:
   119                 for e in l:
   120                     yield e
   120                     yield e
   121 
   121 
   168         if 'rev' in req.form:
   168         if 'rev' in req.form:
   169             hi = req.form['rev'][0]
   169             hi = req.form['rev'][0]
   170         else:
   170         else:
   171             hi = web.repo.changelog.count() - 1
   171             hi = web.repo.changelog.count() - 1
   172         try:
   172         try:
   173             ctx = web.repo.changectx(hi)
   173             ctx = web.repo[hi]
   174         except RepoError:
   174         except RepoError:
   175             return _search(web, tmpl, hi) # XXX redirect to 404 page?
   175             return _search(web, tmpl, hi) # XXX redirect to 404 page?
   176 
   176 
   177     def changelist(limit=0, **map):
   177     def changelist(limit=0, **map):
   178         cl = web.repo.changelog
   178         cl = web.repo.changelog
   179         l = [] # build a list in forward order for efficiency
   179         l = [] # build a list in forward order for efficiency
   180         for i in xrange(start, end):
   180         for i in xrange(start, end):
   181             ctx = web.repo.changectx(i)
   181             ctx = web.repo[i]
   182             n = ctx.node()
   182             n = ctx.node()
   183             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
   183             showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n)
   184 
   184 
   185             l.insert(0, {"parity": parity.next(),
   185             l.insert(0, {"parity": parity.next(),
   186                          "author": ctx.user(),
   186                          "author": ctx.user(),
   297 
   297 
   298             fctx = ctx.filectx(full)
   298             fctx = ctx.filectx(full)
   299             yield {"file": full,
   299             yield {"file": full,
   300                    "parity": parity.next(),
   300                    "parity": parity.next(),
   301                    "basename": f,
   301                    "basename": f,
   302                    "date": fctx.changectx().date(),
   302                    "date": fctx.date(),
   303                    "size": fctx.size(),
   303                    "size": fctx.size(),
   304                    "permissions": mf.flags(full)}
   304                    "permissions": mf.flags(full)}
   305 
   305 
   306     def dirlist(**map):
   306     def dirlist(**map):
   307         fl = files.keys()
   307         fl = files.keys()
   341             if limit > 0 and count >= limit:
   341             if limit > 0 and count >= limit:
   342                 continue
   342                 continue
   343             count = count + 1
   343             count = count + 1
   344             yield {"parity": parity.next(),
   344             yield {"parity": parity.next(),
   345                    "tag": k,
   345                    "tag": k,
   346                    "date": web.repo.changectx(n).date(),
   346                    "date": web.repo[n].date(),
   347                    "node": hex(n)}
   347                    "node": hex(n)}
   348 
   348 
   349     return tmpl("tags",
   349     return tmpl("tags",
   350                 node=hex(web.repo.changelog.tip()),
   350                 node=hex(web.repo.changelog.tip()),
   351                 entries=lambda **x: entries(False,0, **x),
   351                 entries=lambda **x: entries(False,0, **x),
   369 
   369 
   370             yield tmpl("tagentry",
   370             yield tmpl("tagentry",
   371                        parity=parity.next(),
   371                        parity=parity.next(),
   372                        tag=k,
   372                        tag=k,
   373                        node=hex(n),
   373                        node=hex(n),
   374                        date=web.repo.changectx(n).date())
   374                        date=web.repo[n].date())
   375 
   375 
   376     def branches(**map):
   376     def branches(**map):
   377         parity = paritygen(web.stripecount)
   377         parity = paritygen(web.stripecount)
   378 
   378 
   379         b = web.repo.branchtags()
   379         b = web.repo.branchtags()
   380         l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.items()]
   380         l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.items()]
   381         l.sort()
   381         l.sort()
   382 
   382 
   383         for r,n,t in l:
   383         for r,n,t in l:
   384             ctx = web.repo.changectx(n)
       
   385             yield {'parity': parity.next(),
   384             yield {'parity': parity.next(),
   386                    'branch': t,
   385                    'branch': t,
   387                    'node': hex(n),
   386                    'node': hex(n),
   388                    'date': ctx.date()}
   387                    'date': web.repo[n].date()}
   389 
   388 
   390     def changelist(**map):
   389     def changelist(**map):
   391         parity = paritygen(web.stripecount, offset=start-end)
   390         parity = paritygen(web.stripecount, offset=start-end)
   392         l = [] # build a list in forward order for efficiency
   391         l = [] # build a list in forward order for efficiency
   393         for i in xrange(start, end):
   392         for i in xrange(start, end):
   394             ctx = web.repo.changectx(i)
   393             ctx = web.repo[i]
   395             n = ctx.node()
   394             n = ctx.node()
   396             hn = hex(n)
   395             hn = hex(n)
   397 
   396 
   398             l.insert(0, tmpl(
   397             l.insert(0, tmpl(
   399                'shortlogentry',
   398                'shortlogentry',