comparison mercurial/hgweb/webutil.py @ 7345:55651328dfcc

hgweb: fix up the less/more links on the graph page Previously, they pointed to a non-intuitive revision, and got borked when using a URL-specified style combined with alternate revcounts.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 07 Nov 2008 23:31:12 +0100
parents de9c87fe1620
children 9fe97eea5510
comparison
equal deleted inserted replaced
7336:2dc868712dcc 7345:55651328dfcc
4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> 4 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
5 # 5 #
6 # This software may be used and distributed according to the terms 6 # This software may be used and distributed according to the terms
7 # of the GNU General Public License, incorporated herein by reference. 7 # of the GNU General Public License, incorporated herein by reference.
8 8
9 import os 9 import os, copy
10 from mercurial import match, patch 10 from mercurial import match, patch
11 from mercurial.node import hex, nullid 11 from mercurial.node import hex, nullid
12 from mercurial.repo import RepoError 12 from mercurial.repo import RepoError
13 from mercurial import util 13 from mercurial import util
14 14
194 if chunk.startswith('diff'): 194 if chunk.startswith('diff'):
195 chunk = ''.join(chunk.splitlines(True)[1:]) 195 chunk = ''.join(chunk.splitlines(True)[1:])
196 block.append(chunk) 196 block.append(chunk)
197 yield tmpl('diffblock', parity=parity.next(), 197 yield tmpl('diffblock', parity=parity.next(),
198 lines=prettyprintlines(''.join(block))) 198 lines=prettyprintlines(''.join(block)))
199
200 class sessionvars(object):
201 def __init__(self, vars, start='?'):
202 self.start = start
203 self.vars = vars
204 def __getitem__(self, key):
205 return self.vars[key]
206 def __setitem__(self, key, value):
207 self.vars[key] = value
208 def __copy__(self):
209 return sessionvars(copy.copy(self.vars), self.start)
210 def __iter__(self):
211 separator = self.start
212 for key, value in self.vars.iteritems():
213 yield {'name': key, 'value': str(value), 'separator': separator}
214 separator = '&'