changeset 7414:040484030491

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Tue, 25 Nov 2008 16:24:22 -0600
parents 5751631246de (current diff) 0b6428da1f22 (diff)
children 6163ef936a00
files hgext/mq.py mercurial/commands.py mercurial/util.py templates/coal/changeset.tmpl templates/coal/error.tmpl templates/coal/fileannotate.tmpl templates/coal/filediff.tmpl templates/coal/filelog.tmpl templates/coal/filelogentry.tmpl templates/coal/filerevision.tmpl templates/coal/footer.tmpl templates/coal/graph.tmpl templates/coal/index.tmpl templates/coal/manifest.tmpl templates/coal/notfound.tmpl templates/coal/search.tmpl templates/coal/shortlog.tmpl templates/coal/shortlogentry.tmpl templates/coal/tags.tmpl
diffstat 70 files changed, 1423 insertions(+), 1143 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/inotify/__init__.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/hgext/inotify/__init__.py	Tue Nov 25 16:24:22 2008 -0600
@@ -52,6 +52,8 @@
 
         def status(self, match, ignored, clean, unknown=True):
             files = match.files()
+            if '.' in files:
+                files = [] 
             try:
                 if not ignored and not self.inotifyserver:
                     result = client.query(ui, repo, files, match, False,
--- a/hgext/keyword.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/hgext/keyword.py	Tue Nov 25 16:24:22 2008 -0600
@@ -487,10 +487,10 @@
                 del wlock, lock
 
     # monkeypatches
-    def kwpatchfile_init(orig, self, ui, fname, missing=False):
+    def kwpatchfile_init(orig, self, ui, fname, opener, missing=False):
         '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
         rejects or conflicts due to expanded keywords in working dir.'''
-        orig(self, ui, fname, missing)
+        orig(self, ui, fname, opener, missing)
         # shrink keywords read from working dir
         self.lines = kwt.shrinklines(self.fname, self.lines)
 
--- a/hgext/mq.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/hgext/mq.py	Tue Nov 25 16:24:22 2008 -0600
@@ -56,6 +56,67 @@
     def __str__(self):
         return self.rev + ':' + self.name
 
+class patchheader(object):
+    def __init__(self, message, comments, user, date, haspatch):
+        self.message = message
+        self.comments = comments
+        self.user = user
+        self.date = date
+        self.haspatch = haspatch
+
+    def setuser(self, user):
+        if not self.setheader(['From: ', '# User '], user):
+            try:
+                patchheaderat = self.comments.index('# HG changeset patch')
+                self.comments.insert(patchheaderat + 1,'# User ' + user)
+            except ValueError:
+                self.comments = ['From: ' + user, ''] + self.comments
+        self.user = user
+
+    def setdate(self, date):
+        if self.setheader(['# Date '], date):
+            self.date = date
+
+    def setmessage(self, message):
+        if self.comments:
+            self._delmsg()
+        self.message = [message]
+        self.comments += self.message
+
+    def setheader(self, prefixes, new):
+        '''Update all references to a field in the patch header.
+        If none found, add it email style.'''
+        res = False
+        for prefix in prefixes:
+            for i in xrange(len(self.comments)):
+                if self.comments[i].startswith(prefix):
+                    self.comments[i] = prefix + new
+                    res = True
+                    break
+        return res
+
+    def __str__(self):
+        if not self.comments:
+            return ''
+        return '\n'.join(self.comments) + '\n\n'
+
+    def _delmsg(self):
+        '''Remove existing message, keeping the rest of the comments fields.
+        If comments contains 'subject: ', message will prepend
+        the field and a blank line.'''
+        if self.message:
+            subj = 'subject: ' + self.message[0].lower()
+            for i in xrange(len(self.comments)):
+                if subj == self.comments[i].lower():
+                    del self.comments[i]
+                    self.message = self.message[2:]
+                    break
+        ci = 0
+        for mi in xrange(len(self.message)):
+            while self.message[mi] != self.comments[ci]:
+                ci += 1
+            del self.comments[ci]
+
 class queue:
     def __init__(self, ui, path, patchdir=None):
         self.basepath = path
@@ -307,7 +368,7 @@
         if format and format.startswith("tag") and subject:
             message.insert(0, "")
             message.insert(0, subject)
-        return (message, comments, user, date, diffstart > 1)
+        return patchheader(message, comments, user, date, diffstart > 1)
 
     def removeundo(self, repo):
         undo = repo.sjoin('undo')
@@ -351,13 +412,13 @@
         if n == None:
             raise util.Abort(_("repo commit failed"))
         try:
-            message, comments, user, date, patchfound = mergeq.readheaders(patch)
+            ph = mergeq.readheaders(patch)
         except:
             raise util.Abort(_("unable to read %s") % patch)
 
         patchf = self.opener(patch, "w")
+        comments = str(ph)
         if comments:
-            comments = "\n".join(comments) + '\n\n'
             patchf.write(comments)
         self.printdiff(repo, head, n, fp=patchf)
         patchf.close()
@@ -477,12 +538,13 @@
             pf = os.path.join(patchdir, patchname)
 
             try:
-                message, comments, user, date, patchfound = self.readheaders(patchname)
+                ph = self.readheaders(patchname)
             except:
                 self.ui.warn(_("Unable to read %s\n") % patchname)
                 err = 1
                 break
 
+            message = ph.message
             if not message:
                 message = _("imported patch %s\n") % patchname
             else:
@@ -512,7 +574,7 @@
 
             files = patch.updatedir(self.ui, repo, files)
             match = cmdutil.matchfiles(repo, files or [])
-            n = repo.commit(files, message, user, date, match=match,
+            n = repo.commit(files, message, ph.user, ph.date, match=match,
                             force=True)
 
             if n == None:
@@ -522,7 +584,7 @@
                 self.applied.append(statusentry(revlog.hex(n), patchname))
 
             if patcherr:
-                if not patchfound:
+                if not ph.haspatch:
                     self.ui.warn(_("patch %s is empty\n") % patchname)
                     err = 0
                 else:
@@ -824,11 +886,15 @@
         raise util.Abort(_("patch %s not in series") % patch)
 
     def push(self, repo, patch=None, force=False, list=False,
-             mergeq=None):
+             mergeq=None, all=False):
         wlock = repo.wlock()
         if repo.dirstate.parents()[0] != repo.changelog.tip():
             self.ui.status(_("(working directory not at tip)\n"))
 
+        if not self.series:
+            self.ui.warn(_('no patches in series\n'))
+            return 0
+
         try:
             patch = self.lookup(patch)
             # Suppose our series file is: A B C and the current 'top'
@@ -841,26 +907,36 @@
                     if info[0] < len(self.applied) - 1:
                         raise util.Abort(
                             _("cannot push to a previous patch: %s") % patch)
-                    if info[0] < len(self.series) - 1:
-                        self.ui.warn(
-                            _('qpush: %s is already at the top\n') % patch)
+                    self.ui.warn(
+                        _('qpush: %s is already at the top\n') % patch)
+                    return
+                pushable, reason = self.pushable(patch)
+                if not pushable:
+                    if reason:
+                        reason = _('guarded by %r') % reason
                     else:
-                        self.ui.warn(_('all patches are currently applied\n'))
-                    return
+                        reason = _('no matching guards')
+                    self.ui.warn(_("cannot push '%s' - %s\n") % (patch, reason))
+                    return 1
+            elif all:
+                patch = self.series[-1]
+                if self.isapplied(patch):
+                    self.ui.warn(_('all patches are currently applied\n'))
+                    return 0
 
             # Following the above example, starting at 'top' of B:
             # qpush should be performed (pushes C), but a subsequent
             # qpush without an argument is an error (nothing to
             # apply). This allows a loop of "...while hg qpush..." to
             # work as it detects an error when done
-            if self.series_end() == len(self.series):
+            start = self.series_end()
+            if start == len(self.series):
                 self.ui.warn(_('patch series already fully applied\n'))
                 return 1
             if not force:
                 self.check_localchanges(repo)
 
-            self.applied_dirty = 1;
-            start = self.series_end()
+            self.applied_dirty = 1
             if start > 0:
                 self.check_toppatch(repo)
             if not patch:
@@ -1001,6 +1077,8 @@
         if len(self.applied) == 0:
             self.ui.write(_("No patches applied\n"))
             return 1
+        msg = opts.get('msg', '').rstrip()
+        newuser = opts.get('user')
         newdate = opts.get('date')
         if newdate:
             newdate = '%d %d' % util.parsedate(newdate)
@@ -1013,9 +1091,9 @@
                 raise util.Abort(_("cannot refresh a revision with children"))
             cparents = repo.changelog.parents(top)
             patchparent = self.qparents(repo, top)
-            message, comments, user, date, patchfound = self.readheaders(patchfn)
+            ph = self.readheaders(patchfn)
 
-            patchf = self.opener(patchfn, 'r+')
+            patchf = self.opener(patchfn, 'r')
 
             # if the patch was a git patch, refresh it as a git patch
             for line in patchf:
@@ -1023,59 +1101,21 @@
                     self.diffopts().git = True
                     break
 
-            msg = opts.get('msg', '').rstrip()
-            if msg and comments:
-                # Remove existing message, keeping the rest of the comments
-                # fields.
-                # If comments contains 'subject: ', message will prepend
-                # the field and a blank line.
-                if message:
-                    subj = 'subject: ' + message[0].lower()
-                    for i in xrange(len(comments)):
-                        if subj == comments[i].lower():
-                            del comments[i]
-                            message = message[2:]
-                            break
-                ci = 0
-                for mi in xrange(len(message)):
-                    while message[mi] != comments[ci]:
-                        ci += 1
-                    del comments[ci]
+            if msg:
+                ph.setmessage(msg)
+            if newuser:
+                ph.setuser(newuser)
+            if newdate:
+                ph.setdate(newdate)
 
-            def setheaderfield(comments, prefixes, new):
-                # Update all references to a field in the patch header.
-                # If none found, add it email style.
-                res = False
-                for prefix in prefixes:
-                    for i in xrange(len(comments)):
-                        if comments[i].startswith(prefix):
-                            comments[i] = prefix + new
-                            res = True
-                            break
-                return res
-
-            newuser = opts.get('user')
-            if newuser:
-                if not setheaderfield(comments, ['From: ', '# User '], newuser):
-                    try:
-                        patchheaderat = comments.index('# HG changeset patch')
-                        comments.insert(patchheaderat + 1,'# User ' + newuser)
-                    except ValueError:
-                        comments = ['From: ' + newuser, ''] + comments
-                user = newuser
-
-            if newdate:
-                if setheaderfield(comments, ['# Date '], newdate):
-                    date = newdate
-
-            if msg:
-                comments.append(msg)
+            # only commit new patch when write is complete
+            patchf = self.opener(patchfn, 'w', atomictemp=True)
 
             patchf.seek(0)
             patchf.truncate()
 
+            comments = str(ph)
             if comments:
-                comments = "\n".join(comments) + '\n\n'
                 patchf.write(comments)
 
             if opts.get('git'):
@@ -1148,69 +1188,82 @@
                                     changes=c, opts=self.diffopts())
                 for chunk in chunks:
                     patchf.write(chunk)
-                patchf.close()
 
-                repo.dirstate.setparents(*cparents)
-                copies = {}
-                for dst in a:
-                    src = repo.dirstate.copied(dst)
-                    if src is not None:
-                        copies.setdefault(src, []).append(dst)
-                    repo.dirstate.add(dst)
-                # remember the copies between patchparent and tip
-                # this may be slow, so don't do it if we're not tracking copies
-                if self.diffopts().git:
-                    for dst in aaa:
-                        f = repo.file(dst)
-                        src = f.renamed(man[dst])
-                        if src:
-                            copies.setdefault(src[0], []).extend(copies.get(dst, []))
-                            if dst in a:
-                                copies[src[0]].append(dst)
-                        # we can't copy a file created by the patch itself
-                        if dst in copies:
-                            del copies[dst]
-                for src, dsts in copies.iteritems():
-                    for dst in dsts:
-                        repo.dirstate.copy(src, dst)
-                for f in r:
-                    repo.dirstate.remove(f)
-                # if the patch excludes a modified file, mark that
-                # file with mtime=0 so status can see it.
-                mm = []
-                for i in xrange(len(m)-1, -1, -1):
-                    if not matchfn(m[i]):
-                        mm.append(m[i])
-                        del m[i]
-                for f in m:
-                    repo.dirstate.normal(f)
-                for f in mm:
-                    repo.dirstate.normallookup(f)
-                for f in forget:
-                    repo.dirstate.forget(f)
+                try:
+                    copies = {}
+                    for dst in a:
+                        src = repo.dirstate.copied(dst)
+                        if src is not None:
+                            copies.setdefault(src, []).append(dst)
+                        repo.dirstate.add(dst)
+                    # remember the copies between patchparent and tip
+                    # this may be slow, so don't do it if we're not tracking copies
+                    if self.diffopts().git:
+                        for dst in aaa:
+                            f = repo.file(dst)
+                            src = f.renamed(man[dst])
+                            if src:
+                                copies.setdefault(src[0], []).extend(copies.get(dst, []))
+                                if dst in a:
+                                    copies[src[0]].append(dst)
+                            # we can't copy a file created by the patch itself
+                            if dst in copies:
+                                del copies[dst]
+                    for src, dsts in copies.iteritems():
+                        for dst in dsts:
+                            repo.dirstate.copy(src, dst)
+                    for f in r:
+                        repo.dirstate.remove(f)
+                    # if the patch excludes a modified file, mark that
+                    # file with mtime=0 so status can see it.
+                    mm = []
+                    for i in xrange(len(m)-1, -1, -1):
+                        if not matchfn(m[i]):
+                            mm.append(m[i])
+                            del m[i]
+                    for f in m:
+                        repo.dirstate.normal(f)
+                    for f in mm:
+                        repo.dirstate.normallookup(f)
+                    for f in forget:
+                        repo.dirstate.forget(f)
 
-                if not msg:
-                    if not message:
-                        message = "[mq]: %s\n" % patchfn
+                    if not msg:
+                        if not ph.message:
+                            message = "[mq]: %s\n" % patchfn
+                        else:
+                            message = "\n".join(ph.message)
                     else:
-                        message = "\n".join(message)
-                else:
-                    message = msg
+                        message = msg
+
+                    user = ph.user or changes[1]
 
-                if not user:
-                    user = changes[1]
+                    # assumes strip can roll itself back if interrupted
+                    repo.dirstate.setparents(*cparents)
+                    self.applied.pop()
+                    self.applied_dirty = 1
+                    self.strip(repo, top, update=False,
+                               backup='strip')
+                except:
+                    repo.dirstate.invalidate()
+                    raise
 
-                self.applied.pop()
-                self.applied_dirty = 1
-                self.strip(repo, top, update=False,
-                           backup='strip')
-                n = repo.commit(match.files(), message, user, date, match=match,
-                                force=1)
-                self.applied.append(statusentry(revlog.hex(n), patchfn))
-                self.removeundo(repo)
+                try:
+                    # might be nice to attempt to roll back strip after this
+                    patchf.rename()
+                    n = repo.commit(match.files(), message, user, ph.date,
+                                    match=match, force=1)
+                    self.applied.append(statusentry(revlog.hex(n), patchfn))
+                except:
+                    ctx = repo[cparents[0]]
+                    repo.dirstate.rebuild(ctx.node(), ctx.manifest())
+                    self.save_dirty()
+                    self.ui.warn(_('refresh interrupted while patch was popped! '
+                                   '(revert --all, qpush to recover)\n'))
+                    raise
             else:
                 self.printdiff(repo, patchparent, fp=patchf)
-                patchf.close()
+                patchf.rename()
                 added = repo.status()[1]
                 for a in added:
                     f = repo.wjoin(a)
@@ -1228,6 +1281,7 @@
                 self.push(repo, force=True)
         finally:
             del wlock
+            self.removeundo(repo)
 
     def init(self, repo, create=False):
         if not create and os.path.isdir(self.path):
@@ -1259,7 +1313,8 @@
                 summary=False):
         def displayname(patchname):
             if summary:
-                msg = self.readheaders(patchname)[0]
+                ph = self.readheaders(patchname)
+                msg = ph.message
                 msg = msg and ': ' + msg[0] or ': '
             else:
                 msg = ''
@@ -1815,8 +1870,8 @@
         if message:
             raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
         patch = q.applied[-1].name
-        (message, comment, user, date, hasdiff) = q.readheaders(patch)
-        message = ui.edit('\n'.join(message), user or ui.username())
+        ph = q.readheaders(patch)
+        message = ui.edit('\n'.join(ph.message), ph.user or ui.username())
     setupheaderopts(ui, opts)
     ret = q.refresh(repo, pats, msg=message, **opts)
     q.save_dirty()
@@ -1874,7 +1929,8 @@
 
     for p in patches:
         if not message:
-            messages.append(q.readheaders(p)[0])
+            ph = q.readheaders(p)
+            messages.append(ph.message)
         pf = q.join(p)
         (patchsuccess, files, fuzz) = q.patch(repo, pf)
         if not patchsuccess:
@@ -1882,7 +1938,8 @@
         patch.updatedir(ui, repo, files)
 
     if not message:
-        message, comments, user = q.readheaders(parent)[0:3]
+        ph = q.readheaders(parent)
+        message, user = ph.message, ph.user
         for msg in messages:
             message.append('* * *')
             message.extend(msg)
@@ -1965,9 +2022,9 @@
             ui.write('No patches applied\n')
             return 1
         patch = q.lookup('qtip')
-    message = repo.mq.readheaders(patch)[0]
+    ph = repo.mq.readheaders(patch)
 
-    ui.write('\n'.join(message) + '\n')
+    ui.write('\n'.join(ph.message) + '\n')
 
 def lastsavename(path):
     (directory, base) = os.path.split(path)
@@ -2001,11 +2058,6 @@
     q = repo.mq
     mergeq = None
 
-    if opts['all']:
-        if not q.series:
-            ui.warn(_('no patches in series\n'))
-            return 0
-        patch = q.series[-1]
     if opts['merge']:
         if opts['name']:
             newpath = repo.join(opts['name'])
@@ -2017,7 +2069,7 @@
         mergeq = queue(ui, repo.join(""), newpath)
         ui.warn(_("merging with queue at: %s\n") % mergeq.path)
     ret = q.push(repo, patch, force=opts['force'], list=opts['list'],
-                 mergeq=mergeq)
+                 mergeq=mergeq, all=opts.get('all'))
     return ret
 
 def pop(ui, repo, patch=None, **opts):
--- a/hgext/patchbomb.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/hgext/patchbomb.py	Tue Nov 25 16:24:22 2008 -0600
@@ -402,6 +402,7 @@
             m['Message-Id'] = genmsgid('patchbomb')
         if parent:
             m['In-Reply-To'] = parent
+            m['References'] = parent
         else:
             parent = m['Message-Id']
         m['Date'] = util.datestr(start_time, "%a, %d %b %Y %H:%M:%S %1%2")
--- a/mercurial/cmdutil.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/cmdutil.py	Tue Nov 25 16:24:22 2008 -0600
@@ -1033,6 +1033,8 @@
                 if node is None:
                     # A zero count may be a directory or deleted file, so
                     # try to find matching entries on the slow path.
+                    if follow:
+                        raise util.Abort(_('cannot follow nonexistent file: "%s"') % file_)
                     slowpath = True
                     break
                 else:
--- a/mercurial/commands.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/commands.py	Tue Nov 25 16:24:22 2008 -0600
@@ -1581,6 +1581,9 @@
     recorded in the patch. This may happen due to character set
     problems or other deficiencies in the text patch format.
 
+    With --similarity, hg will attempt to discover renames and copies
+    in the patch in the same way as 'addremove'.
+
     To read a patch from standard input, use patch name "-".
     See 'hg help dates' for a list of formats valid for -d/--date.
     """
@@ -1590,6 +1593,13 @@
     if date:
         opts['date'] = util.parsedate(date)
 
+    try:
+        sim = float(opts.get('similarity') or 0)
+    except ValueError:
+        raise util.Abort(_('similarity must be a number'))
+    if sim < 0 or sim > 100:
+        raise util.Abort(_('similarity must be between 0 and 100'))
+
     if opts.get('exact') or not opts.get('force'):
         cmdutil.bail_if_changed(repo)
 
@@ -1653,7 +1663,7 @@
                     fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root,
                                        files=files)
                 finally:
-                    files = patch.updatedir(ui, repo, files)
+                    files = patch.updatedir(ui, repo, files, similarity=sim/100.)
                 if not opts.get('no_commit'):
                     n = repo.commit(files, message, opts.get('user') or user,
                                     opts.get('date') or date)
@@ -3003,13 +3013,15 @@
     ('U', 'unified', '', _('number of lines of context to show'))
 ]
 
+similarityopts = [
+    ('s', 'similarity', '',
+           _('guess renamed files by similarity (0<=s<=100)'))
+]
+
 table = {
     "^add": (add, walkopts + dryrunopts, _('[OPTION]... [FILE]...')),
     "addremove":
-        (addremove,
-         [('s', 'similarity', '',
-           _('guess renamed files by similarity (0<=s<=100)')),
-         ] + walkopts + dryrunopts,
+        (addremove, similarityopts + walkopts + dryrunopts,
          _('[OPTION]... [FILE]...')),
     "^annotate|blame":
         (annotate,
@@ -3192,7 +3204,7 @@
            _('apply patch to the nodes from which it was generated')),
           ('', 'import-branch', None,
            _('Use any branch information in patch (implied by --exact)'))] +
-         commitopts + commitopts2,
+         commitopts + commitopts2 + similarityopts,
          _('[OPTION]... PATCH...')),
     "incoming|in":
         (incoming,
--- a/mercurial/filemerge.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/filemerge.py	Tue Nov 25 16:24:22 2008 -0600
@@ -32,8 +32,11 @@
         tmsg = tool
         if pat:
             tmsg += " specified for " + pat
-        if pat and not _findtool(ui, tool): # skip search if not matching
-            ui.warn(_("couldn't find merge tool %s\n") % tmsg)
+        if not _findtool(ui, tool):
+            if pat: # explicitly requested tool deserves a warning
+                ui.warn(_("couldn't find merge tool %s\n") % tmsg)
+            else: # configured but non-existing tools are more silent
+                ui.note(_("couldn't find merge tool %s\n") % tmsg)
         elif symlink and not _toolbool(ui, tool, "symlink"):
             ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
         elif binary and not _toolbool(ui, tool, "binary"):
@@ -71,8 +74,8 @@
         tools.insert(0, (None, uimerge)) # highest priority
     tools.append((None, "hgmerge")) # the old default, if found
     for p,t in tools:
-        toolpath = _findtool(ui, t)
-        if toolpath and check(t, None, symlink, binary):
+        if check(t, None, symlink, binary):
+            toolpath = _findtool(ui, t)
             return (t, '"' + toolpath + '"')
     # internal merge as last resort
     return (not (symlink or binary) and "internal:merge" or None, None)
--- a/mercurial/hgweb/hgweb_mod.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/hgweb/hgweb_mod.py	Tue Nov 25 16:24:22 2008 -0600
@@ -182,20 +182,20 @@
                 content = getattr(webcommands, cmd)(self, req, tmpl)
                 req.respond(HTTP_OK, ctype)
 
-            return ''.join(content),
+            return content
 
         except revlog.LookupError, err:
             req.respond(HTTP_NOT_FOUND, ctype)
             msg = str(err)
             if 'manifest' not in msg:
                 msg = 'revision not found: %s' % err.name
-            return ''.join(tmpl('error', error=msg)),
+            return tmpl('error', error=msg)
         except (RepoError, revlog.RevlogError), inst:
             req.respond(HTTP_SERVER_ERROR, ctype)
-            return ''.join(tmpl('error', error=str(inst))),
+            return tmpl('error', error=str(inst))
         except ErrorResponse, inst:
             req.respond(inst.code, ctype)
-            return ''.join(tmpl('error', error=inst.message)),
+            return tmpl('error', error=inst.message)
 
     def templater(self, req):
 
--- a/mercurial/hgweb/hgwebdir_mod.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/hgweb/hgwebdir_mod.py	Tue Nov 25 16:24:22 2008 -0600
@@ -116,7 +116,7 @@
                 # top-level index
                 elif not virtual:
                     req.respond(HTTP_OK, ctype)
-                    return ''.join(self.makeindex(req, tmpl)),
+                    return self.makeindex(req, tmpl)
 
                 # nested indexes and hgwebs
 
@@ -138,7 +138,7 @@
                     subdir = virtual + '/'
                     if [r for r in repos if r.startswith(subdir)]:
                         req.respond(HTTP_OK, ctype)
-                        return ''.join(self.makeindex(req, tmpl, subdir)),
+                        return self.makeindex(req, tmpl, subdir)
 
                     up = virtual.rfind('/')
                     if up < 0:
@@ -147,11 +147,11 @@
 
                 # prefixes not found
                 req.respond(HTTP_NOT_FOUND, ctype)
-                return ''.join(tmpl("notfound", repo=virtual)),
+                return tmpl("notfound", repo=virtual)
 
             except ErrorResponse, err:
                 req.respond(err.code, ctype)
-                return ''.join(tmpl('error', error=err.message or '')),
+                return tmpl('error', error=err.message or '')
         finally:
             tmpl = None
 
--- a/mercurial/hgweb/webcommands.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/hgweb/webcommands.py	Tue Nov 25 16:24:22 2008 -0600
@@ -227,6 +227,7 @@
 def changeset(web, req, tmpl):
     ctx = webutil.changectx(web.repo, req)
     showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node())
+    showbranch = webutil.nodebranchnodefault(ctx)
     parents = ctx.parents()
 
     files = []
@@ -246,6 +247,7 @@
                 parent=webutil.siblings(parents),
                 child=webutil.siblings(ctx.children()),
                 changesettag=showtags,
+                changesetbranch=showbranch,
                 author=ctx.user(),
                 desc=ctx.description(),
                 date=ctx.date(),
@@ -555,8 +557,12 @@
                          "rename": webutil.renamelink(fctx),
                          "parent": webutil.siblings(fctx.parents()),
                          "child": webutil.siblings(fctx.children()),
-                         "desc": ctx.description()})
-
+                         "desc": ctx.description(),
+                         "tags": webutil.nodetagsdict(web.repo, ctx.node()),
+                         "branch": webutil.nodebranchnodefault(ctx),
+                         "inbranch": webutil.nodeinbranch(web.repo, ctx),
+                         "branches": webutil.nodebranchdict(web.repo, ctx)})
+                     
         if limit > 0:
             l = l[:limit]
 
--- a/mercurial/hgweb/wsgicgi.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/hgweb/wsgicgi.py	Tue Nov 25 16:24:22 2008 -0600
@@ -17,6 +17,9 @@
 
     environ = dict(os.environ.items())
     environ.setdefault('PATH_INFO', '')
+    if '.cgi' in environ['PATH_INFO']:
+        environ['PATH_INFO'] = environ['PATH_INFO'].split('.cgi', 1)[1]
+
     environ['wsgi.input'] = sys.stdin
     environ['wsgi.errors'] = sys.stderr
     environ['wsgi.version'] = (1, 0)
--- a/mercurial/manifest.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/manifest.py	Tue Nov 25 16:24:22 2008 -0600
@@ -63,6 +63,8 @@
             while i < lenm and m[i] != c:
                 i += 1
             return i
+        if not s:
+            return (lo, lo)
         lenm = len(m)
         if not hi:
             hi = lenm
--- a/mercurial/patch.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/patch.py	Tue Nov 25 16:24:22 2008 -0600
@@ -228,27 +228,22 @@
 contextdesc = re.compile('(---|\*\*\*) (\d+)(,(\d+))? (---|\*\*\*)')
 
 class patchfile:
-    def __init__(self, ui, fname, missing=False):
+    def __init__(self, ui, fname, opener, missing=False):
         self.fname = fname
+        self.opener = opener
         self.ui = ui
         self.lines = []
         self.exists = False
         self.missing = missing
         if not missing:
             try:
-                fp = file(fname, 'rb')
-                self.lines = fp.readlines()
+                self.lines = self.readlines(fname)
                 self.exists = True
             except IOError:
                 pass
         else:
             self.ui.warn(_("unable to find '%s' for patching\n") % self.fname)
 
-        if not self.exists:
-            dirname = os.path.dirname(fname)
-            if dirname and not os.path.isdir(dirname):
-                os.makedirs(dirname)
-
         self.hash = {}
         self.dirty = 0
         self.offset = 0
@@ -257,6 +252,23 @@
         self.printfile(False)
         self.hunks = 0
 
+    def readlines(self, fname):
+        fp = self.opener(fname, 'r')
+        try:
+            return fp.readlines()
+        finally:
+            fp.close()
+
+    def writelines(self, fname, lines):
+        fp = self.opener(fname, 'w')
+        try:
+            fp.writelines(lines)
+        finally:
+            fp.close()
+
+    def unlink(self, fname):
+        os.unlink(fname)
+
     def printfile(self, warn):
         if self.fileprinted:
             return
@@ -307,35 +319,24 @@
         self.ui.warn(
             _("%d out of %d hunks FAILED -- saving rejects to file %s\n") %
             (len(self.rej), self.hunks, fname))
-        try: os.unlink(fname)
-        except:
-            pass
-        fp = file(fname, 'wb')
-        base = os.path.basename(self.fname)
-        fp.write("--- %s\n+++ %s\n" % (base, base))
-        for x in self.rej:
-            for l in x.hunk:
-                fp.write(l)
-                if l[-1] != '\n':
-                    fp.write("\n\ No newline at end of file\n")
+
+        def rejlines():
+            base = os.path.basename(self.fname)
+            yield "--- %s\n+++ %s\n" % (base, base)
+            for x in self.rej:
+                for l in x.hunk:
+                    yield l
+                    if l[-1] != '\n':
+                        yield "\n\ No newline at end of file\n"
+
+        self.writelines(fname, rejlines())
 
     def write(self, dest=None):
-        if self.dirty:
-            if not dest:
-                dest = self.fname
-            st = None
-            try:
-                st = os.lstat(dest)
-            except OSError, inst:
-                if inst.errno != errno.ENOENT:
-                    raise
-            if st and st.st_nlink > 1:
-                os.unlink(dest)
-            fp = file(dest, 'wb')
-            if st and st.st_nlink > 1:
-                os.chmod(dest, st.st_mode)
-            fp.writelines(self.lines)
-            fp.close()
+        if not self.dirty:
+            return
+        if not dest:
+            dest = self.fname
+        self.writelines(dest, self.lines)
 
     def close(self):
         self.write()
@@ -362,7 +363,7 @@
 
         if isinstance(h, binhunk):
             if h.rmfile():
-                os.unlink(self.fname)
+                self.unlink(self.fname)
             else:
                 self.lines[:] = h.new()
                 self.offset += len(h.new())
@@ -379,7 +380,7 @@
         orig_start = start
         if diffhelpers.testhunk(old, self.lines, start) == 0:
             if h.rmfile():
-                os.unlink(self.fname)
+                self.unlink(self.fname)
             else:
                 self.lines[start : start + h.lena] = h.new()
                 self.offset += h.lenb - h.lena
@@ -938,6 +939,7 @@
     err = 0
     current_file = None
     gitpatches = None
+    opener = util.opener(os.getcwd())
 
     def closefile():
         if not current_file:
@@ -960,11 +962,11 @@
             afile, bfile, first_hunk = values
             try:
                 if sourcefile:
-                    current_file = patchfile(ui, sourcefile)
+                    current_file = patchfile(ui, sourcefile, opener)
                 else:
                     current_file, missing = selectfile(afile, bfile, first_hunk,
                                             strip, reverse)
-                    current_file = patchfile(ui, current_file, missing)
+                    current_file = patchfile(ui, current_file, opener, missing)
             except PatchError, err:
                 ui.warn(str(err) + '\n')
                 current_file, current_hunk = None, None
@@ -1002,7 +1004,7 @@
         ignoreblanklines=get('ignore_blank_lines', 'ignoreblanklines'),
         context=get('unified', getter=ui.config))
 
-def updatedir(ui, repo, patches):
+def updatedir(ui, repo, patches, similarity=0):
     '''Update dirstate after patch application according to metadata'''
     if not patches:
         return
@@ -1026,7 +1028,7 @@
     for src, dst in copies:
         repo.copy(src, dst)
     removes = removes.keys()
-    if removes:
+    if (not similarity) and removes:
         repo.remove(util.sort(removes), True)
     for f in patches:
         gp = patches[f]
@@ -1039,7 +1041,7 @@
                 repo.wwrite(gp.path, '', flags)
             else:
                 util.set_flags(dst, islink, isexec)
-    cmdutil.addremove(repo, cfiles)
+    cmdutil.addremove(repo, cfiles, similarity=similarity)
     files = patches.keys()
     files.extend([r for r in removes if r not in files])
     return util.sort(files)
--- a/mercurial/templater.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/templater.py	Tue Nov 25 16:24:22 2008 -0600
@@ -44,7 +44,8 @@
     template_re = re.compile(r"(?:(?:#(?=[\w\|%]+#))|(?:{(?=[\w\|%]+})))"
                              r"(\w+)(?:(?:%(\w+))|((?:\|\w+)*))[#}]")
 
-    def __init__(self, mapfile, filters={}, defaults={}, cache={}):
+    def __init__(self, mapfile, filters={}, defaults={}, cache={},
+                 minchunk=1024, maxchunk=65536):
         '''set up template engine.
         mapfile is name of file to read map definitions from.
         filters is dict of functions. each transforms a value into another.
@@ -55,6 +56,7 @@
         self.base = (mapfile and os.path.dirname(mapfile)) or ''
         self.filters = filters
         self.defaults = defaults
+        self.minchunk, self.maxchunk = minchunk, maxchunk
 
         if not mapfile:
             return
@@ -130,6 +132,13 @@
                 yield v
 
     def __call__(self, t, **map):
+        stream = self.expand(t, **map)
+        if self.minchunk:
+            stream = util.increasingchunks(stream, min=self.minchunk,
+                                           max=self.maxchunk)
+        return stream
+        
+    def expand(self, t, **map):
         '''Perform expansion. t is name of map element to expand. map contains
         added elements for use during expansion. Is a generator.'''
         tmpl = self._template(t)
--- a/mercurial/util.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/util.py	Tue Nov 25 16:24:22 2008 -0600
@@ -290,6 +290,37 @@
     l.sort()
     return l
 
+def increasingchunks(source, min=1024, max=65536):
+    '''return no less than min bytes per chunk while data remains,
+    doubling min after each chunk until it reaches max'''
+    def log2(x):
+        if not x:
+            return 0
+        i = 0
+        while x:
+            x >>= 1
+            i += 1
+        return i - 1
+
+    buf = []
+    blen = 0
+    for chunk in source:
+        buf.append(chunk)
+        blen += len(chunk)
+        if blen >= min:
+            if min < max:
+                min = min << 1
+                nmin = 1 << log2(blen)
+                if nmin > min:
+                    min = nmin
+                if min > max:
+                    min = max
+            yield ''.join(buf)
+            blen = 0
+            buf = []
+    if buf:
+        yield ''.join(buf)
+
 class Abort(Exception):
     """Raised if a command needs to print an error and exit."""
 
--- a/mercurial/util_win32.py	Tue Nov 18 16:02:14 2008 -0600
+++ b/mercurial/util_win32.py	Tue Nov 25 16:24:22 2008 -0600
@@ -292,7 +292,7 @@
             raise WinIOError(err, name)
 
     def __iter__(self):
-        for line in self.read().splitlines(True):
+        for line in self.readlines():
             yield line
 
     def read(self, count=-1):
@@ -311,6 +311,11 @@
         except pywintypes.error, err:
             raise WinIOError(err)
 
+    def readlines(self, sizehint=None):
+        # splitlines() splits on single '\r' while readlines()
+        # does not. cStringIO has a well behaving readlines() and is fast.
+        return cStringIO.StringIO(self.read()).readlines()
+
     def write(self, data):
         try:
             if 'a' in self.mode:
--- a/templates/coal/changeset.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-{header}
-<title>{repo|escape}: {node|short}</title>
-</head>
-<body>
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
- <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
- <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
- <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
- <li class="active">changeset</li>
- <li><a href="{url}raw-rev/{node|short}{sessionvars%urlparameter}">raw</a></li>
- <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-<ul>
- {archives%archiveentry}
-</ul>
-</div>
-
-<div class="main">
-
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>changeset {rev}:{node|short} {changesettag}</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="description">{desc|strip|escape|addbreaks}</div>
-
-<table id="changesetEntry">
-<tr>
- <th class="author">author</th>
- <td class="author">{author|obfuscate}</td>
-</tr>
-<tr>
- <th class="date">date</th>
- <td class="date">{date|date} ({date|age} ago)</td></tr>
-<tr>
- <th class="author">parents</th>
- <td class="author">{parent%changesetparent}</td>
-</tr>
-<tr>
- <th class="author">children</th>
- <td class="author">{child%changesetchild}</td>
-</tr>
-<tr>
- <th class="files">files</th>
- <td class="files">{files}</td>
-</tr>
-</table>
-
-<div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
-{diff}
-</div>
-
-</div>
-</div>
-{footer}
--- a/templates/coal/error.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-{header}
-<title>{repo|escape}: error</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}log{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-</div>
-
-<div class="main">
-
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>error</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="description">
-<p>
-An error occurred while processing your request:
-</p>
-<p>
-{error|escape}
-</p>
-</div>
-</div>
-</div>
-
-{footer}
--- a/templates/coal/fileannotate.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-{header}
-<title>{repo|escape}: {file|escape} annotate</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-<ul>
-<li><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li>
-<li><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
-<li class="active">annotate</li>
-<li><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
-<li><a href="{url}raw-annotate/{node|short}/{file|urlescape}">raw</a></li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>annotate {file|escape} @ {rev}:{node|short}</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="description">{desc|strip|escape|addbreaks}</div>
-
-<table id="changesetEntry">
-<tr>
- <th class="author">author</th>
- <td class="author">{author|obfuscate}</td>
-</tr>
-<tr>
- <th class="date">date</th>
- <td class="date">{date|date} ({date|age} ago)</td>
-</tr>
-<tr>
- <th class="author">parents</th>
- <td class="author">{parent%filerevparent}</td>
-</tr>
-<tr>
- <th class="author">children</th>
- <td class="author">{child%filerevchild}</td>
-</tr>
-{changesettag}
-</table>
-
-<br/>
-
-<div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="annotate">rev</th>
- <th class="lineno">line</th>
- <th class="line">source</th>
-</tr>
-{annotate%annotateline}
-</table>
-</div>
-</div>
-</div>
-
-{footer}
--- a/templates/coal/filediff.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-{header}
-<title>{repo|escape}: {file|escape} diff</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-<ul>
-<li><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li>
-<li class="active">diff</li>
-<li><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
-<li><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
-<li><a href="{url}raw-file/{node|short}/{file|urlescape}">raw</a></li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>diff {file|escape} @ {rev}:{node|short}</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="description">{desc|strip|escape|addbreaks}</div>
-
-<table id="changesetEntry">
-<tr>
- <th>author</th>
- <td>{author|obfuscate}</td>
-</tr>
-<tr>
- <th>date</th>
- <td>{date|date} ({date|age} ago)</td>
-</tr>
-<tr>
- <th>parents</th>
- <td>{parent%filerevparent}</td>
-</tr>
-<tr>
- <th>children</th>
- <td>{child%filerevchild}</td>
-</tr>
-{changesettag}
-</table>
-
-<div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
-
-{diff}
-</div>
-</div>
-</div>
-
-{footer}
--- a/templates/coal/filelog.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-{header}
-<title>{repo|escape}: {file|escape} history</title>
-<link rel="alternate" type="application/atom+xml"
-   href="{url}atom-log/tip/{file|urlescape}" title="Atom feed for {repo|escape}:{file}">
-<link rel="alternate" type="application/rss+xml"
-   href="{url}rss-log/tip/{file|urlescape}" title="RSS feed for {repo|escape}:{file}">
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-<ul>
-<li><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li>
-<li><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
-<li><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
-<li class="active">file log</li>
-<li><a href="{url}raw-file/{node|short}/{file|urlescape}">raw</a></li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>log {file|escape}</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="navigate">{nav%filenaventry}</div>
-
-<table class="bigtable">
- <tr>
-  <th class="age">age</th>
-  <th class="author">author</th>
-  <th class="description">description</th>
- </tr>
-{entries%filelogentry}
-</table>
-
-</div>
-</div>
-
-{footer}
--- a/templates/coal/filelogentry.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
- <tr class="parity{parity}">
-  <td class="age">{date|age}</td>
-  <td class="author">{author|person}</td>
-  <td class="description"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}</a></td>
- </tr>
--- a/templates/coal/filerevision.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-{header}
-<title>{repo|escape}: {node|short} {file|escape}</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-<ul>
-<li class="active">file</li>
-<li><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
-<li><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
-<li><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
-<li><a href="{url}raw-file/{node|short}/{file|urlescape}">raw</a></li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>view {file|escape} @ {rev}:{node|short}</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="description">{desc|strip|escape|addbreaks}</div>
-
-<table id="changesetEntry">
-<tr>
- <th class="author">author</th>
- <td class="author">{author|obfuscate}</td>
-</tr>
-<tr>
- <th class="date">date</th>
- <td class="date">{date|date} ({date|age} ago)</td>
-</tr>
-<tr>
- <th class="author">parents</th>
- <td class="author">{parent%filerevparent}</td>
-</tr>
-<tr>
- <th class="author">children</th>
- <td class="author">{child%filerevchild}</td>
-</tr>
-{changesettag}
-</table>
-
-<div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">source</th>
-</tr>
-{text%fileline}
-</table>
-</div>
-</div>
-</div>
-
-{footer}
--- a/templates/coal/footer.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-{motd}
-
-</body>
-</html>
--- a/templates/coal/graph.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-{header}
-<title>{repo|escape}: revision graph</title>
-<link rel="alternate" type="application/atom+xml"
-   href="{url}atom-log" title="Atom feed for {repo|escape}: log">
-<link rel="alternate" type="application/rss+xml"
-   href="{url}rss-log" title="RSS feed for {repo|escape}: log">
-<!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
-<li class="active">graph</li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>graph</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="navigate">
-<a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
-<a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
-| rev {rev}: {changenav%navgraphentry}
-</div>
-
-<noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
-
-<div id="wrapper">
-<ul id="nodebgs"></ul>
-<canvas id="graph" width="224" height="{canvasheight}"></canvas>
-<ul id="graphnodes"></ul>
-</div>
-
-<script type="text/javascript" src="{staticurl}graph.js"></script>
-<script type="text/javascript">
-<!-- hide script content
-
-var data = {jsdata|json};
-var graph = new Graph();
-graph.scale({bg_height});
-
-graph.edge = function(x0, y0, x1, y1, color) {
-	
-	this.setColor(color, 0.0, 0.65);
-	this.ctx.beginPath();
-	this.ctx.moveTo(x0, y0);
-	this.ctx.lineTo(x1, y1);
-	this.ctx.stroke();
-	
-}
-
-var revlink = '<li style="_STYLE"><span class="desc">';
-revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
-revlink += '</span><span class="tag">_TAGS</span>';
-revlink += '<span class="info">_DATE ago, by _USER</span></li>';
-
-graph.vertex = function(x, y, color, parity, cur) {
-	
-	this.ctx.beginPath();
-	color = this.setColor(color, 0.25, 0.75);
-	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
-	this.ctx.fill();
-	
-	var bg = '<li class="bg parity' + parity + '"></li>';
-	var left = (this.columns + 1) * this.bg_height;
-	var nstyle = 'padding-left: ' + left + 'px;';
-	var item = revlink.replace(/_STYLE/, nstyle);
-	item = item.replace(/_PARITY/, 'parity' + parity);
-	item = item.replace(/_NODEID/, cur[0]);
-	item = item.replace(/_NODEID/, cur[0]);
-	item = item.replace(/_DESC/, cur[3]);
-	item = item.replace(/_USER/, cur[4]);
-	item = item.replace(/_DATE/, cur[5]);
-	item = item.replace(/_TAGS/, cur[7].join('&nbsp; '));
-	
-	return [bg, item];
-	
-}
-
-graph.render(data);
-
-// stop hiding script -->
-</script>
-
-<div class="navigate">
-<a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
-<a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
-| rev {rev}: {changenav%navgraphentry}
-</div>
-
-</div>
-</div>
-
-{footer}
--- a/templates/coal/index.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-{header}
-<title>Mercurial repositories index</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<div class="main">
-<h2>Mercurial Repositories</h2>
-
-<table class="bigtable">
-    <tr>
-        <th><a href="?sort={sort_name}">Name</a></th>
-        <th><a href="?sort={sort_description}">Description</a></th>
-        <th><a href="?sort={sort_contact}">Contact</a></th>
-        <th><a href="?sort={sort_lastchange}">Last change</a></th>
-        <th>&nbsp;</th>
-    </tr>
-    {entries%indexentry}
-</table>
-</div>
-</div>
-{footer}
--- a/templates/coal/manifest.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-{header}
-<title>{repo|escape}: {node|short} {path|escape}</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li class="active">browse</li>
-</ul>
-<ul>
-{archives%archiveentry}
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>directory {path|escape} @ {rev}:{node|short} {tags%changelogtag}</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<table class="bigtable">
-<tr>
-  <th class="name">name</th>
-  <th class="size">size</th>
-  <th class="permissions">permissions</th>
-</tr>
-<tr class="fileline parity{upparity}">
-  <td class="name"><a href="{url}file/{node|short}{up|urlescape}{sessionvars%urlparameter}">[up]</a></td>
-  <td class="size"></td>
-  <td class="permissions">drwxr-xr-x</td>
-</tr>
-{dentries%direntry}
-{fentries%fileentry}
-</table>
-</div>
-</div>
-{footer}
--- a/templates/coal/map	Tue Nov 18 16:02:14 2008 -0600
+++ b/templates/coal/map	Tue Nov 25 16:24:22 2008 -0600
@@ -2,13 +2,13 @@
 
 mimetype = 'text/html; charset={encoding}'
 header = header.tmpl
-footer = footer.tmpl
-search = search.tmpl
+footer = ../paper/footer.tmpl
+search = ../paper/search.tmpl
 
-changelog = shortlog.tmpl
-shortlog = shortlog.tmpl
-shortlogentry = shortlogentry.tmpl
-graph = graph.tmpl
+changelog = ../paper/shortlog.tmpl
+shortlog = ../paper/shortlog.tmpl
+shortlogentry = ../paper/shortlogentry.tmpl
+graph = ../paper/graph.tmpl
 
 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
@@ -18,28 +18,28 @@
 filenodelink = '<a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
 filenolink = '{file|escape} '
 fileellipses = '...'
-changelogentry = shortlogentry.tmpl
-searchentry = shortlogentry.tmpl
-changeset = changeset.tmpl
-manifest = manifest.tmpl
+changelogentry = ../paper/shortlogentry.tmpl
+searchentry = ../paper/shortlogentry.tmpl
+changeset = ../paper/changeset.tmpl
+manifest = ../paper/manifest.tmpl
 
 direntry = '<tr class="fileline parity{parity}"><td class="name"><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}"><img src="{staticurl}coal-folder.png"> {basename|escape}/</a> <a href="{url}file/{node|short}{path|urlescape}/{emptydirs|urlescape}{sessionvars%urlparameter}">{emptydirs|escape}</a><td class="size"></td><td class="permissions">drwxr-xr-x</td></tr>'
 fileentry = '<tr class="fileline parity{parity}"><td class="filename"><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}#l1"><img src="{staticurl}coal-file.png"> {basename|escape}</a></td><td class="size">{size}</td><td class="permissions">{permissions|permissions}</td></tr>'
 
-filerevision = filerevision.tmpl
-fileannotate = fileannotate.tmpl
-filediff = filediff.tmpl
-filelog = filelog.tmpl
-fileline = '<tr class="parity{parity}"><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
-filelogentry = filelogentry.tmpl
+filerevision = ../paper/filerevision.tmpl
+fileannotate = ../paper/fileannotate.tmpl
+filediff = ../paper/filediff.tmpl
+filelog = ../paper/filelog.tmpl
+fileline = '<div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
+filelogentry = ../paper/filelogentry.tmpl
 
-annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td></tr>'
 
-diffblock = '<table class="bigtable parity{parity}">{lines}</table>'
-difflineplus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source plusline">{line|escape}</td></tr>'
-difflineminus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source minusline">{line|escape}</td></tr>'
-difflineat = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source atline">{line|escape}</td></tr>'
-diffline = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+diffblock = '<div class="source bottomline parity{parity}">{lines}</div>'
+difflineplus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="plusline">{line|escape}</span>'
+difflineminus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="minusline">{line|escape}</span>'
+difflineat = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="atline">{line|escape}</span>'
+diffline = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}'
 
 changelogparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 
@@ -54,19 +54,21 @@
 changesetchild = '<a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>'
 changelogchild = '<tr><th class="child">child</th><td class="child"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 fileannotatechild = '<tr><td class="metatag">child:</td><td><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
-tags = tags.tmpl
+tags = ../paper/tags.tmpl
 tagentry = '<tr class="tagEntry parity{parity}"><td><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{tag|escape}</a></td><td class="node">{node|short}</td></tr>'
 changelogtag = '<span class="tag">{name|escape}</span> '
 changesettag = '<span class="tag">{tag|escape}</span> '
+changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
+changelogbranchname = '<span class="branchname">{name|escape}</span> ' 
 filediffparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filelogparent = '<tr><th>parent {rev}:</th><td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filediffchild = '<tr><th class="child">child {rev}:</th><td class="child"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filelogchild = '<tr><th>child {rev}:</th><td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 indexentry = '<tr class="parity{parity}"><td><a href="{url}{sessionvars%urlparameter}">{name|escape}</a></td><td>{description}</td><td>{contact|obfuscate}</td><td class="age">{lastchange|age} ago</td><td class="indexlinks">{archives%indexarchiveentry}</td></tr>\n'
 indexarchiveentry = '<a href="{url}archive/{node|short}{extension|urlescape}">&nbsp;&darr;{type|escape}</a>'
-index = index.tmpl
+index = ../paper/index.tmpl
 archiveentry = '<li><a href="{url}archive/{node|short}{extension|urlescape}">{type|escape}</a></li>'
-notfound = notfound.tmpl
-error = error.tmpl
+notfound = ../paper/notfound.tmpl
+error = ../paper/error.tmpl
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
--- a/templates/coal/notfound.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-{header}
-<title>Mercurial repository not found</title>
-</head>
-<body>
-
-<h2>Mercurial repository not found</h2>
-
-The specified repository "{repo|escape}" is unknown, sorry.
-
-Please go back to the main repository list page.
-
-{footer}
--- a/templates/coal/search.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-{header}
-<title>{repo|escape}: searching for {query|escape}</title>
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>searching for '{query|escape}'</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<table class="bigtable">
- <tr>
-  <th class="age">age</th>
-  <th class="author">author</th>
-  <th class="description">description</th>
- </tr>
-{entries}
-</table>
-
-</div>
-</div>
-
-{footer}
--- a/templates/coal/shortlog.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-{header}
-<title>{repo|escape}: log</title>
-<link rel="alternate" type="application/atom+xml"
-   href="{url}atom-log" title="Atom feed for {repo|escape}">
-<link rel="alternate" type="application/rss+xml"
-   href="{url}rss-log" title="RSS feed for {repo|escape}">
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li class="active">log</li>
-<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
-<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-</ul>
-<ul>
-<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
-<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
-</ul>
-<ul>
-{archives%archiveentry}
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>log</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<div class="navigate">rev {rev}: {changenav%navshortentry}</div>
-
-<table class="bigtable">
- <tr>
-  <th class="age">age</th>
-  <th class="author">author</th>
-  <th class="description">description</th>
- </tr>
-{entries%shortlogentry}
-</table>
-
-<div class="navigate">rev {rev}: {changenav%navshortentry}</div>
-</div>
-</div>
-
-{footer}
--- a/templates/coal/shortlogentry.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
- <tr class="parity{parity}">
-  <td class="age">{date|age}</td>
-  <td class="author">{author|person}</td>
-  <td class="description"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}</a>{tags%changelogtag}</td>
- </tr>
--- a/templates/coal/tags.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-{header}
-<title>{repo|escape}: tags</title>
-<link rel="alternate" type="application/atom+xml"
-   href="{url}atom-tags" title="Atom feed for {repo|escape}: tags">
-<link rel="alternate" type="application/rss+xml"
-   href="{url}rss-tags" title="RSS feed for {repo|escape}: tags">
-</head>
-<body>
-
-<div class="container">
-<div class="menu">
-<div class="logo">
-<a href="http://www.selenic.com/mercurial/">
-<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
-</div>
-<ul>
-<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
-<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
-<li class="active">tags</li>
-</ul>
-</div>
-
-<div class="main">
-<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
-<h3>tags</h3>
-
-<form class="search" action="{url}log">
-{sessionvars%hiddenformentry}
-<p><input name="rev" id="search1" type="text" size="30"></p>
-<span>find changesets by author, revision,
-files, or words in the commit message</span>
-</form>
-
-<table class="bigtable">
-<tr>
- <th>tag</th>
- <th>node</th>
-</tr>
-{entries%tagentry}
-</table>
-</div>
-</div>
-
-{footer}
--- a/templates/monoblue/graph.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ b/templates/monoblue/graph.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -59,7 +59,7 @@
 
     var revlink = '<li style="_STYLE"><span class="desc">';
     revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
-    revlink += '</span><span class="info">_DATE ago, by _USER</span></li>';
+    revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>';
 
     graph.vertex = function(x, y, color, parity, cur) {
 
@@ -79,6 +79,26 @@
         item = item.replace(/_USER/, cur[4]);
         item = item.replace(/_DATE/, cur[5]);
 
+        var tagspan = '';
+        if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
+            tagspan = '<span class="logtags">';
+            if (cur[6][1]) {
+                tagspan += '<span class="branchtag" title="' + cur[6][0] + '">';
+                tagspan += cur[6][0] + '</span> ';
+            } else if (!cur[6][1] && cur[6][0] != 'default') {
+                tagspan += '<span class="inbranchtag" title="' + cur[6][0] + '">';
+                tagspan += cur[6][0] + '</span> ';
+            }
+            if (cur[7].length) {
+                for (var t in cur[7]) {
+                    var tag = cur[7][t];
+                    tagspan += '<span class="tagtag">' + tag + '</span> ';
+                }
+            }
+            tagspan += '</span>';
+        }
+
+        item = item.replace(/_TAGS/, tagspan); 
         return [bg, item];
 
     }
--- a/templates/monoblue/index.tmpl	Tue Nov 18 16:02:14 2008 -0600
+++ b/templates/monoblue/index.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -1,26 +1,39 @@
 #header#
     <title>#repo|escape#: Mercurial repositories index</title>
 </head>
-<body>
-
-<div class="page_header">
-    <a href="http://www.selenic.com/mercurial/" title="Mercurial" style="float: right;">Mercurial</a>
-    Repositories list
-</div>
 
-<table cellspacing="0">
-    <tr>
-        <td><a href="?sort=#sort_name#">Name</a></td>
-        <td><a href="?sort=#sort_description#">Description</a></td>
-        <td><a href="?sort=#sort_contact#">Contact</a></td>
-        <td><a href="?sort=#sort_lastchange#">Last change</a></td>
-        <td>&nbsp;</td>
-        <td>&nbsp;</td>
-    </tr>
-    #entries%indexentry#
-</table>
-<div class="page-footer">
-#motd#
+<body>
+<div id="container">
+    <div class="page-header">
+        <h1>Mercurial Repositories</h1>
+        <ul class="page-nav">
+        </ul>
+    </div>
+    
+    <table cellspacing="0">
+        <tr>
+            <td><a href="?sort=#sort_name#">Name</a></td>
+            <td><a href="?sort=#sort_description#">Description</a></td>
+            <td><a href="?sort=#sort_contact#">Contact</a></td>
+            <td><a href="?sort=#sort_lastchange#">Last change</a></td>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        #entries%indexentry#
+    </table>
+    <div class="page-footer">
+        {motd}
+    </div>
+
+    <div id="powered-by">
+        <p><a href="http://www.selenic.com/mercurial/" title="Mercurial"><img src="#staticurl#hglogo.png" width=75 height=90 border=0 alt="mercurial"></a></p>
+    </div>
+
+    <div id="corner-top-left"></div>
+    <div id="corner-top-right"></div>
+    <div id="corner-bottom-left"></div>
+    <div id="corner-bottom-right"></div>
+
 </div>
 </body>
 </html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/changeset.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,70 @@
+{header}
+<title>{repo|escape}: {node|short}</title>
+</head>
+<body>
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+ <li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+ <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+ <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+ <li class="active">changeset</li>
+ <li><a href="{url}raw-rev/{node|short}{sessionvars%urlparameter}">raw</a></li>
+ <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+<ul>
+ {archives%archiveentry}
+</ul>
+</div>
+
+<div class="main">
+
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>changeset {rev}:{node|short} {changesetbranch%changelogbranchname} {changesettag}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="description">{desc|strip|escape|addbreaks}</div>
+
+<table id="changesetEntry">
+<tr>
+ <th class="author">author</th>
+ <td class="author">{author|obfuscate}</td>
+</tr>
+<tr>
+ <th class="date">date</th>
+ <td class="date">{date|date} ({date|age} ago)</td></tr>
+<tr>
+ <th class="author">parents</th>
+ <td class="author">{parent%changesetparent}</td>
+</tr>
+<tr>
+ <th class="author">children</th>
+ <td class="author">{child%changesetchild}</td>
+</tr>
+<tr>
+ <th class="files">files</th>
+ <td class="files">{files}</td>
+</tr>
+</table>
+
+<div class="overflow">
+<div class="sourcefirst">   line diff</div>
+
+{diff}
+</div>
+
+</div>
+</div>
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/error.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,42 @@
+{header}
+<title>{repo|escape}: error</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+</div>
+
+<div class="main">
+
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>error</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="description">
+<p>
+An error occurred while processing your request:
+</p>
+<p>
+{error|escape}
+</p>
+</div>
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/fileannotate.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,78 @@
+{header}
+<title>{repo|escape}: {file|escape} annotate</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+<ul>
+<li><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li>
+<li><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
+<li class="active">annotate</li>
+<li><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
+<li><a href="{url}raw-annotate/{node|short}/{file|urlescape}">raw</a></li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>annotate {file|escape} @ {rev}:{node|short}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="description">{desc|strip|escape|addbreaks}</div>
+
+<table id="changesetEntry">
+<tr>
+ <th class="author">author</th>
+ <td class="author">{author|obfuscate}</td>
+</tr>
+<tr>
+ <th class="date">date</th>
+ <td class="date">{date|date} ({date|age} ago)</td>
+</tr>
+<tr>
+ <th class="author">parents</th>
+ <td class="author">{parent%filerevparent}</td>
+</tr>
+<tr>
+ <th class="author">children</th>
+ <td class="author">{child%filerevchild}</td>
+</tr>
+{changesettag}
+</table>
+
+<br/>
+
+<div class="overflow">
+<table class="bigtable">
+<tr>
+ <th class="annotate">rev</th>
+ <th class="line">&nbsp;&nbsp;line source</th>
+</tr>
+{annotate%annotateline}
+</table>
+</div>
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/filediff.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,71 @@
+{header}
+<title>{repo|escape}: {file|escape} diff</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+<ul>
+<li><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li>
+<li class="active">diff</li>
+<li><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
+<li><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
+<li><a href="{url}raw-file/{node|short}/{file|urlescape}">raw</a></li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>diff {file|escape} @ {rev}:{node|short}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="description">{desc|strip|escape|addbreaks}</div>
+
+<table id="changesetEntry">
+<tr>
+ <th>author</th>
+ <td>{author|obfuscate}</td>
+</tr>
+<tr>
+ <th>date</th>
+ <td>{date|date} ({date|age} ago)</td>
+</tr>
+<tr>
+ <th>parents</th>
+ <td>{parent%filerevparent}</td>
+</tr>
+<tr>
+ <th>children</th>
+ <td>{child%filerevchild}</td>
+</tr>
+{changesettag}
+</table>
+
+<div class="overflow">
+<div class="sourcefirst">   line diff</div>
+
+{diff}
+</div>
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/filelog.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,59 @@
+{header}
+<title>{repo|escape}: {file|escape} history</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url}atom-log/tip/{file|urlescape}" title="Atom feed for {repo|escape}:{file}">
+<link rel="alternate" type="application/rss+xml"
+   href="{url}rss-log/tip/{file|urlescape}" title="RSS feed for {repo|escape}:{file}">
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+<ul>
+<li><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file</a></li>
+<li><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
+<li><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
+<li class="active">file log</li>
+<li><a href="{url}raw-file/{node|short}/{file|urlescape}">raw</a></li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>log {file|escape}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="navigate">{nav%filenaventry}</div>
+
+<table class="bigtable">
+ <tr>
+  <th class="age">age</th>
+  <th class="author">author</th>
+  <th class="description">description</th>
+ </tr>
+{entries%filelogentry}
+</table>
+
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/filelogentry.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,5 @@
+ <tr class="parity{parity}">
+  <td class="age">{date|age}</td>
+  <td class="author">{author|person}</td>
+  <td class="description"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}</a>{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}</td>
+ </tr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/filerevision.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,71 @@
+{header}
+<title>{repo|escape}: {node|short} {file|escape}</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+<ul>
+<li class="active">file</li>
+<li><a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
+<li><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
+<li><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
+<li><a href="{url}raw-file/{node|short}/{file|urlescape}">raw</a></li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>view {file|escape} @ {rev}:{node|short}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="description">{desc|strip|escape|addbreaks}</div>
+
+<table id="changesetEntry">
+<tr>
+ <th class="author">author</th>
+ <td class="author">{author|obfuscate}</td>
+</tr>
+<tr>
+ <th class="date">date</th>
+ <td class="date">{date|date} ({date|age} ago)</td>
+</tr>
+<tr>
+ <th class="author">parents</th>
+ <td class="author">{parent%filerevparent}</td>
+</tr>
+<tr>
+ <th class="author">children</th>
+ <td class="author">{child%filerevchild}</td>
+</tr>
+{changesettag}
+</table>
+
+<div class="overflow">
+<div class="sourcefirst"> line source</div>
+{text%fileline}
+<div class="sourcelast"></div>
+</div>
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/footer.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,4 @@
+{motd}
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/graph.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,131 @@
+{header}
+<title>{repo|escape}: revision graph</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url}atom-log" title="Atom feed for {repo|escape}: log">
+<link rel="alternate" type="application/rss+xml"
+   href="{url}rss-log" title="RSS feed for {repo|escape}: log">
+<!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]-->
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+<li class="active">graph</li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>graph</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="navigate">
+<a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
+<a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
+| rev {rev}: {changenav%navgraphentry}
+</div>
+
+<noscript>The revision graph only works with JavaScript-enabled browsers.</noscript>
+
+<div id="wrapper">
+<ul id="nodebgs"></ul>
+<canvas id="graph" width="224" height="{canvasheight}"></canvas>
+<ul id="graphnodes"></ul>
+</div>
+
+<script type="text/javascript" src="{staticurl}graph.js"></script>
+<script type="text/javascript">
+<!-- hide script content
+
+var data = {jsdata|json};
+var graph = new Graph();
+graph.scale({bg_height});
+
+graph.edge = function(x0, y0, x1, y1, color) {
+	
+	this.setColor(color, 0.0, 0.65);
+	this.ctx.beginPath();
+	this.ctx.moveTo(x0, y0);
+	this.ctx.lineTo(x1, y1);
+	this.ctx.stroke();
+	
+}
+
+var revlink = '<li style="_STYLE"><span class="desc">';
+revlink += '<a href="{url}rev/_NODEID{sessionvars%urlparameter}" title="_NODEID">_DESC</a>';
+revlink += '</span>_TAGS<span class="info">_DATE ago, by _USER</span></li>';
+
+graph.vertex = function(x, y, color, parity, cur) {
+	
+	this.ctx.beginPath();
+	color = this.setColor(color, 0.25, 0.75);
+	this.ctx.arc(x, y, radius, 0, Math.PI * 2, true);
+	this.ctx.fill();
+	
+	var bg = '<li class="bg parity' + parity + '"></li>';
+	var left = (this.columns + 1) * this.bg_height;
+	var nstyle = 'padding-left: ' + left + 'px;';
+	var item = revlink.replace(/_STYLE/, nstyle);
+	item = item.replace(/_PARITY/, 'parity' + parity);
+	item = item.replace(/_NODEID/, cur[0]);
+	item = item.replace(/_NODEID/, cur[0]);
+	item = item.replace(/_DESC/, cur[3]);
+	item = item.replace(/_USER/, cur[4]);
+	item = item.replace(/_DATE/, cur[5]);
+
+	var tagspan = '';
+	if (cur[7].length || (cur[6][0] != 'default' || cur[6][1])) {
+		tagspan = '<span class="logtags">';
+		if (cur[6][1]) {
+			tagspan += '<span class="branchhead" title="' + cur[6][0] + '">';
+			tagspan += cur[6][0] + '</span> ';
+		} else if (!cur[6][1] && cur[6][0] != 'default') {
+			tagspan += '<span class="branchname" title="' + cur[6][0] + '">';
+			tagspan += cur[6][0] + '</span> ';
+		}
+		if (cur[7].length) {
+			for (var t in cur[7]) {
+				var tag = cur[7][t];
+				tagspan += '<span class="tag">' + tag + '</span> ';
+			}
+		}
+		tagspan += '</span>';
+	}
+	
+	item = item.replace(/_TAGS/, tagspan);
+	return [bg, item];
+	
+}
+
+graph.render(data);
+
+// stop hiding script -->
+</script>
+
+<div class="navigate">
+<a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
+<a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
+| rev {rev}: {changenav%navgraphentry}
+</div>
+
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/index.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,26 @@
+{header}
+<title>Mercurial repositories index</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<div class="main">
+<h2>Mercurial Repositories</h2>
+
+<table class="bigtable">
+    <tr>
+        <th><a href="?sort={sort_name}">Name</a></th>
+        <th><a href="?sort={sort_description}">Description</a></th>
+        <th><a href="?sort={sort_contact}">Contact</a></th>
+        <th><a href="?sort={sort_lastchange}">Last change</a></th>
+        <th>&nbsp;</th>
+    </tr>
+    {entries%indexentry}
+</table>
+</div>
+</div>
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/manifest.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,53 @@
+{header}
+<title>{repo|escape}: {node|short} {path|escape}</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li class="active">browse</li>
+</ul>
+<ul>
+{archives%archiveentry}
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>directory {path|escape} @ {rev}:{node|short} {tags%changelogtag}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<table class="bigtable">
+<tr>
+  <th class="name">name</th>
+  <th class="size">size</th>
+  <th class="permissions">permissions</th>
+</tr>
+<tr class="fileline parity{upparity}">
+  <td class="name"><a href="{url}file/{node|short}{up|urlescape}{sessionvars%urlparameter}">[up]</a></td>
+  <td class="size"></td>
+  <td class="permissions">drwxr-xr-x</td>
+</tr>
+{dentries%direntry}
+{fentries%fileentry}
+</table>
+</div>
+</div>
+{footer}
--- a/templates/paper/map	Tue Nov 18 16:02:14 2008 -0600
+++ b/templates/paper/map	Tue Nov 25 16:24:22 2008 -0600
@@ -2,13 +2,13 @@
 
 mimetype = 'text/html; charset={encoding}'
 header = header.tmpl
-footer = ../coal/footer.tmpl
-search = ../coal/search.tmpl
+footer = footer.tmpl
+search = search.tmpl
 
-changelog = ../coal/shortlog.tmpl
-shortlog = ../coal/shortlog.tmpl
-shortlogentry = ../coal/shortlogentry.tmpl
-graph = ../coal/graph.tmpl
+changelog = shortlog.tmpl
+shortlog = shortlog.tmpl
+shortlogentry = shortlogentry.tmpl
+graph = graph.tmpl
 
 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
@@ -18,28 +18,28 @@
 filenodelink = '<a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
 filenolink = '{file|escape} '
 fileellipses = '...'
-changelogentry = ../coal/shortlogentry.tmpl
-searchentry = ../coal/shortlogentry.tmpl
-changeset = ../coal/changeset.tmpl
-manifest = ../coal/manifest.tmpl
+changelogentry = shortlogentry.tmpl
+searchentry = shortlogentry.tmpl
+changeset = changeset.tmpl
+manifest = manifest.tmpl
 
 direntry = '<tr class="fileline parity{parity}"><td class="name"><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}"><img src="{staticurl}coal-folder.png"> {basename|escape}/</a> <a href="{url}file/{node|short}{path|urlescape}/{emptydirs|urlescape}{sessionvars%urlparameter}">{emptydirs|escape}</a><td class="size"></td><td class="permissions">drwxr-xr-x</td></tr>'
 fileentry = '<tr class="fileline parity{parity}"><td class="filename"><a href="{url}file/{node|short}/{file|urlescape}#l1{sessionvars%urlparameter}"><img src="{staticurl}coal-file.png"> {basename|escape}</a></td><td class="size">{size}</td><td class="permissions">{permissions|permissions}</td></tr>'
 
-filerevision = ../coal/filerevision.tmpl
-fileannotate = ../coal/fileannotate.tmpl
-filediff = ../coal/filediff.tmpl
-filelog = ../coal/filelog.tmpl
-fileline = '<tr class="parity{parity}"><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
-filelogentry = ../coal/filelogentry.tmpl
+filerevision = filerevision.tmpl
+fileannotate = fileannotate.tmpl
+filediff = filediff.tmpl
+filelog = filelog.tmpl
+fileline = '<div class="parity{parity} source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</div>'
+filelogentry = filelogentry.tmpl
 
-annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+annotateline = '<tr class="parity{parity}"><td class="annotate"><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}" title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a></td><td class="source"><a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}</td></tr>'
 
-diffblock = '<table class="bigtable parity{parity}">{lines}</table>'
-difflineplus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source plusline">{line|escape}</td></tr>'
-difflineminus = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source minusline">{line|escape}</td></tr>'
-difflineat = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source atline">{line|escape}</td></tr>'
-diffline = '<tr><td class="lineno"><a href="#{lineid}" id="{lineid}">{linenumber}</a></td><td class="source">{line|escape}</td></tr>'
+diffblock = '<div class="source bottomline parity{parity}">{lines}</div>'
+difflineplus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="plusline">{line|escape}</span>'
+difflineminus = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="minusline">{line|escape}</span>'
+difflineat = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> <span class="atline">{line|escape}</span>'
+diffline = '<a href="#{lineid}" id="{lineid}">{linenumber}</a> {line|escape}'
 
 changelogparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 
@@ -54,20 +54,21 @@
 changesetchild = '<a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>'
 changelogchild = '<tr><th class="child">child</th><td class="child"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 fileannotatechild = '<tr><td class="metatag">child:</td><td><a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
-tags = ../coal/tags.tmpl
+tags = tags.tmpl
 tagentry = '<tr class="tagEntry parity{parity}"><td><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{tag|escape}</a></td><td class="node">{node|short}</td></tr>'
-changelogtag = '<tr><th class="tag">tag:</th><td class="tag">{tag|escape}</td></tr>'
 changelogtag = '<span class="tag">{name|escape}</span> '
 changesettag = '<span class="tag">{tag|escape}</span> '
+changelogbranchhead = '<span class="branchhead">{name|escape}</span> '
+changelogbranchname = '<span class="branchname">{name|escape}</span> ' 
 filediffparent = '<tr><th class="parent">parent {rev}:</th><td class="parent"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filelogparent = '<tr><th>parent {rev}:</th><td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filediffchild = '<tr><th class="child">child {rev}:</th><td class="child"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 filelogchild = '<tr><th>child {rev}:</th><td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{node|short}</a></td></tr>'
 indexentry = '<tr class="parity{parity}"><td><a href="{url}{sessionvars%urlparameter}">{name|escape}</a></td><td>{description}</td><td>{contact|obfuscate}</td><td class="age">{lastchange|age} ago</td><td class="indexlinks">{archives%indexarchiveentry}</td></tr>\n'
 indexarchiveentry = '<a href="{url}archive/{node|short}{extension|urlescape}">&nbsp;&darr;{type|escape}</a>'
-index = ../coal/index.tmpl
+index = index.tmpl
 archiveentry = '<li><a href="{url}archive/{node|short}{extension|urlescape}">{type|escape}</a></li>'
-notfound = ../coal/notfound.tmpl
-error = ../coal/error.tmpl
+notfound = notfound.tmpl
+error = error.tmpl
 urlparameter = '{separator}{name}={value|urlescape}'
 hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/notfound.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,12 @@
+{header}
+<title>Mercurial repository not found</title>
+</head>
+<body>
+
+<h2>Mercurial repository not found</h2>
+
+The specified repository "{repo|escape}" is unknown, sorry.
+
+Please go back to the main repository list page.
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/search.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,42 @@
+{header}
+<title>{repo|escape}: searching for {query|escape}</title>
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>searching for '{query|escape}'</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<table class="bigtable">
+ <tr>
+  <th class="age">age</th>
+  <th class="author">author</th>
+  <th class="description">description</th>
+ </tr>
+{entries}
+</table>
+
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/shortlog.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,56 @@
+{header}
+<title>{repo|escape}: log</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url}atom-log" title="Atom feed for {repo|escape}">
+<link rel="alternate" type="application/rss+xml"
+   href="{url}rss-log" title="RSS feed for {repo|escape}">
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li class="active">log</li>
+<li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+</ul>
+<ul>
+<li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
+<li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
+</ul>
+<ul>
+{archives%archiveentry}
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>log</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<div class="navigate">rev {rev}: {changenav%navshortentry}</div>
+
+<table class="bigtable">
+ <tr>
+  <th class="age">age</th>
+  <th class="author">author</th>
+  <th class="description">description</th>
+ </tr>
+{entries%shortlogentry}
+</table>
+
+<div class="navigate">rev {rev}: {changenav%navshortentry}</div>
+</div>
+</div>
+
+{footer}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/shortlogentry.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,5 @@
+ <tr class="parity{parity}">
+  <td class="age">{date|age}</td>
+  <td class="author">{author|person}</td>
+  <td class="description"><a href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}</a>{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}</td>
+ </tr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper/tags.tmpl	Tue Nov 25 16:24:22 2008 -0600
@@ -0,0 +1,44 @@
+{header}
+<title>{repo|escape}: tags</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url}atom-tags" title="Atom feed for {repo|escape}: tags">
+<link rel="alternate" type="application/rss+xml"
+   href="{url}rss-tags" title="RSS feed for {repo|escape}: tags">
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="{staticurl}hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+<ul>
+<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
+<li class="active">tags</li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>tags</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30"></p>
+<span>find changesets by author, revision,
+files, or words in the commit message</span>
+</form>
+
+<table class="bigtable">
+<tr>
+ <th>tag</th>
+ <th>node</th>
+</tr>
+{entries%tagentry}
+</table>
+</div>
+</div>
+
+{footer}
--- a/templates/static/style-coal.css	Tue Nov 18 16:02:14 2008 -0600
+++ b/templates/static/style-coal.css	Tue Nov 25 16:24:22 2008 -0600
@@ -111,6 +111,30 @@
   vertical-align: baseline;
 }
 
+.branchhead {
+  color: #000;
+  font-size: 80%;
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
+ul#graphnodes .branchhead {
+  font-size: 75%;
+}
+
+.branchname {
+  color: #000;
+  font-size: 60%; 
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
+h3 .branchname {
+  font-size: 80%;
+}
+
 /* Common */
 pre { margin: 0; }
 
@@ -148,11 +172,21 @@
 .bigtable .node { width: 5em; font-family: monospace;}
 .bigtable .lineno { width: 2em; text-align: right;}
 .bigtable .lineno a { color: #999; font-size: smaller; font-family: monospace;}
-.bigtable td.source { font-family: monospace; white-space: pre; }
 .bigtable .permissions { width: 8em; text-align: left;}
 .bigtable .size { width: 5em; text-align: right; }
 .bigtable .annotate { text-align: right; }
 .bigtable td.annotate { font-size: smaller; }
+.bigtable td.source { font-size: inherit; }
+
+.source, .sourcefirst, .sourcelast {
+  font-family: monospace;
+  white-space: pre;
+  font-size: 90%;
+}
+.sourcefirst { border-bottom: 1px solid #999; font-weight: bold; font-size: smaller; }
+.sourcelast { border-top: 1px solid #999; }
+.source a { color: #999; font-size: smaller; font-family: monospace;}
+.bottomline { border-bottom: 1px solid #999; }
 
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }
--- a/templates/static/style-paper.css	Tue Nov 18 16:02:14 2008 -0600
+++ b/templates/static/style-paper.css	Tue Nov 25 16:24:22 2008 -0600
@@ -102,6 +102,30 @@
   vertical-align: baseline;
 }
 
+.branchhead {
+  color: #000;
+  font-size: 80%;
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
+ul#graphnodes .branchhead {
+  font-size: 75%;
+}
+
+.branchname {
+  color: #000;
+  font-size: 60%; 
+  font-weight: normal;
+  margin-left: .5em;
+  vertical-align: baseline;
+}
+
+h3 .branchname {
+  font-size: 80%;
+}
+
 /* Common */
 pre { margin: 0; }
 
@@ -137,13 +161,21 @@
 .bigtable .author { width: 12em; }
 .bigtable .description { }
 .bigtable .node { width: 5em; font-family: monospace;}
-.bigtable .lineno { width: 2em; text-align: right;}
-.bigtable .lineno a { color: #999; font-size: smaller; font-family: monospace;}
-.bigtable td.source { font-family: monospace; white-space: pre; }
 .bigtable .permissions { width: 8em; text-align: left;}
 .bigtable .size { width: 5em; text-align: right; }
 .bigtable .annotate { text-align: right; }
 .bigtable td.annotate { font-size: smaller; }
+.bigtable td.source { font-size: inherit; }
+
+.source, .sourcefirst, .sourcelast {
+  font-family: monospace;
+  white-space: pre;
+  font-size: 90%;
+}
+.sourcefirst { border-bottom: 1px solid #999; font-weight: bold; font-size: smaller; }
+.sourcelast { border-top: 1px solid #999; }
+.source a { color: #999; font-size: smaller; font-family: monospace;}
+.bottomline { border-bottom: 1px solid #999; }
 
 .fileline { font-family: monospace; }
 .fileline img { border: 0; }
Binary file tests/test-hgweb-commands.out has changed
--- a/tests/test-hgweb-diffs.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-hgweb-diffs.out	Tue Nov 25 16:24:22 2008 -0600
@@ -41,7 +41,7 @@
 <div class="main">
 
 <h2><a href="/">test</a></h2>
-<h3>changeset 0:0cd96de13884 </h3>
+<h3>changeset 0:0cd96de13884  </h3>
 
 <form class="search" action="/log">
 
@@ -75,21 +75,17 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
-<table class="bigtable parity0"><tr><td class="lineno"><a href="#l1.1" id="l1.1">     1.1</a></td><td class="source minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.2" id="l1.2">     1.2</a></td><td class="source plusline">+++ b/a	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.3" id="l1.3">     1.3</a></td><td class="source atline">@@ -0,0 +1,1 @@
-</td></tr><tr><td class="lineno"><a href="#l1.4" id="l1.4">     1.4</a></td><td class="source plusline">+a
-</td></tr></table><table class="bigtable parity1"><tr><td class="lineno"><a href="#l2.1" id="l2.1">     2.1</a></td><td class="source minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l2.2" id="l2.2">     2.2</a></td><td class="source plusline">+++ b/b	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l2.3" id="l2.3">     2.3</a></td><td class="source atline">@@ -0,0 +1,1 @@
-</td></tr><tr><td class="lineno"><a href="#l2.4" id="l2.4">     2.4</a></td><td class="source plusline">+b
-</td></tr></table>
+<div class="sourcefirst">   line diff</div>
+
+<div class="source bottomline parity0"><a href="#l1.1" id="l1.1">     1.1</a> <span class="minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.2" id="l1.2">     1.2</a> <span class="plusline">+++ b/a	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.3" id="l1.3">     1.3</a> <span class="atline">@@ -0,0 +1,1 @@
+</span><a href="#l1.4" id="l1.4">     1.4</a> <span class="plusline">+a
+</span></div><div class="source bottomline parity1"><a href="#l2.1" id="l2.1">     2.1</a> <span class="minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l2.2" id="l2.2">     2.2</a> <span class="plusline">+++ b/b	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l2.3" id="l2.3">     2.3</a> <span class="atline">@@ -0,0 +1,1 @@
+</span><a href="#l2.4" id="l2.4">     2.4</a> <span class="plusline">+b
+</span></div>
 </div>
 
 </div>
@@ -172,18 +168,13 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
+<div class="sourcefirst">   line diff</div>
 
-<table class="bigtable parity0"><tr><td class="lineno"><a href="#l1.1" id="l1.1">     1.1</a></td><td class="source minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.2" id="l1.2">     1.2</a></td><td class="source plusline">+++ b/a	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.3" id="l1.3">     1.3</a></td><td class="source atline">@@ -0,0 +1,1 @@
-</td></tr><tr><td class="lineno"><a href="#l1.4" id="l1.4">     1.4</a></td><td class="source plusline">+a
-</td></tr></table>
+<div class="source bottomline parity0"><a href="#l1.1" id="l1.1">     1.1</a> <span class="minusline">--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.2" id="l1.2">     1.2</a> <span class="plusline">+++ b/a	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.3" id="l1.3">     1.3</a> <span class="atline">@@ -0,0 +1,1 @@
+</span><a href="#l1.4" id="l1.4">     1.4</a> <span class="plusline">+a
+</span></div>
 </div>
 </div>
 </div>
@@ -232,7 +223,7 @@
 <div class="main">
 
 <h2><a href="/">test</a></h2>
-<h3>changeset 0:0cd96de13884 </h3>
+<h3>changeset 0:0cd96de13884  </h3>
 
 <form class="search" action="/log">
 
@@ -266,23 +257,19 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
-<table class="bigtable parity0"><tr><td class="lineno"><a href="#l1.1" id="l1.1">     1.1</a></td><td class="source">new file mode 100644
-</td></tr><tr><td class="lineno"><a href="#l1.2" id="l1.2">     1.2</a></td><td class="source minusline">--- /dev/null
-</td></tr><tr><td class="lineno"><a href="#l1.3" id="l1.3">     1.3</a></td><td class="source plusline">+++ b/a
-</td></tr><tr><td class="lineno"><a href="#l1.4" id="l1.4">     1.4</a></td><td class="source atline">@@ -0,0 +1,1 @@
-</td></tr><tr><td class="lineno"><a href="#l1.5" id="l1.5">     1.5</a></td><td class="source plusline">+a
-</td></tr></table><table class="bigtable parity1"><tr><td class="lineno"><a href="#l2.1" id="l2.1">     2.1</a></td><td class="source">new file mode 100644
-</td></tr><tr><td class="lineno"><a href="#l2.2" id="l2.2">     2.2</a></td><td class="source minusline">--- /dev/null
-</td></tr><tr><td class="lineno"><a href="#l2.3" id="l2.3">     2.3</a></td><td class="source plusline">+++ b/b
-</td></tr><tr><td class="lineno"><a href="#l2.4" id="l2.4">     2.4</a></td><td class="source atline">@@ -0,0 +1,1 @@
-</td></tr><tr><td class="lineno"><a href="#l2.5" id="l2.5">     2.5</a></td><td class="source plusline">+b
-</td></tr></table>
+<div class="sourcefirst">   line diff</div>
+
+<div class="source bottomline parity0"><a href="#l1.1" id="l1.1">     1.1</a> new file mode 100644
+<a href="#l1.2" id="l1.2">     1.2</a> <span class="minusline">--- /dev/null
+</span><a href="#l1.3" id="l1.3">     1.3</a> <span class="plusline">+++ b/a
+</span><a href="#l1.4" id="l1.4">     1.4</a> <span class="atline">@@ -0,0 +1,1 @@
+</span><a href="#l1.5" id="l1.5">     1.5</a> <span class="plusline">+a
+</span></div><div class="source bottomline parity1"><a href="#l2.1" id="l2.1">     2.1</a> new file mode 100644
+<a href="#l2.2" id="l2.2">     2.2</a> <span class="minusline">--- /dev/null
+</span><a href="#l2.3" id="l2.3">     2.3</a> <span class="plusline">+++ b/b
+</span><a href="#l2.4" id="l2.4">     2.4</a> <span class="atline">@@ -0,0 +1,1 @@
+</span><a href="#l2.5" id="l2.5">     2.5</a> <span class="plusline">+b
+</span></div>
 </div>
 
 </div>
@@ -365,19 +352,14 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
+<div class="sourcefirst">   line diff</div>
 
-<table class="bigtable parity0"><tr><td class="lineno"><a href="#l1.1" id="l1.1">     1.1</a></td><td class="source">new file mode 100755
-</td></tr><tr><td class="lineno"><a href="#l1.2" id="l1.2">     1.2</a></td><td class="source minusline">--- /dev/null
-</td></tr><tr><td class="lineno"><a href="#l1.3" id="l1.3">     1.3</a></td><td class="source plusline">+++ b/a
-</td></tr><tr><td class="lineno"><a href="#l1.4" id="l1.4">     1.4</a></td><td class="source atline">@@ -0,0 +1,1 @@
-</td></tr><tr><td class="lineno"><a href="#l1.5" id="l1.5">     1.5</a></td><td class="source plusline">+a
-</td></tr></table>
+<div class="source bottomline parity0"><a href="#l1.1" id="l1.1">     1.1</a> new file mode 100755
+<a href="#l1.2" id="l1.2">     1.2</a> <span class="minusline">--- /dev/null
+</span><a href="#l1.3" id="l1.3">     1.3</a> <span class="plusline">+++ b/a
+</span><a href="#l1.4" id="l1.4">     1.4</a> <span class="atline">@@ -0,0 +1,1 @@
+</span><a href="#l1.5" id="l1.5">     1.5</a> <span class="plusline">+a
+</span></div>
 </div>
 </div>
 </div>
--- a/tests/test-hgweb-filelog.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-hgweb-filelog.out	Tue Nov 25 16:24:22 2008 -0600
@@ -401,7 +401,7 @@
 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
 </div>
 <ul>
-<li><a href="/log">log</a></li>
+<li><a href="/shortlog">log</a></li>
 <li><a href="/graph">graph</a></li>
 <li><a href="/tags">tags</a></li>
 </ul>
--- a/tests/test-hgweb-removed.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-hgweb-removed.out	Tue Nov 25 16:24:22 2008 -0600
@@ -39,7 +39,7 @@
 <div class="main">
 
 <h2><a href="/">test</a></h2>
-<h3>changeset 1:c78f6c5cbea9 <span class="tag">tip</span> </h3>
+<h3>changeset 1:c78f6c5cbea9  <span class="tag">tip</span> </h3>
 
 <form class="search" action="/log">
 
@@ -73,17 +73,13 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
-<table class="bigtable parity0"><tr><td class="lineno"><a href="#l1.1" id="l1.1">     1.1</a></td><td class="source minusline">--- a/a	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.2" id="l1.2">     1.2</a></td><td class="source plusline">+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.3" id="l1.3">     1.3</a></td><td class="source atline">@@ -1,1 +0,0 @@
-</td></tr><tr><td class="lineno"><a href="#l1.4" id="l1.4">     1.4</a></td><td class="source minusline">-a
-</td></tr></table>
+<div class="sourcefirst">   line diff</div>
+
+<div class="source bottomline parity0"><a href="#l1.1" id="l1.1">     1.1</a> <span class="minusline">--- a/a	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.2" id="l1.2">     1.2</a> <span class="plusline">+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.3" id="l1.3">     1.3</a> <span class="atline">@@ -1,1 +0,0 @@
+</span><a href="#l1.4" id="l1.4">     1.4</a> <span class="minusline">-a
+</span></div>
 </div>
 
 </div>
@@ -166,18 +162,13 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">diff</th>
-</tr>
-</table>
+<div class="sourcefirst">   line diff</div>
 
-<table class="bigtable parity0"><tr><td class="lineno"><a href="#l1.1" id="l1.1">     1.1</a></td><td class="source minusline">--- a/a	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.2" id="l1.2">     1.2</a></td><td class="source plusline">+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
-</td></tr><tr><td class="lineno"><a href="#l1.3" id="l1.3">     1.3</a></td><td class="source atline">@@ -1,1 +0,0 @@
-</td></tr><tr><td class="lineno"><a href="#l1.4" id="l1.4">     1.4</a></td><td class="source minusline">-a
-</td></tr></table>
+<div class="source bottomline parity0"><a href="#l1.1" id="l1.1">     1.1</a> <span class="minusline">--- a/a	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.2" id="l1.2">     1.2</a> <span class="plusline">+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+</span><a href="#l1.3" id="l1.3">     1.3</a> <span class="atline">@@ -1,1 +0,0 @@
+</span><a href="#l1.4" id="l1.4">     1.4</a> <span class="minusline">-a
+</span></div>
 </div>
 </div>
 </div>
--- a/tests/test-hgweb.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-hgweb.out	Tue Nov 25 16:24:22 2008 -0600
@@ -40,7 +40,7 @@
 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
 </div>
 <ul>
-<li><a href="/log">log</a></li>
+<li><a href="/shortlog">log</a></li>
 <li><a href="/graph">graph</a></li>
 <li><a href="/tags">tags</a></li>
 </ul>
@@ -110,7 +110,7 @@
 <img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
 </div>
 <ul>
-<li><a href="/log">log</a></li>
+<li><a href="/shortlog">log</a></li>
 <li><a href="/graph">graph</a></li>
 <li><a href="/tags">tags</a></li>
 </ul>
--- a/tests/test-highlight.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-highlight.out	Tue Nov 25 16:24:22 2008 -0600
@@ -75,13 +75,9 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">source</th>
-</tr>
-<tr class="parity0"><td class="lineno"><a href="#l1" id="l1">     1</a></td><td class="source"><span class="c">#!/usr/bin/env python</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l2" id="l2">     2</a></td><td class="source"></td></tr><tr class="parity0"><td class="lineno"><a href="#l3" id="l3">     3</a></td><td class="source"><span class="n">__doc__</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;This does HTTP get requests given a host:port and path and returns</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l4" id="l4">     4</a></td><td class="source"><span class="s">a subset of the headers plus the body of the result.&quot;&quot;&quot;</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l5" id="l5">     5</a></td><td class="source"></td></tr><tr class="parity1"><td class="lineno"><a href="#l6" id="l6">     6</a></td><td class="source"><span class="kn">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l7" id="l7">     7</a></td><td class="source"></td></tr><tr class="parity1"><td class="lineno"><a href="#l8" id="l8">     8</a></td><td class="source"><span class="kn">try</span><span class="p">:</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l9" id="l9">     9</a></td><td class="source">    <span class="kn">import</span> <span class="nn">msvcrt</span><span class="o">,</span> <span class="nn">os</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l10" id="l10">    10</a></td><td class="source">    <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l11" id="l11">    11</a></td><td class="source">    <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l12" id="l12">    12</a></td><td class="source"><span class="kn">except</span> <span class="ne">ImportError</span><span class="p">:</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l13" id="l13">    13</a></td><td class="source">    <span class="kn">pass</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l14" id="l14">    14</a></td><td class="source"></td></tr><tr class="parity0"><td class="lineno"><a href="#l15" id="l15">    15</a></td><td class="source"><span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l16" id="l16">    16</a></td><td class="source"><span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l17" id="l17">    17</a></td><td class="source"><span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l18" id="l18">    18</a></td><td class="source"><span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l19" id="l19">    19</a></td><td class="source"><span class="kn">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l20" id="l20">    20</a></td><td class="source"><span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l21" id="l21">    21</a></td><td class="source">    <span class="kn">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l22" id="l22">    22</a></td><td class="source">        <span class="kn">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l23" id="l23">    23</a></td><td class="source"><span class="kn">print</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l24" id="l24">    24</a></td><td class="source"><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l25" id="l25">    25</a></td><td class="source"></td></tr><tr class="parity1"><td class="lineno"><a href="#l26" id="l26">    26</a></td><td class="source"><span class="kn">if</span> <span class="mf">200</span> <span class="o">&lt;=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o">&lt;=</span> <span class="mf">299</span><span class="p">:</span></td></tr><tr class="parity0"><td class="lineno"><a href="#l27" id="l27">    27</a></td><td class="source">    <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></td></tr><tr class="parity1"><td class="lineno"><a href="#l28" id="l28">    28</a></td><td class="source"><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></td></tr>
-</table>
+<div class="sourcefirst"> line source</div>
+<div class="parity0 source"><a href="#l1" id="l1">     1</a> <span class="c">#!/usr/bin/env python</span></div><div class="parity1 source"><a href="#l2" id="l2">     2</a> </div><div class="parity0 source"><a href="#l3" id="l3">     3</a> <span class="n">__doc__</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;This does HTTP get requests given a host:port and path and returns</span></div><div class="parity1 source"><a href="#l4" id="l4">     4</a> <span class="s">a subset of the headers plus the body of the result.&quot;&quot;&quot;</span></div><div class="parity0 source"><a href="#l5" id="l5">     5</a> </div><div class="parity1 source"><a href="#l6" id="l6">     6</a> <span class="kn">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></div><div class="parity0 source"><a href="#l7" id="l7">     7</a> </div><div class="parity1 source"><a href="#l8" id="l8">     8</a> <span class="kn">try</span><span class="p">:</span></div><div class="parity0 source"><a href="#l9" id="l9">     9</a>     <span class="kn">import</span> <span class="nn">msvcrt</span><span class="o">,</span> <span class="nn">os</span></div><div class="parity1 source"><a href="#l10" id="l10">    10</a>     <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></div><div class="parity0 source"><a href="#l11" id="l11">    11</a>     <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></div><div class="parity1 source"><a href="#l12" id="l12">    12</a> <span class="kn">except</span> <span class="ne">ImportError</span><span class="p">:</span></div><div class="parity0 source"><a href="#l13" id="l13">    13</a>     <span class="kn">pass</span></div><div class="parity1 source"><a href="#l14" id="l14">    14</a> </div><div class="parity0 source"><a href="#l15" id="l15">    15</a> <span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></div><div class="parity1 source"><a href="#l16" id="l16">    16</a> <span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></div><div class="parity0 source"><a href="#l17" id="l17">    17</a> <span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></div><div class="parity1 source"><a href="#l18" id="l18">    18</a> <span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></div><div class="parity0 source"><a href="#l19" id="l19">    19</a> <span class="kn">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></div><div class="parity1 source"><a href="#l20" id="l20">    20</a> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></div><div class="parity0 source"><a href="#l21" id="l21">    21</a>     <span class="kn">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></div><div class="parity1 source"><a href="#l22" id="l22">    22</a>         <span class="kn">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></div><div class="parity0 source"><a href="#l23" id="l23">    23</a> <span class="kn">print</span></div><div class="parity1 source"><a href="#l24" id="l24">    24</a> <span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></div><div class="parity0 source"><a href="#l25" id="l25">    25</a> </div><div class="parity1 source"><a href="#l26" id="l26">    26</a> <span class="kn">if</span> <span class="mf">200</span> <span class="o">&lt;=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o">&lt;=</span> <span class="mf">299</span><span class="p">:</span></div><div class="parity0 source"><a href="#l27" id="l27">    27</a>     <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></div><div class="parity1 source"><a href="#l28" id="l28">    28</a> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></div>
+<div class="sourcelast"></div>
 </div>
 </div>
 </div>
@@ -165,13 +161,9 @@
 </table>
 
 <div class="overflow">
-<table class="bigtable">
-<tr>
- <th class="lineno">line</th>
- <th class="source">source</th>
-</tr>
-<tr class="parity0"><td class="lineno"><a href="#l1" id="l1">     1</a></td><td class="source">h?bsch</td></tr>
-</table>
+<div class="sourcefirst"> line source</div>
+<div class="parity0 source"><a href="#l1" id="l1">     1</a> h?bsch</div>
+<div class="sourcelast"></div>
 </div>
 </div>
 </div>
@@ -261,10 +253,9 @@
 <table class="bigtable">
 <tr>
  <th class="annotate">rev</th>
- <th class="lineno">line</th>
- <th class="line">source</th>
+ <th class="line">&nbsp;&nbsp;line source</th>
 </tr>
-<tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#1" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l1" id="l1">     1</a></td><td class="source"><span class="c">#!/usr/bin/env python</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#2" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l2" id="l2">     2</a></td><td class="source"></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#3" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l3" id="l3">     3</a></td><td class="source"><span class="n">__doc__</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;This does HTTP get requests given a host:port and path and returns</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#4" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l4" id="l4">     4</a></td><td class="source"><span class="s">a subset of the headers plus the body of the result.&quot;&quot;&quot;</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#5" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l5" id="l5">     5</a></td><td class="source"></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#6" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l6" id="l6">     6</a></td><td class="source"><span class="kn">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#7" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l7" id="l7">     7</a></td><td class="source"></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#8" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l8" id="l8">     8</a></td><td class="source"><span class="kn">try</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#9" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l9" id="l9">     9</a></td><td class="source">    <span class="kn">import</span> <span class="nn">msvcrt</span><span class="o">,</span> <span class="nn">os</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#10" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l10" id="l10">    10</a></td><td class="source">    <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#11" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l11" id="l11">    11</a></td><td class="source">    <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#12" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l12" id="l12">    12</a></td><td class="source"><span class="kn">except</span> <span class="ne">ImportError</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#13" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l13" id="l13">    13</a></td><td class="source">    <span class="kn">pass</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#14" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l14" id="l14">    14</a></td><td class="source"></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#15" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l15" id="l15">    15</a></td><td class="source"><span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#16" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l16" id="l16">    16</a></td><td class="source"><span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#17" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l17" id="l17">    17</a></td><td class="source"><span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#18" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l18" id="l18">    18</a></td><td class="source"><span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#19" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l19" id="l19">    19</a></td><td class="source"><span class="kn">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#20" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l20" id="l20">    20</a></td><td class="source"><span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#21" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l21" id="l21">    21</a></td><td class="source">    <span class="kn">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#22" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l22" id="l22">    22</a></td><td class="source">        <span class="kn">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#23" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l23" id="l23">    23</a></td><td class="source"><span class="kn">print</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#24" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l24" id="l24">    24</a></td><td class="source"><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#25" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l25" id="l25">    25</a></td><td class="source"></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#26" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l26" id="l26">    26</a></td><td class="source"><span class="kn">if</span> <span class="mf">200</span> <span class="o">&lt;=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o">&lt;=</span> <span class="mf">299</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#27" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l27" id="l27">    27</a></td><td class="source">    <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#28" title="7697c52ca9b0: a">test@0</a></td><td class="lineno"><a href="#l28" id="l28">    28</a></td><td class="source"><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></td></tr>
+<tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#1" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l1" id="l1">     1</a> <span class="c">#!/usr/bin/env python</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#2" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l2" id="l2">     2</a> </td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#3" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l3" id="l3">     3</a> <span class="n">__doc__</span> <span class="o">=</span> <span class="s">&quot;&quot;&quot;This does HTTP get requests given a host:port and path and returns</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#4" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l4" id="l4">     4</a> <span class="s">a subset of the headers plus the body of the result.&quot;&quot;&quot;</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#5" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l5" id="l5">     5</a> </td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#6" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l6" id="l6">     6</a> <span class="kn">import</span> <span class="nn">httplib</span><span class="o">,</span> <span class="nn">sys</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#7" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l7" id="l7">     7</a> </td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#8" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l8" id="l8">     8</a> <span class="kn">try</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#9" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l9" id="l9">     9</a>     <span class="kn">import</span> <span class="nn">msvcrt</span><span class="o">,</span> <span class="nn">os</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#10" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l10" id="l10">    10</a>     <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#11" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l11" id="l11">    11</a>     <span class="n">msvcrt</span><span class="o">.</span><span class="n">setmode</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">fileno</span><span class="p">(),</span> <span class="n">os</span><span class="o">.</span><span class="n">O_BINARY</span><span class="p">)</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#12" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l12" id="l12">    12</a> <span class="kn">except</span> <span class="ne">ImportError</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#13" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l13" id="l13">    13</a>     <span class="kn">pass</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#14" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l14" id="l14">    14</a> </td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#15" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l15" id="l15">    15</a> <span class="n">headers</span> <span class="o">=</span> <span class="p">[</span><span class="n">h</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">3</span><span class="p">:]]</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#16" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l16" id="l16">    16</a> <span class="n">conn</span> <span class="o">=</span> <span class="n">httplib</span><span class="o">.</span><span class="n">HTTPConnection</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">1</span><span class="p">])</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#17" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l17" id="l17">    17</a> <span class="n">conn</span><span class="o">.</span><span class="n">request</span><span class="p">(</span><span class="s">&quot;GET&quot;</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mf">2</span><span class="p">])</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#18" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l18" id="l18">    18</a> <span class="n">response</span> <span class="o">=</span> <span class="n">conn</span><span class="o">.</span><span class="n">getresponse</span><span class="p">()</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#19" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l19" id="l19">    19</a> <span class="kn">print</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">reason</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#20" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l20" id="l20">    20</a> <span class="kn">for</span> <span class="n">h</span> <span class="ow">in</span> <span class="n">headers</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#21" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l21" id="l21">    21</a>     <span class="kn">if</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#22" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l22" id="l22">    22</a>         <span class="kn">print</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s">: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">getheader</span><span class="p">(</span><span class="n">h</span><span class="p">))</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#23" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l23" id="l23">    23</a> <span class="kn">print</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#24" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l24" id="l24">    24</a> <span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">response</span><span class="o">.</span><span class="n">read</span><span class="p">())</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#25" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l25" id="l25">    25</a> </td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#26" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l26" id="l26">    26</a> <span class="kn">if</span> <span class="mf">200</span> <span class="o">&lt;=</span> <span class="n">response</span><span class="o">.</span><span class="n">status</span> <span class="o">&lt;=</span> <span class="mf">299</span><span class="p">:</span></td></tr><tr class="parity0"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#27" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l27" id="l27">    27</a>     <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">0</span><span class="p">)</span></td></tr><tr class="parity1"><td class="annotate"><a href="/annotate/7697c52ca9b0/get-with-headers.py#28" title="7697c52ca9b0: a">test@0</a></td><td class="source"><a href="#l28" id="l28">    28</a> <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="mf">1</span><span class="p">)</span></td></tr>
 </table>
 </div>
 </div>
--- a/tests/test-import	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-import	Tue Nov 25 16:24:22 2008 -0600
@@ -285,3 +285,31 @@
 rename to bar
 EOF
 cd ..
+
+echo '% test import with similarity (issue295)'
+hg init sim
+cd sim
+echo 'this is a test' > a
+hg ci -Ama
+cat > ../rename.diff <<EOF
+diff --git a/a b/a
+deleted file mode 100644
+--- a/a
++++ /dev/null
+@@ -1,1 +0,0 @@
+-this is a test
+diff --git a/b b/b
+new file mode 100644
+--- /dev/null
++++ b/b
+@@ -0,0 +1,2 @@
++this is a test
++foo
+EOF
+hg import --no-commit -v -s 1 ../rename.diff
+hg st -C
+hg revert -a
+rm b
+hg import --no-commit -v -s 100 ../rename.diff
+hg st -C
+cd ..
--- a/tests/test-import.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-import.out	Tue Nov 25 16:24:22 2008 -0600
@@ -273,3 +273,23 @@
 % test paths outside repo root
 applying patch from stdin
 abort: ../outside/foo not under root
+% test import with similarity (issue295)
+adding a
+applying ../rename.diff
+patching file a
+patching file b
+removing a
+adding b
+recording removal of a as rename to b (88% similar)
+A b
+  a
+R a
+undeleting a
+forgetting b
+applying ../rename.diff
+patching file a
+patching file b
+removing a
+adding b
+A b
+R a
--- a/tests/test-inotify	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-inotify	Tue Nov 25 16:24:22 2008 -0600
@@ -27,4 +27,12 @@
 echo % all
 hg status -A
 
+echo '% path patterns'
+echo x > dir/x
+hg status .
+hg status dir
+cd dir
+hg status .
+cd ..
+
 kill `cat hg.pid`
--- a/tests/test-inotify.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-inotify.out	Tue Nov 25 16:24:22 2008 -0600
@@ -27,3 +27,8 @@
 C dir/x
 C dir/y
 C e
+% path patterns
+M dir/x
+? hg.pid
+M dir/x
+M x
--- a/tests/test-log.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-log.out	Tue Nov 25 16:24:22 2008 -0600
@@ -5,7 +5,7 @@
 summary:     a
 
 % -f, directory
-abort: can only follow copies/renames for explicit file names
+abort: cannot follow nonexistent file: "dir"
 % -f, but no args
 changeset:   4:b30c444c7c84
 tag:         tip
--- a/tests/test-mq-guards	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-mq-guards	Tue Nov 25 16:24:22 2008 -0600
@@ -39,6 +39,9 @@
 hg qguard
 hg qpop
 
+echo % should fail
+hg qpush a.patch
+
 hg qguard a.patch
 echo % should push b.patch
 hg qpush
--- a/tests/test-mq-guards.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-mq-guards.out	Tue Nov 25 16:24:22 2008 -0600
@@ -10,6 +10,8 @@
 % should print +a
 a.patch: +a
 Patch queue now empty
+% should fail
+cannot push 'a.patch' - guarded by ['+a']
 a.patch: +a
 % should push b.patch
 applying b.patch
--- a/tests/test-mq.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-mq.out	Tue Nov 25 16:24:22 2008 -0600
@@ -227,7 +227,7 @@
 patch series already fully applied
   qpush fails
   % does nothing and succeeds
-all patches are currently applied
+qpush: test2.patch is already at the top
   qpush test2.patch succeeds
 % strip
 adding x
--- a/tests/test-patchbomb	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-patchbomb	Tue Nov 25 16:24:22 2008 -0600
@@ -4,6 +4,7 @@
 {
     sed -e 's/\(Message-Id:.*@\).*/\1/'  \
         -e 's/\(In-Reply-To:.*@\).*/\1/' \
+        -e 's/\(References:.*@\).*/\1/'  \
         -e 's/===.*/===/'
 }
 
--- a/tests/test-patchbomb.out	Tue Nov 18 16:02:14 2008 -0600
+++ b/tests/test-patchbomb.out	Tue Nov 25 16:24:22 2008 -0600
@@ -54,6 +54,7 @@
 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
 Message-Id: <8580ff50825a50c8f716.121@
 In-Reply-To: <patchbomb.120@
+References: <patchbomb.120@
 Date: Thu, 01 Jan 1970 00:02:01 +0000
 From: quux
 To: foo
@@ -80,6 +81,7 @@
 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
 Message-Id: <97d72e5f12c7e84f8506.122@
 In-Reply-To: <patchbomb.120@
+References: <patchbomb.120@
 Date: Thu, 01 Jan 1970 00:02:02 +0000
 From: quux
 To: foo
@@ -266,6 +268,7 @@
 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
 Message-Id: <8580ff50825a50c8f716.61@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:01 +0000
 From: quux
 To: foo
@@ -295,6 +298,7 @@
 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
 Message-Id: <97d72e5f12c7e84f8506.62@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:02 +0000
 From: quux
 To: foo
@@ -377,6 +381,7 @@
 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
 Message-Id: <8580ff50825a50c8f716.61@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:01 +0000
 From: quux
 To: foo
@@ -409,6 +414,7 @@
 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
 Message-Id: <97d72e5f12c7e84f8506.62@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:02 +0000
 From: quux
 To: foo
@@ -504,6 +510,7 @@
 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
 Message-Id: <8580ff50825a50c8f716.61@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:01 +0000
 From: quux
 To: foo
@@ -545,6 +552,7 @@
 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
 Message-Id: <97d72e5f12c7e84f8506.62@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:02 +0000
 From: quux
 To: foo
@@ -606,6 +614,7 @@
 X-Mercurial-Node: ff2c9fa2018b15fa74b33363bda9527323e2a99f
 Message-Id: <ff2c9fa2018b15fa74b3.61@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:01 +0000
 From: quux
 To: foo
@@ -651,6 +660,7 @@
 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
 Message-Id: <8580ff50825a50c8f716.61@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:01 +0000
 From: quux
 To: foo
@@ -677,6 +687,7 @@
 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
 Message-Id: <97d72e5f12c7e84f8506.62@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:02 +0000
 From: quux
 To: foo
@@ -757,6 +768,7 @@
 X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab
 Message-Id: <8580ff50825a50c8f716.61@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:01 +0000
 From: quux
 To: foo
@@ -789,6 +801,7 @@
 X-Mercurial-Node: 97d72e5f12c7e84f85064aa72e5a297142c36ed9
 Message-Id: <97d72e5f12c7e84f8506.62@
 In-Reply-To: <patchbomb.60@
+References: <patchbomb.60@
 Date: Thu, 01 Jan 1970 00:01:02 +0000
 From: quux
 To: foo