summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2013-03-30 22:28:06 +0100
committerJohannes Berg <johannes@sipsolutions.net>2013-03-30 22:28:06 +0100
commit416491ddbad562224aaf81e5c609fa4efbafab71 (patch)
tree5897cdc39305ce2d572cabc36f242e7bbc831883 /lib
parent2c135574c0721d2c8e3e805f8a670011387e1608 (diff)
add debug mode that commits each step in git
This allows checking easily what the code generation scripting did to the copied sources. Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/git.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/git.py b/lib/git.py
index 19fbc30e..888ca277 100644
--- a/lib/git.py
+++ b/lib/git.py
@@ -29,7 +29,6 @@ def rev_parse(rev='HEAD', tree=None):
return sha
def describe(rev='HEAD', tree=None):
- olddir = os.getcwd()
process = subprocess.Popen(['git', 'describe', '--always', '--long', rev],
stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
close_fds=True, universal_newlines=True, cwd=tree)
@@ -38,3 +37,28 @@ def describe(rev='HEAD', tree=None):
_check(process)
return stdout.strip()
+
+def init(tree=None):
+ process = subprocess.Popen(['git', 'init'],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True, universal_newlines=True, cwd=tree)
+ stdout = process.communicate()[0]
+ process.wait()
+ _check(process)
+
+def add(path, tree=None):
+ process = subprocess.Popen(['git', 'add', path],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True, universal_newlines=True, cwd=tree)
+ stdout = process.communicate()[0]
+ process.wait()
+ _check(process)
+
+def commit_all(message, tree=None):
+ add('.', tree=tree)
+ process = subprocess.Popen(['git', 'commit', '--allow-empty', '-m', message],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True, universal_newlines=True, cwd=tree)
+ stdout = process.communicate()[0]
+ process.wait()
+ _check(process)