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

login
register
mail settings
Submitter Durham Goode
Date Sept. 24, 2015, 7:20 p.m.
Message ID <c1c9677d9b0789748961.1443122433@dev2000.prn2.facebook.com>
Download mbox | patch
Permalink /patch/10614/
State Accepted
Headers show

Comments

Durham Goode - Sept. 24, 2015, 7:20 p.m.
# HG changeset patch
# User Durham Goode <durham@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.

Patch

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):