[PATCH 2 of 2 V2] log: add flushing to the initial commits from graphlog

Durham Goode durham at fb.com
Thu Sep 24 14:20:33 CDT 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1443118438 25200
#      Thu Sep 24 11:13:58 2015 -0700
# Node ID c1c9677d9b078974896186c220d4edc1575c961d
# Parent  7a9aaaadaed9887a956cb6a1e79be527e6f4a20f
log: add flushing to the initial commits from graphlog

We already did this for normal log in a previous patch. This is the identical
change for graphlog.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2149,6 +2149,7 @@ def getlogrevs(repo, pats, opts):
 
 def displaygraph(ui, dag, displayer, showparents, edgefn, getrenamed=None,
                  filematcher=None):
+    count = 0
     seen, state = [], graphmod.asciistate()
     for rev, type, ctx, parents in dag:
         char = 'o'
@@ -2176,6 +2177,14 @@ 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)
+
+        # We want the first batch of results to show up as soon as possible, so
+        # let's flush. 50 was chosen because 50 flushes adds very little
+        # overhead, but will likely fill the user's screen even if they are
+        # printing one line per commit.
+        count += 1
+        if count < 50:
+            ui.flush()
     displayer.close()
 
 def graphlog(ui, repo, *pats, **opts):


More information about the Mercurial-devel mailing list