From 91b5ee80601e1a2ad7106adc31fdd86f0692b314 Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 29 Aug 2009 20:30:21 +0200 Subject: Strip .git when printing repo name --- gitnoti.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gitnoti.py b/gitnoti.py index 4b5d27e..ece0d02 100755 --- a/gitnoti.py +++ b/gitnoti.py @@ -27,7 +27,7 @@ def repo_commit_msg(repo, commit): stat += ' \00305--%d\017' % commit.stats.total['deletions'] stat += ' \00303++%d\017' % commit.stats.total['insertions'] msg = '\002%s\002 pushed to \002%s\002 by \002%s\002 (%s) %s' % ( - os.path.basename(repo.path), + os.path.splitext(os.path.basename(repo.path))[0], commit.id_abbrev, commit.committer.name if commit.author.name == commit.committer.name else '%s/%s' % (commit.committer.name, commit.author.name), stat, @@ -40,14 +40,14 @@ def check_repos(bot): repo_paths = [x for x in os.listdir(root) if x.endswith('.git')] if not repos: repos = [[git.Repo('%s/%s' % (root, x)), None] for x in repo_paths] - bot.gitmsg('Repos initialized: %s' % (', '.join([os.path.basename(x[0].path) for x in repos]))) + bot.gitmsg('Repos initialized: %s' % (', '.join([os.path.splitext(os.path.basename(x[0].path))[0] for x in repos]))) else: old_paths = [os.path.basename(x[0].path) for x in repos] new_paths = [x for x in repo_paths if not x in old_paths] for n in new_paths: repos.append([git.Repo('%s/%s' % (root, x)), None]) if new_paths: - bot.gitmsg('New repo%s: %s' % ('' if len(new_paths) == 1 else 's', ', '.join(new_paths))) + bot.gitmsg('New repo%s: %s' % ('' if len(new_paths) == 1 else 's', ', '.join([os.path.splitext(x)[0] for x in new_paths]))) for i, v in enumerate(repos): repo = v[0] @@ -82,7 +82,7 @@ class Bot(irc.IRCClient): if messagelist[0].startswith(self.nickname): cmd = messagelist[1].lower() if cmd == 'list': - s = 'Repos: %s' % ', '.join([os.path.basename(x[0].path) for x in repos]) + s = 'Repos: %s' % ', '.join([os.path.splitext(os.path.basename(x[0].path))[0] for x in repos]) self.msg(target, s) elif cmd == 'last': repo = messagelist[2].lower() if len(messagelist) > 2 else None -- cgit v1.2.3