# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1553908807 -3600
#      Sat Mar 30 02:20:07 2019 +0100
# Node ID dc48bcc3587db496b485045ea61b154e666a7fb8
# Parent  ff291a5e3670abb5ef5d79e7cb1819027b16e5fa
track_commit: issue a clearer error when repository has a null checkout

If no revision is checkout, the "update" variant of the test will fail since
there are no file to update. Before this change, the error was quite obscure: no
file name was return, as a result the filepath was just the repo directory and
`open(…)` call failed. Now we explicitly detect the error and warn about it.

I am not sure what error should be raised, So I am going for a classical
ValueError.

diff --git a/benchmarks/basic_commands.py b/benchmarks/basic_commands.py
--- a/benchmarks/basic_commands.py
+++ b/benchmarks/basic_commands.py
@@ -51,6 +51,9 @@
         else:
             # pick filename to update
             filename = self.hg('manifest').partition('\n')[0]
+            if not filename:
+                msg = 'no revision checked out in repo: %s' % self.repo_path
+                raise ValueError(msg)
             filename = os.path.join(self.repo_path, filename)
 
         # Do the commits N time