+ # Just in case git can't be found
+ try:
+ # Get hash of the latest git commit
+ revision = subprocess.check_output( ['git', 'rev-parse', 'HEAD'] ).decode()[:-1]
+
+ # Get list of files that have changed since the commit
+ changed = subprocess.check_output( ['git', 'diff-index', '--name-only', 'HEAD', '--'] ).decode().splitlines()
+ except:
+ revision = "<no git>"
+ changed = []
+
+ # Change back to the old working directory
+ os.chdir( origPath )
+
+ return revision, changed