Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
74:09b1f16aea24
Parent:
73:f8ed8e727640
Child:
75:081959a31b02
Child:
76:8c6feef9d15a
--- a/neo.py	Fri Apr 01 14:50:03 2016 +0100
+++ b/neo.py	Wed Mar 30 20:52:49 2016 -0500
@@ -160,8 +160,10 @@
 
         file = '^%s/' % file
         exclude = '.hg/hgignore'
-        with open(exclude, 'a') as f:
-            f.write(file + '\n')
+        with open(exclude) as f:
+            if file not in f.read().splitlines():
+                with open(exclude, 'a') as f:
+                    f.write(file + '\n')
 
     def unignore(file):
         file = '^%s/' % file
@@ -223,8 +225,10 @@
 
     def ignore(file):
         exclude = '.git/info/exclude'
-        with open(exclude, 'a') as f:
-            f.write(file + '\n')
+        with open(exclude) as f:
+            if file not in f.read().splitlines():
+                with open(exclude, 'a') as f:
+                    f.write(file + '\n')
 
     def unignore(file):
         exclude = '.git/info/exclude'