Morpheus / Mbed OS mbed-Client-Morpheus-hg

Dependencies:   mbed-os

Revision:
17:1e487c450f06
Parent:
16:b54f256e339e
Child:
18:1b4252106474
--- a/neo.py	Wed Mar 30 02:10:58 2016 -0500
+++ b/neo.py	Wed Mar 30 02:29:18 2016 -0500
@@ -215,11 +215,20 @@
             with cd(lib):
                 publish()
 
-#    if cwd.type == 'git':
-#        if pquery(['git'
-#
-#    if (cwd.type == 'git' and pquery(['git', 'diff', '--name-only', 'HEAD']))
-    print 'DONT WORK YET'
+    synch()
+
+    if cwd.type == 'hg':
+        modified = pquery(['hg', 'status'])
+    elif cwd.type == 'git':
+        modified = pquery(['git', 'diff', '--name-only', 'HEAD'])
+
+    if modified:
+        print cwd.path
+        print 'Uncommitted changes in %s' % cwd.name
+        raw_input('Press enter to commit/push')
+
+        popen([cwd.type, 'commit'] + (['-a'] if cwd.type == 'git' else []))
+        popen([cwd.type, 'push'] + (['-a'] if cwd.type == 'git' else []))
 
 # Synch command
 @subcommand('synch',
@@ -278,7 +287,8 @@
         shutil.copy('mbed-os/tools/settings.py', 'mbed_settings.py')
 
     popen(['python', 'mbed-os/tools/project.py',
-           '--source=%s' % cwd.path])
+           '--source=%s' % cwd.path]
+        + args)
 
 # Parse/run command
 args, remainder = parser.parse_known_args()