diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2013-03-30 22:28:06 +0100 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2013-03-30 22:28:06 +0100 |
commit | 416491ddbad562224aaf81e5c609fa4efbafab71 (patch) | |
tree | 5897cdc39305ce2d572cabc36f242e7bbc831883 /lib | |
parent | 2c135574c0721d2c8e3e805f8a670011387e1608 (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.py | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -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) |