From 65499d83aa2f1c30188db207094e0944c62672d5 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Tue, 19 Oct 2010 21:33:41 +0200 Subject: commit.sha is now commit.hexsha. --- gitnoti.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gitnoti.py b/gitnoti.py index 7ee11a2..76a2930 100755 --- a/gitnoti.py +++ b/gitnoti.py @@ -60,7 +60,7 @@ class NotifyRepo(object): self.repo = git.Repo(path) flags = pyinotify.EventsCodes.ALL_FLAGS self.wdd = bot.wm.add_watch([os.path.join(path, 'refs/heads'), os.path.join(path, 'refs/tags')], flags['IN_MODIFY'] | flags['IN_CREATE']) - self.heads = dict([(h.name, h.commit.sha) for h in self.repo.heads]) + self.heads = dict([(h.name, h.commit.hexsha) for h in self.repo.heads]) self.tags = [t.name for t in self.repo.tags] def repo_commit_msg(repo, branch, commits): @@ -84,7 +84,7 @@ def repo_commit_msg(repo, branch, commits): msg = '\002%s%s\002 pushed to \002%s\002 by \002%s\002 (%s) %s' % ( reponame, ('/'+branch) if branch else '', - commit.sha[:7], + commit.hexsha[:7], commit.committer.name if commit.author.name == commit.committer.name else '%s/%s' % (commit.committer.name, commit.author.name), stat, commit.summary @@ -92,7 +92,7 @@ def repo_commit_msg(repo, branch, commits): if options.url: msg += ' | ' - url = options.url % {'repo': reponame, 'commit': commit.sha} + url = options.url % {'repo': reponame, 'commit': commit.hexsha} if have_bitly: short_url = None try: @@ -160,7 +160,7 @@ class ReposNotifyEvent(pyinotify.ProcessEvent): return for h in repo.heads: last = l.heads[h.name] if h.name in l.heads else None - if h.commit.sha != last: + if h.commit.hexsha != last: if last: # Check against last commit commits = list(repo.iter_commits('%s..%s' % (last, h.name))) elif len(h.commit.parents): # Check against parent commit @@ -173,11 +173,11 @@ class ReposNotifyEvent(pyinotify.ProcessEvent): msg = repo_commit_msg(repo, h.name, commits) self.bot.gitmsg(msg) - l.heads[h.name] = h.commit.sha + l.heads[h.name] = h.commit.hexsha for t in (t for t in repo.tags if t.name not in l.tags): reponame = os.path.splitext(os.path.basename(repo.working_dir))[0] - self.bot.gitmsg('New tag \002%s\002 for repo \002%s\002 points to \002%s\002' % (t.name, reponame, t.commit.sha[:7])) + self.bot.gitmsg('New tag \002%s\002 for repo \002%s\002 points to \002%s\002' % (t.name, reponame, t.commit.hexsha[:7])) l.tags.append(t.name) def process_IN_CREATE(self, event): -- cgit v1.2.3