-
Notifications
You must be signed in to change notification settings - Fork 1
/
git_notify.py
executable file
·53 lines (40 loc) · 1.53 KB
/
git_notify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
#* part of git-tracker project
#* git-tracker - updates local cloned git repos
#* Copyright (C) 2009 Ivan Zorin <ivan.a.zorin@gmail.com>
#* see README for more information
import sys;
import pynotify;
def update(git_repo, git_message, pull, notify_time, git_icon):
#showing notify about available updates;
#getting information for notify from log;
hash_info = git_message[0];
committer = git_message[1];
message = git_message[2];
date = git_message[3];
#if pull updates by default is set, then make title green; if doesn't - red;
if pull:
title = "git tracker <span color = 'green'>updatable</span> info:";
else:
title = "git tracker <span color = 'red'>updatable</span> info:";
#show update notification;
git_notify = pynotify.Notification(title, git_repo + "\n" + hash_info + committer + message + date, git_icon);
git_notify.set_timeout(notify_time * 1000);
if not git_notify.show():
print "Failed to send notification";
sys.exit(1);
return 0;
def pull(git_repo, git_message, notify_time, git_icon):
#showing notify about commit information in updates;
#getting information for notify from log;
hash_info = git_message[0];
committer = git_message[1];
message = git_message[2];
date = git_message[3];
#show update notification;
git_notify = pynotify.Notification("git tracker pulling info:", git_repo + "\n" + hash_info + committer + message + date, git_icon);
git_notify.set_timeout(notify_time * 1000);
if not git_notify.show():
print "Failed to send notification";
sys.exit(1);
return 0;