diff mxtool/mx.py @ 15402:5dcf0ae606f3

mx: new export command
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 28 Apr 2014 12:07:49 +0200
parents 1439685d06e4
children 7a5c34543493
line wrap: on
line diff
--- a/mxtool/mx.py	Fri Apr 25 15:47:00 2014 +0200
+++ b/mxtool/mx.py	Mon Apr 28 12:07:49 2014 +0200
@@ -608,6 +608,17 @@
             else:
                 return None
 
+    def isDirty(self, sDir, abortOnError=True):
+        try:
+            return len(subprocess.check_output(['hg', 'status', '-R', sDir])) > 0
+        except OSError:
+            warn(self.missing)
+        except subprocess.CalledProcessError:
+            if abortOnError:
+                abort('failed to get status')
+            else:
+                return None
+
 class Suite:
     def __init__(self, mxDir, primary, load=True):
         self.dir = dirname(mxDir)