lib/bpgit.py: add git clean support
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>
Mon, 21 Oct 2013 09:08:27 +0000 (11:08 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Mon, 21 Oct 2013 19:50:38 +0000 (21:50 +0200)
We'll use this later.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
lib/bpgit.py

index d2fb98628f41e8c3c81cbd7eb9acfd9c2ad852df..f4af314a55ed2f5d2da2c40aa2228e574bd34e67 100644 (file)
@@ -27,6 +27,16 @@ def rev_parse(rev='HEAD', tree=None):
         raise SHAError()
     return sha
 
+def clean(tree=None):
+    cmd = ['git', 'clean', '-f', '-x', '-d', '-q']
+
+    process = subprocess.Popen(cmd,
+                               stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+                               close_fds=True, universal_newlines=True, cwd=tree)
+    stdout = process.communicate()[0]
+    process.wait()
+    _check(process)
+
 def status(tree=None):
     '''
     For interpretation of the porcelain output refer to