Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
52:25da1dfebd7a
Parent:
49:977ea8d3e661
Child:
53:f77f23f3e087
diff -r 977ea8d3e661 -r 25da1dfebd7a neo.py
--- a/neo.py	Wed Mar 30 17:18:04 2016 -0500
+++ b/neo.py	Wed Mar 30 17:53:08 2016 -0500
@@ -92,12 +92,6 @@
     def clone(url, name=None, hash=None):
         popen([hg_cmd, 'clone', url, name] + (['-u', hash] if hash else []))
 
-        # add exclude file
-        with cd(name):
-            with open('.hg/hgrc', 'a') as f:
-                f.write('[ui]\n')
-                f.write('ignore.local = .hg/hgignore\n')
-
     def add(file): popen([hg_cmd, 'add', file])
     def remove(file):
         popen([hg_cmd, 'rm', '-f', file])
@@ -116,6 +110,14 @@
     def dirty(): return pquery([hg_cmd, 'status', '-q'])
 
     def ignore(file):
+        hooked = False
+        hook = 'ignore.local = .hg/hgignore'
+        with open('.hg/hgrc') as f:
+            if hook not in f.read().splitlines():
+                with open('.hg/hgrc', 'a') as f:
+                    f.write('[ui]\n')
+                    f.write(hook + '\n')
+
         file = '^%s/' % file
         exclude = '.hg/hgignore'
         with open(exclude, 'a') as f: