summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2009-08-29 20:30:21 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2009-08-29 20:30:21 +0200
commit91b5ee80601e1a2ad7106adc31fdd86f0692b314 (patch)
tree7fc6c2ab5ac7226affba5dc57e1068a0f9a40274
parent2eac7690312de3aa51acafe27bf5458c927b1636 (diff)
Strip .git when printing repo name
-rwxr-xr-xgitnoti.py8
1 files 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