@@ 48,13 48,14 @@ class PTmp(pyinotify.ProcessEvent):
"""
This class represent a watcher for the local repository.
"""
- def __init__(self, url, local_url, username):
+ def __init__(self, type_repo, url, local_url, username):
"""
"""
- self.repo = hgsync.HgSync(url, local_url, username)
- #self.repo.clone()
+ if type_repo == "hg":
+ self.repo = hgsync.HgSync(url, local_url, username)
+ #self.repo.clone()
- self.in_from = ""
+ self.in_from = ""
def process_IN_CREATE(self, event):
"""
@@ 99,12 100,12 @@ class PTmp(pyinotify.ProcessEvent):
-def start_watcher(username, password, url, local_url):
+def start_watcher(type_repo, username, password, url, local_url):
"""
Start a watcher. This function is called in a separate thread.
"""
wm = pyinotify.WatchManager()
- notifier = pyinotify.Notifier(wm, PTmp("https://" + username + ":" + password + "@" + url, local_url, username))
+ notifier = pyinotify.Notifier(wm, PTmp(type_repo, "https://" + username + ":" + password + "@" + url, local_url, username))
wdd = wm.add_watch((local_url) , mask, rec=True, auto_add=True, exclude_filter=excl)
@@ 141,6 142,6 @@ if __name__ == "__main__":
# Launch a new thread for the repository to watch
- thread = threading.Thread(None, start_watcher, None, (username, password, url, local_url))
+ thread = threading.Thread(None, start_watcher, None, (type_repo, username, password, url, local_url))
#thread.setDaemon(True)
thread.start()
No newline at end of file