summaryrefslogtreecommitdiff
path: root/usd/git_repository.py
diff options
context:
space:
mode:
Diffstat (limited to 'usd/git_repository.py')
-rw-r--r--usd/git_repository.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/usd/git_repository.py b/usd/git_repository.py
index 614c26a..12f65ea 100644
--- a/usd/git_repository.py
+++ b/usd/git_repository.py
@@ -1,6 +1,7 @@
### XXX: can we reduce number of calls to dpkg-parsechangelog
### XXX: is any of this data in lp already?
+import copy
from enum import Enum, unique
import functools
import logging
@@ -655,3 +656,23 @@ class USDGitRepository:
tag_name
)
raise
+
+ def commit_tree_hash(self, tree_hash, parents, log_message,
+ environment_spi=None):
+ commit_tree = ['git', 'commit-tree', tree_hash]
+
+ for parent in parents:
+ commit_tree.extend(['-p', parent])
+
+ commit_env = copy.copy(self.env)
+ if environment_spi:
+ commit_env.update(
+ self.get_commit_environment(tree_hash, environment_spi)
+ )
+ with tempfile.NamedTemporaryFile() as fp:
+ fp.write(log_message)
+ fp.flush()
+ commit_tree += ['-F', fp.name]
+ cp = run(commit_tree, env=commit_env)
+
+ return decode_binary(cp.stdout).strip()