inotify: add client code for long pathname handling
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 07 Sep 2008 15:10:11 +0200
changeset 7024 ee308d44ad76
parent 6997 9c4e488f105e
child 7025 766d8cb8c622
inotify: add client code for long pathname handling
hgext/inotify/client.py
tests/test-inotify-issue1208.out
--- a/hgext/inotify/client.py	Sat Sep 06 14:11:33 2008 +0200
+++ b/hgext/inotify/client.py	Sun Sep 07 15:10:11 2008 +0200
@@ -14,7 +14,14 @@
 def query(ui, repo, names, match, list_ignored, list_clean, list_unknown=True):
     sock = socket.socket(socket.AF_UNIX)
     sockpath = repo.join('inotify.sock')
-    sock.connect(sockpath)
+    try:
+        sock.connect(sockpath)
+    except socket.error, err:
+        if err[0] == "AF_UNIX path too long":
+            sockpath = os.readlink(sockpath)
+            sock.connect(sockpath)
+        else:
+            raise
 
     def genquery():
         for n in names or []:
--- a/tests/test-inotify-issue1208.out	Sat Sep 06 14:11:33 2008 +0200
+++ b/tests/test-inotify-issue1208.out	Sun Sep 07 15:10:11 2008 +0200
@@ -1,9 +1,7 @@
 % fail
-failed to contact inotify server: AF_UNIX path too long
+failed to contact inotify server: No such file or directory
 deactivating inotify
 abort: could not start server: File exists
 % inserve
 % status
-failed to contact inotify server: AF_UNIX path too long
-deactivating inotify
 ? hg.pid