diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-01-06 11:48:37 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-01-06 12:18:39 +0100 |
commit | 30e49dd1e332ce005b0d3cd977186753bf2c3b06 (patch) | |
tree | 21a973106fc77da90908179055c59ef5eca46710 | |
parent | bba1ec713440fdbd3cfecde22a7fbcf7e162b256 (diff) |
GitRepository.make_tree: make it easier to read
-rw-r--r-- | gbp/git/repository.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index a1c27b1f..fec53fcb 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -996,19 +996,20 @@ class GitRepository(object): def make_tree(self, contents): """ - Create a tree based on contents. I{contents} has the same format than - the I{GitRepository.list_tree} output. + Create a tree based on contents. + + @param contents: same format as I{GitRepository.list_tree} output. + @type contents: C{list} of C{str} """ - out = '' + objs = '' args = GitArgs('-z') - for obj in contents: - mode, type, sha1, name = obj - out += '%s %s %s\t%s\0' % (mode, type, sha1, name) + for mode, type, sha1, name in contents: + objs += '%s %s %s\t%s\0' % (mode, type, sha1, name) sha1, err, ret = self._git_inout('mktree', args.args, - out, + objs, capture_stderr=True) if ret: raise GitRepositoryError("Failed to mktree: '%s'" % err) |