Fixed crash when changelog doesn't exist
authorEd Bartosh <eduard.bartosh@intel.com>
Tue, 5 Jun 2012 07:39:55 +0000 (10:39 +0300)
committerEd Bartosh <eduard.bartosh@intel.com>
Tue, 5 Jun 2012 08:50:27 +0000 (11:50 +0300)
Change-Id: I8e1a0cf9c82b48b93fdf735af293c69d6084d5e3

gitbuildsys/cmd_changelog.py

index 3e39869b174b0db8bda7c665072c51d51dabd684..3899c325a535e051a42428094b2f3532b4e6d9e6 100644 (file)
@@ -47,9 +47,11 @@ def add_entries(changesfile, new_entries):
 
 def get_latest_rev(changesfile):
     """Get latest git revision from the changelog."""
-    with open(changesfile) as chlog:
-        line = chlog.readline()
-        return line.strip().split(" ")[-1].split("@")[-1]
+    if os.path.exists(changesfile):
+        with open(changesfile) as chlog:
+            line = chlog.readline()
+            return line.strip().split(" ")[-1].split("@")[-1]
+    return ''
 
 
 def make_log_entries(commits, git_repo):