diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2010-05-28 20:07:47 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2010-05-28 20:07:47 +0200 |
commit | df2017b81b626dae38f9d53b81a8c0df9997bc81 (patch) | |
tree | 3abf92de843fe450a1a71ac0632d38769e266759 | |
parent | e60dbba3e2811fd44cdfa2924d9ea364e3a01c43 (diff) |
Detect deleted branches.
This also fixes the while-loop not hanging forever when the lock file is deleted.
-rwxr-xr-x | gitnoti.py | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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]: |