From e63a191bbad3fb97396cacc25f800baa930a8ab2 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Sep 01 2016 13:23:09 +0000 Subject: Show useful message when command new fails Fix #84 Signed-off-by: Chenxiong Qi --- diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py index 98433f6..abfd2d2 100644 --- a/src/pyrpkg/__init__.py +++ b/src/pyrpkg/__init__.py @@ -1626,7 +1626,10 @@ class Commands(object): """Return changes in a repo since the last tag""" # Find the latest tag - tag = self.repo.git.describe('--tags', '--abbrev=0') + try: + tag = self.repo.git.describe('--tags', '--abbrev=0') + except git.exc.GitCommandError: + raise rpkgError('Cannot get changes because there are no tags in this repo.') # Now get the diff self.log.debug('Diffing from tag %s' % tag) return self.repo.git.diff('-M', tag)