Commits

Florent Xicluna  committed df827a7

Fix benchmark preparation when files are added in the working copy.

  • Participants
  • Parent commits f4ca74f

Comments (0)

Files changed (1)

File bench/wzbench.py

 
     # figure out how many times we have to run the function to
     # get reliable timings.
-    for i in xrange(1, 10):
-        rounds = 10 * i
+    for i in xrange(3, 10):
+        rounds = 1 << i
         t = timer()
         for x in xrange(rounds):
             func()
         hg = lambda *x: subprocess.call(['hg'] + list(x), cwd=repo,
                                         stdout=null_out, stderr=null_out)
         hg('revert', '-a', '--no-backup')
+        client = subprocess.Popen(['hg', 'status', '--unknown', '-n', '-0'],
+                                  stdout=subprocess.PIPE, cwd=repo)
+        unknown = client.communicate()[0]
+        if unknown:
+            client = subprocess.Popen(['xargs', '-0', 'rm', '-f'], cwd=repo,
+                                      stdout=null_out, stdin=subprocess.PIPE)
+            client.communicate(unknown)
         hg('pull', '../..')
         hg('update', node)
         if node == 'tip':