From 48dde861b419fc850285869d4e3b27300b2d547f Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 17 Oct 2009 00:26:48 +0200 Subject: Use repo.heads instead of repo.commits() and check for empty list. --- gitnoti.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gitnoti.py') diff --git a/gitnoti.py b/gitnoti.py index ca06482..58279c7 100755 --- a/gitnoti.py +++ b/gitnoti.py @@ -58,11 +58,13 @@ def check_repos(bot): for i, v in enumerate(repos): repo = v[0] + if not repo.heads: # No commits + continue last = v[1] if last == None: - last = repo.commits()[0].id + last = repo.heads[0].commit.id repos[i][1] = last - nlast = repo.commits()[0] + nlast = repo.heads[0].commit if last and nlast.id != last: msg = repo_commit_msg(repo, nlast) bot.gitmsg(msg) @@ -99,7 +101,7 @@ class Bot(irc.IRCClient): repo = [r for r in repos if os.path.basename(r[0].path).startswith(repo)] if len(repo) == 1: r = repo[0][0] - msg = repo_commit_msg(r, r.commits()[0]) + msg = repo_commit_msg(r, r.heads[0].commit) self.msg(target, msg) elif len(repo) == 0: self.msg(target, 'No repo found.') -- cgit v1.2.3