Bug 534992 - improve error reporting when cleanroot is not set - r=ted
authorDustin J. Mitchell <dustin@mozilla.com>
Wed, 16 May 2012 14:51:45 -0400
changeset 95594 9fdd1e53e1d06c28618b75af19784d2578eadd96
parent 95593 98ca9bd48170aac6a183a165a57b28f05a41b4f5
child 95595 553bea8ea04e0940b02a7838e4d881b543337aa7
push idunknown
push userunknown
push dateunknown
reviewersted
bugs534992
milestone15.0a1
Bug 534992 - improve error reporting when cleanroot is not set - r=ted
toolkit/crashreporter/tools/symbolstore.py
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -54,16 +54,17 @@
 #     -s <srcdir>  : Use <srcdir> as the top source directory to
 #                    generate relative filenames.
 
 import sys
 import platform
 import os
 import re
 import shutil
+import textwrap
 from subprocess import call, Popen, PIPE, STDOUT
 from optparse import OptionParser
 
 # Utility classes
 
 class VCSFileInfo:
     """ A base class for version-controlled file information. Ensures that the
         following attributes are generated only once (successfully):
@@ -283,22 +284,28 @@ class HGFileInfo(VCSFileInfo):
             path = read_output('hg', '-R', srcdir,
                                'showconfig', 'paths.default')
             if path == '':
                 hg_root = os.environ.get("SRCSRV_ROOT")
                 if hg_root:
                     path = hg_root
                 else:
                     print >> sys.stderr, "Failed to get HG Repo for %s" % srcdir
+            cleanroot = None
             if path != '': # not there?
                 match = rootRegex.match(path)
                 if match:
                     cleanroot = match.group(1)
                     if cleanroot.endswith('/'):
                         cleanroot = cleanroot[:-1]
+            if cleanroot is None:
+                print >> sys.stderr, textwrap.dedent("""\
+                    Could not determine repo info for %s.  This is either not a clone of the web-based
+                    repository, or you have not specified SRCSRV_ROOT, or the clone is corrupt.""") % srcdir
+                sys.exit(1)
             HGRepoInfo.repos[srcdir] = HGRepoInfo(path, rev, cleanroot)
         self.repo = HGRepoInfo.repos[srcdir]
         self.file = file
         self.srcdir = srcdir
 
     def GetRoot(self):
         return self.repo.path