[PATCH 10 of 10] [DEMO] indicate how linear run collapsing could be used in hgweb

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Sat May 16 00:16:49 CDT 2009


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1242450907 -7200
[DEMO] indicate how linear run collapsing could be used in hgweb

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -7,6 +7,7 @@
 
 import os, mimetypes, re, cgi, copy
 import webutil
+from itertools import islice
 from mercurial import error, archival, templater, templatefilters
 from mercurial.node import short, hex
 from mercurial.util import binary
@@ -659,7 +660,10 @@
     count = len(web.repo)
     changenav = webutil.revnavgen(rev, revcount, count, web.repo.changectx)
 
-    dag = graphmod.changelogwalk(web.repo, rev, downrev)
+    dag = graphmod.changelogwalk(web.repo, rev, 0)
+    dag = graphmod.collapseruns(dag, 2)
+    dag = islice(dag, revcount)
+
     tree = list(graphmod.colorededges(dag))
     canvasheight = (len(tree) + 1) * bg_height - 27;
     data = []
@@ -674,6 +678,9 @@
             branch = ctx.branch()
             branch = branch, web.repo.branchtags().get(branch) == ctx.node()
             data.append((node, vtx, edges, desc, user, age, branch, ctx.tags()))
+        elif type == graphmod.SKIPPEDRUN:
+            skipped = any
+            data.append(("o", vtx, edges, "%i skipped" % skipped, "", "", "", ""))
 
     return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
                 lessvars=lessvars, morevars=morevars, downrev=downrev,


More information about the Mercurial-devel mailing list