mercurial/hgweb/hgweb_mod.py
changeset 3673 eb0b4a2d70a9
parent 3612 d1b16a746db6
child 3782 713e35dcc321
equal deleted inserted replaced
3672:e8730b5b8a32 3673:eb0b4a2d70a9
   137             return [dict(file=r[0], node=hex(r[1]))]
   137             return [dict(file=r[0], node=hex(r[1]))]
   138         return []
   138         return []
   139 
   139 
   140     def showtag(self, t1, node=nullid, **args):
   140     def showtag(self, t1, node=nullid, **args):
   141         for t in self.repo.nodetags(node):
   141         for t in self.repo.nodetags(node):
   142              yield self.t(t1, tag=t, **args)
   142             yield self.t(t1, tag=t, **args)
   143 
   143 
   144     def diff(self, node1, node2, files):
   144     def diff(self, node1, node2, files):
   145         def filterfiles(filters, files):
   145         def filterfiles(filters, files):
   146             l = [x for x in files if x in filters]
   146             l = [x for x in files if x in filters]
   147 
   147 
   329         f = fctx.path()
   329         f = fctx.path()
   330         fl = fctx.filelog()
   330         fl = fctx.filelog()
   331         count = fl.count()
   331         count = fl.count()
   332         pagelen = self.maxshortchanges
   332         pagelen = self.maxshortchanges
   333         pos = fctx.filerev()
   333         pos = fctx.filerev()
   334         start = max(0, pos - pagelen + 1) 
   334         start = max(0, pos - pagelen + 1)
   335         end = min(count, start + pagelen)
   335         end = min(count, start + pagelen)
   336         pos = end - 1
   336         pos = end - 1
   337 
   337 
   338         def entries(**map):
   338         def entries(**map):
   339             l = []
   339             l = []
   444         if path and path[-1] != "/":
   444         if path and path[-1] != "/":
   445             path += "/"
   445             path += "/"
   446         l = len(path)
   446         l = len(path)
   447         abspath = "/" + path
   447         abspath = "/" + path
   448 
   448 
   449         for f,n in mf.items():
   449         for f, n in mf.items():
   450             if f[:l] != path:
   450             if f[:l] != path:
   451                 continue
   451                 continue
   452             remain = f[l:]
   452             remain = f[l:]
   453             if "/" in remain:
   453             if "/" in remain:
   454                 short = remain[:remain.index("/") + 1] # bleah
   454                 short = remain[:remain.index("/") + 1] # bleah
   502         i = self.repo.tagslist()
   502         i = self.repo.tagslist()
   503         i.reverse()
   503         i.reverse()
   504 
   504 
   505         def entries(notip=False, **map):
   505         def entries(notip=False, **map):
   506             parity = 0
   506             parity = 0
   507             for k,n in i:
   507             for k, n in i:
   508                 if notip and k == "tip": continue
   508                 if notip and k == "tip":
       
   509                     continue
   509                 yield {"parity": self.stripes(parity),
   510                 yield {"parity": self.stripes(parity),
   510                        "tag": k,
   511                        "tag": k,
   511                        "date": cl.read(n)[2],
   512                        "date": cl.read(n)[2],
   512                        "node": hex(n)}
   513                        "node": hex(n)}
   513                 parity += 1
   514                 parity += 1
   524         i.reverse()
   525         i.reverse()
   525 
   526 
   526         def tagentries(**map):
   527         def tagentries(**map):
   527             parity = 0
   528             parity = 0
   528             count = 0
   529             count = 0
   529             for k,n in i:
   530             for k, n in i:
   530                 if k == "tip": # skip tip
   531                 if k == "tip": # skip tip
   531                     continue;
   532                     continue;
   532 
   533 
   533                 count += 1
   534                 count += 1
   534                 if count > 10: # limit to 10 tags
   535                 if count > 10: # limit to 10 tags
   803                                                "rawfileheader": rawfileheader,
   804                                                "rawfileheader": rawfileheader,
   804                                                "sessionvars": sessionvars
   805                                                "sessionvars": sessionvars
   805                                                })
   806                                                })
   806 
   807 
   807         if not req.form.has_key('cmd'):
   808         if not req.form.has_key('cmd'):
   808             req.form['cmd'] = [self.t.cache['default'],]
   809             req.form['cmd'] = [self.t.cache['default']]
   809 
   810 
   810         cmd = req.form['cmd'][0]
   811         cmd = req.form['cmd'][0]
   811 
   812 
   812         method = getattr(self, 'do_' + cmd, None)
   813         method = getattr(self, 'do_' + cmd, None)
   813         if method:
   814         if method: