fastannotate: write out files from server in a predictable order
authorAugie Fackler <augie@google.com>
Wed, 01 Aug 2018 11:10:41 -0400
changeset 39211 c8a40b33ce30
parent 39210 1ddb296e0dee
child 39212 ca053fc7efc5
fastannotate: write out files from server in a predictable order This is mostly for test output stabilization, but it *might* be slightly better with a ton of annotate caches because we'll write to one directory at a time rather than bouncing around randomly. Differential Revision: https://phab.mercurial-scm.org/D3995
hgext/fastannotate/protocol.py
tests/test-fastannotate-protocol.t
--- a/hgext/fastannotate/protocol.py	Mon Jul 30 22:50:00 2018 -0400
+++ b/hgext/fastannotate/protocol.py	Wed Aug 01 11:10:41 2018 -0400
@@ -185,11 +185,13 @@
 
     ui.debug('fastannotate: server returned\n')
     for result in results:
-        for path, content in result.result().iteritems():
+        r = result.result()
+        for path in sorted(r):
             # ignore malicious paths
             if not path.startswith('fastannotate/') or '/../' in (path + '/'):
                 ui.debug('fastannotate: ignored malicious path %s\n' % path)
                 continue
+            content = r[path]
             if ui.debugflag:
                 ui.debug('fastannotate: writing %d bytes to %s\n'
                          % (len(content), path))
--- a/tests/test-fastannotate-protocol.t	Mon Jul 30 22:50:00 2018 -0400
+++ b/tests/test-fastannotate-protocol.t	Wed Aug 01 11:10:41 2018 -0400
@@ -47,9 +47,8 @@
   sending protocaps command
   fastannotate: requesting 1 files
   sending getannotate command
-  fastannotate: writing 112 bytes to fastannotate/default/a.l (?)
   fastannotate: server returned
-  fastannotate: writing 112 bytes to fastannotate/default/a.l (?)
+  fastannotate: writing 112 bytes to fastannotate/default/a.l
   fastannotate: writing 94 bytes to fastannotate/default/a.m
   fastannotate: a: using fast path (resolved fctx: True)
   0: 1