[PATCH 2 of 2] log: add flush delay config to graphlog

Durham Goode durham at fb.com
Tue Sep 22 01:18:41 UTC 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1442884584 25200
#      Mon Sep 21 18:16:24 2015 -0700
# Node ID 7d7d6cde6e4991c96b3db336a4eeeb85148452c9
# Parent  7f997a372e42f61638cb2609b3323c3fb7b45ed3
log: add flush delay config to graphlog

This was already added to the normal log code path. Let's add it to the graph
log path as well.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -7,7 +7,7 @@
 
 from node import hex, bin, nullid, nullrev, short
 from i18n import _
-import os, sys, errno, re, tempfile, cStringIO, shutil
+import os, sys, errno, re, tempfile, cStringIO, shutil, time
 import util, scmutil, templater, patch, error, templatekw, revlog, copies
 import match as matchmod
 import repair, graphmod, revset, phases, obsolete, pathutil
@@ -2150,6 +2150,9 @@ def getlogrevs(repo, pats, opts):
 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
                  filematcher=None):
     seen, state = [], graphmod.asciistate()
+
+    lastflush = time.time()
+    flushlimit = float(ui.config('ui', 'maxlogflushdelay', 1))
     for rev, type, ctx, parents in dag:
         char = 'o'
         if ctx.node() in showparents:
@@ -2176,6 +2179,11 @@ def displaygraph(ui, dag, displayer, sho
         edges = edgefn(type, char, lines, seen, rev, parents)
         for type, char, lines, coldata in edges:
             graphmod.ascii(ui, state, type, char, lines, coldata)
+
+        now = time.time()
+        if now - lastflush > flushlimit:
+            ui.flush()
+            lastflush = now
     displayer.close()
 
 def graphlog(ui, repo, *pats, **opts):



More information about the Mercurial-devel mailing list