Fixed crashes 'Revision xxx not found' in changelog mode
authorEd Bartosh <eduard.bartosh@intel.com>
Thu, 10 May 2012 11:18:22 +0000 (14:18 +0300)
committerEd Bartosh <eduard.bartosh@intel.com>
Thu, 10 May 2012 11:18:22 +0000 (14:18 +0300)
Change-Id: I6de270201e86cb98d3b605b575c56dd2fd4d8ca0

gitbuildsys/cmd_changelog.py

index 8d97780..e41de26 100644 (file)
@@ -116,18 +116,20 @@ def do(opts, _args):
 
     # get the commit start from the opts.since
     if opts.since:
-        commitid_since = repo.rev_parse(opts.since)
-        if not commitid_since:
-            msger.error("Invalid since commit object name: %s" % (opts.since))
+        since = opts.since
     else:
-        sha1 = get_latest_rev(fn_changes)
-        if sha1:
-            commitid_since = repo.rev_parse(sha1)
-            if not commitid_since:
+        since = get_latest_rev(fn_changes)
+
+    commitid_since = None
+    if since:
+        try:
+            commitid_since = repo.rev_parse(since)
+        except GitRepositoryError:
+            if opts.since:
+                msger.error("Invalid commit: %s" % (opts.since))
+            else:
                 msger.error("Can't find last commit ID in the log, "\
-                           "please specify it by '--since'")
-        else:
-            commitid_since = None
+                            "please specify it by '--since'")
 
     commits = repo.get_commits(commitid_since, 'HEAD')
     if not commits: