summaryrefslogtreecommitdiff
path: root/gitnoti.py
diff options
context:
space:
mode:
Diffstat (limited to 'gitnoti.py')
-rwxr-xr-xgitnoti.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/gitnoti.py b/gitnoti.py
index a3fee3b..3e8b844 100755
--- a/gitnoti.py
+++ b/gitnoti.py
@@ -110,9 +110,17 @@ class ReposNotifyEvent(pyinotify.ProcessEvent):
# Check for lock file
if event.pathname.endswith('.lock'):
newname = event.pathname[:-5]
+ i = 0
# Wait max 10 seconds until file is moved
- while not os.access(newname, os.F_OK):
+ while not os.access(newname, os.F_OK) and os.access(event.pathname, os.F_OK) and i < 10:
time.sleep(1)
+ i += 1
+
+ # Assume deleted if neither file exists.
+ if not os.access(newname, os.F_OK) and not os.access(event.pathname, os.F_OK):
+ self.bot.gitmsg('Branch \002%s\002 from repo \002%s\002 was deleted.' %
+ (os.path.basename(newname), os.path.splitext(os.path.basename(pathname))[0]))
+ return
l = repos[pathname]
if not l[0]: