diff options
author | Jürg Billeter <j@bitron.ch> | 2017-07-07 11:52:32 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2017-07-14 14:13:51 +0200 |
commit | d2b4cd21966736c66918b97e5b369f7595363140 (patch) | |
tree | c649baedf9e9616e3c90071ce95f3cb27d0785dd /buildstream/_ostree.py | |
parent | a3fffcd9cb3402feec9e8313d93797ba1bc439d0 (diff) | |
download | buildstream-d2b4cd21966736c66918b97e5b369f7595363140.tar.gz |
_ostree.py: Add set_ref()
Diffstat (limited to 'buildstream/_ostree.py')
-rw-r--r-- | buildstream/_ostree.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py index c165d5224..3bcc0e828 100644 --- a/buildstream/_ostree.py +++ b/buildstream/_ostree.py @@ -158,6 +158,28 @@ def commit(repo, dir, ref, branch=None): raise +# set_ref(): +# +# Set symbolic reference to specified revision. +# +# Args: +# repo (OSTree.Repo): The repo +# ref (str): A symbolic reference (tag) for the commit +# rev (str): Commit checksum +# +def set_ref(repo, ref, rev): + + repo.prepare_transaction() + try: + repo.transaction_set_ref(None, ref, rev) + + # complete repo transaction + repo.commit_transaction(None) + except: + repo.abort_transaction() + raise + + # exists(): # # Checks wether a given commit or symbolic ref exists and |