Browse Source

Fix syntax errors, better debugging

Hamilton Turner 11 years ago
parent
commit
c113cd3d32
1 changed files with 8 additions and 4 deletions
  1. 8 4
      toolset/run-ci.py

+ 8 - 4
toolset/run-ci.py

@@ -110,14 +110,17 @@ class CIRunnner:
       # and look for the files changed there. This is an aggressive 
       # and look for the files changed there. This is an aggressive 
       # strategy to ensure that commits to master are always tested 
       # strategy to ensure that commits to master are always tested 
       # well
       # well
+      log.info("TRAVIS_COMMIT_RANGE: %s", os.environ['TRAVIS_COMMIT_RANGE'])
+      log.info("TRAVIS_COMMIT      : %s", os.environ['TRAVIS_COMMIT'])
+
       is_PR = (os.environ['TRAVIS_PULL_REQUEST'] != "false")
       is_PR = (os.environ['TRAVIS_PULL_REQUEST'] != "false")
       if is_PR:
       if is_PR:
         log.info('I am testing a pull request')
         log.info('I am testing a pull request')
-        log.info("TRAVIS_COMMIT_RANGE: %s", os.environ['TRAVIS_COMMIT_RANGE'])
-        log.info("TRAVIS_COMMIT      : %s", os.environ['TRAVIS_COMMIT'])
         first_commit = os.environ['TRAVIS_COMMIT_RANGE'].split('...')[0]
         first_commit = os.environ['TRAVIS_COMMIT_RANGE'].split('...')[0]
-
         last_commit = subprocess.check_output("git rev-list -n 1 FETCH_HEAD^2", shell=True).rstrip('\n')
         last_commit = subprocess.check_output("git rev-list -n 1 FETCH_HEAD^2", shell=True).rstrip('\n')
+        log.info("Guessing that first commit in PR is : %s", first_commit)
+        log.info("Guessing that final commit in PR is : %s", last_commit)
+
         if first_commit == "" or first_commit == last_commit:
         if first_commit == "" or first_commit == last_commit:
           # There is only one commit in the pull request so far, 
           # There is only one commit in the pull request so far, 
           # or Travis-CI is not yet passing the commit range properly 
           # or Travis-CI is not yet passing the commit range properly 
@@ -125,11 +128,13 @@ class CIRunnner:
           #
           #
           # On the oddball chance that it's a merge commit, we pray  
           # On the oddball chance that it's a merge commit, we pray  
           # it's a merge from upstream and also pass --first-parent 
           # it's a merge from upstream and also pass --first-parent 
+          log.info("Not enough info for a commit range, examining %s only", last_commit)
           self.commit_range = "--first-parent -1 %s" % last_commit
           self.commit_range = "--first-parent -1 %s" % last_commit
         else: 
         else: 
           # In case they merged in upstream, we only care about the first 
           # In case they merged in upstream, we only care about the first 
           # parent. For crazier merges, we hope
           # parent. For crazier merges, we hope
           self.commit_range = "--first-parent %s...%s" % (first_commit, last_commit)
           self.commit_range = "--first-parent %s...%s" % (first_commit, last_commit)
+
       if not is_PR:
       if not is_PR:
         log.info('I am not testing a pull request')
         log.info('I am not testing a pull request')
         # If more than one commit was pushed, examine everything including 
         # If more than one commit was pushed, examine everything including 
@@ -141,7 +146,6 @@ class CIRunnner:
         if self.commit_range == "":
         if self.commit_range == "":
           self.commit_range = "-m -1 %s" % os.environ['TRAVIS_COMMIT']
           self.commit_range = "-m -1 %s" % os.environ['TRAVIS_COMMIT']
 
 
-      log.info("I found a range of %s...%s", first_commit, last_commit)
     except KeyError:
     except KeyError:
       log.warning("I should only be used for automated integration tests e.g. Travis-CI")
       log.warning("I should only be used for automated integration tests e.g. Travis-CI")
       log.warning("Were you looking for run-tests.py?")
       log.warning("Were you looking for run-tests.py?")