Bug 1640815: Raise helpful error if no non-public commits on bootstrap r=rstewart
authorMitchell Hentges <mhentges@mozilla.com>
Fri, 29 May 2020 18:35:35 +0000
changeset 533050 a7395b8a770653da17905eeb991203f897058b22
parent 533049 f909996cb9a0024407aee5d49b8c172ba328f88e
child 533051 2050484c1868668644ad4801eac2990dd7556342
push id37462
push usermalexandru@mozilla.com
push dateSat, 30 May 2020 09:46:43 +0000
treeherdermozilla-central@8aaca63ec5c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrstewart
bugs1640815
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1640815: Raise helpful error if no non-public commits on bootstrap r=rstewart Differential Revision: https://phabricator.services.mozilla.com/D77505
python/mozversioncontrol/mozversioncontrol/__init__.py
--- a/python/mozversioncontrol/mozversioncontrol/__init__.py
+++ b/python/mozversioncontrol/mozversioncontrol/__init__.py
@@ -317,19 +317,27 @@ class HgRepository(Repository):
         if not self._client.server:
             return super(HgRepository, self)._run(*args, **runargs)
 
         # hglib requires bytes on python 3
         args = [a.encode('utf-8') if not isinstance(a, bytes) else a for a in args]
         return self._client.rawcommand(args).decode('utf-8')
 
     def get_commit_time(self):
-        return int(self._run(
+        newest_public_revision_time = self._run(
             'log', '--rev', 'heads(ancestors(.) and not draft())',
-            '--template', '{word(0, date|hgdate)}', '--limit', '1').strip())
+            '--template', '{word(0, date|hgdate)}', '--limit', '1').strip()
+
+        if not newest_public_revision_time:
+            raise RuntimeError('Unable to find a non-draft commit in this hg '
+                               'repository. If you created this repository from a '
+                               'bundle, have you done a "hg pull" from hg.mozilla.org '
+                               'since?')
+
+        return int(newest_public_revision_time)
 
     def sparse_checkout_present(self):
         # We assume a sparse checkout is enabled if the .hg/sparse file
         # has data. Strictly speaking, we should look for a requirement in
         # .hg/requires. But since the requirement is still experimental
         # as of Mercurial 4.3, it's probably more trouble than its worth
         # to verify it.
         sparse = os.path.join(self.path, '.hg', 'sparse')