mercurial/hgweb.py
changeset 168 65cf1b0cfe86
parent 166 39624c47060f
child 172 e9b1147db448
equal deleted inserted replaced
167:fad9ad1ec7c7 168:65cf1b0cfe86
   238                     node = hn))
   238                     node = hn))
   239                 parity = 1 - parity
   239                 parity = 1 - parity
   240 
   240 
   241             yield l
   241             yield l
   242 
   242 
   243         count = self.repo.changelog.count()
   243         cl = self.repo.changelog
       
   244         mf = cl.read(cl.tip())[0]
       
   245         count = cl.count()
   244         pos = pos or count - 1
   246         pos = pos or count - 1
   245         end = min(pos, count - 1)
   247         end = min(pos, count - 1)
   246         start = max(0, pos - self.maxchanges)
   248         start = max(0, pos - self.maxchanges)
   247         end = min(count - 1, start + self.maxchanges)
   249         end = min(count - 1, start + self.maxchanges)
   248 
   250 
   249         yield self.t('changelog',
   251         yield self.t('changelog',
   250                      header = self.header(),
   252                      header = self.header(),
   251                      footer = self.footer(),
   253                      footer = self.footer(),
   252                      repo = self.reponame,
   254                      repo = self.reponame,
   253                      changenav = changenav,
   255                      changenav = changenav,
       
   256                      manifest = hex(mf),
   254                      rev = pos, changesets = count, entries = changelist)
   257                      rev = pos, changesets = count, entries = changelist)
   255 
   258 
   256     def changeset(self, nodeid):
   259     def changeset(self, nodeid):
   257         n = bin(nodeid)
   260         n = bin(nodeid)
   258         cl = self.repo.changelog
   261         cl = self.repo.changelog
   490                      node = hex(node),
   493                      node = hex(node),
   491                      path = path,
   494                      path = path,
   492                      up = up(path),
   495                      up = up(path),
   493                      entries = filelist)
   496                      entries = filelist)
   494 
   497 
       
   498     def tags(self):
       
   499         cl = self.repo.changelog
       
   500         mf = cl.read(cl.tip())[0]
       
   501 
       
   502         self.repo.lookup(0) # prime the cache
       
   503         i = self.repo.tags.items()
       
   504         i.sort()
       
   505 
       
   506         def entries():
       
   507             parity = 0
       
   508             for k,n in i:
       
   509                 yield self.t("tagentry",
       
   510                              parity = parity,
       
   511                              tag = k,
       
   512                              node = hex(n))
       
   513                 parity = 1 - parity
       
   514 
       
   515         yield self.t("tags",
       
   516                      header = self.header(),
       
   517                      footer = self.footer(),
       
   518                      repo = self.reponame,
       
   519                      manifest = hex(mf),
       
   520                      entries = entries)
       
   521 
   495     def filediff(self, file, changeset):
   522     def filediff(self, file, changeset):
   496         n = bin(changeset)
   523         n = bin(changeset)
   497         cl = self.repo.changelog
   524         cl = self.repo.changelog
   498         p1 = cl.parents(n)[0]
   525         p1 = cl.parents(n)[0]
   499         cs = cl.read(n)
   526         cs = cl.read(n)
   535         elif args['cmd'][0] == 'changeset':
   562         elif args['cmd'][0] == 'changeset':
   536             write(self.changeset(args['node'][0]))
   563             write(self.changeset(args['node'][0]))
   537 
   564 
   538         elif args['cmd'][0] == 'manifest':
   565         elif args['cmd'][0] == 'manifest':
   539             write(self.manifest(args['manifest'][0], args['path'][0]))
   566             write(self.manifest(args['manifest'][0], args['path'][0]))
       
   567 
       
   568         elif args['cmd'][0] == 'tags':
       
   569             write(self.tags())
   540 
   570 
   541         elif args['cmd'][0] == 'filediff':
   571         elif args['cmd'][0] == 'filediff':
   542             write(self.filediff(args['file'][0], args['node'][0]))
   572             write(self.filediff(args['file'][0], args['node'][0]))
   543 
   573 
   544         elif args['cmd'][0] == 'file':
   574         elif args['cmd'][0] == 'file':