Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
44:5ff277e7f754
Parent:
43:8a4a902a0654
Child:
45:5a91306f7924
--- a/neo.py	Wed Mar 30 16:12:38 2016 -0500
+++ b/neo.py	Wed Mar 30 16:27:19 2016 -0500
@@ -111,12 +111,14 @@
     def hash(): return pquery(['hg', 'id', '-i']).strip().strip('+')
     def dirty(): return pquery(['hg', 'status', '-q'])
 
-    def ignore(regex):
+    def ignore(file):
+        file = '^%s/' % file
         exclude = '.hg/exclude'
         with open(exclude, 'a') as f:
-            f.write(regex + '\n')
+            f.write(file + '\n')
 
-    def unignore(regex):
+    def unignore(file):
+        file = '^%s/' % file
         exclude = '.hg/exclude'
         if not os.path.isfile(exclude):
             return
@@ -124,10 +126,10 @@
         with open(exclude) as f:
             lines = f.read().splitlines()
 
-        if regex not in lines:
+        if file not in lines:
             return
 
-        lines.remove(regex)
+        lines.remove(file)
 
         with open(exclude, 'w') as f:
             f.write('\n'.join(lines) + '\n')
@@ -153,12 +155,12 @@
     def hash(): return pquery(['git', 'rev-parse', '--short', 'HEAD']).strip()
     def dirty(): return pquery(['git', 'diff', '--name-only', 'HEAD'])
 
-    def ignore(regex):
+    def ignore(file):
         exclude = '.git/info/exclude'
         with open(exclude, 'a') as f:
-            f.write(regex + '\n')
+            f.write(file + '\n')
 
-    def unignore(regex):
+    def unignore(file):
         exclude = '.git/info/exclude'
         if not os.path.isfile(exclude):
             return
@@ -166,10 +168,10 @@
         with open(exclude) as f:
             lines = f.read().splitlines()
 
-        if regex not in lines:
+        if file not in lines:
             return
 
-        lines.remove(regex)
+        lines.remove(file)
 
         with open(exclude, 'w') as f:
             f.write('\n'.join(lines) + '\n')
@@ -252,16 +254,17 @@
             return Repo.fromurl(f.read()).repo
 
     def write(self):
-        print self.name, '->', self.url
-
         if os.path.isfile(self.lib):
             with open(self.lib) as f:
                 if f.read().strip() == self.url.strip():
+                    print self.name, 'unmodified'
                     return
 
         with open(self.lib, 'w') as f:
             f.write(self.url + '\n')
 
+        print self.name, '->', self.url
+
 # Clone command
 @subcommand('import', 'url', 'name?',
     help='recursively import a repository')