summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-10-17 00:26:48 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2009-10-17 00:26:48 +0200
commit48dde861b419fc850285869d4e3b27300b2d547f (patch)
treecf0d853823c3096fd5f91636796b6a1260fad68d
parent7b6aae8dbdb3e0756e96419ca2c6d3890e8b94d7 (diff)
Use repo.heads instead of repo.commits() and check for empty list.
-rwxr-xr-xgitnoti.py8
1 files changed, 5 insertions, 3 deletions
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.')