summaryrefslogtreecommitdiff
path: root/morphlib/gitindex.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-11-11 17:44:57 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-11-22 13:49:25 +0000
commit65fc7474c12b7b0fccd57810ba4f06d2fbca895a (patch)
treef8b5791cce76424175ec7e5333ab42659db388dc /morphlib/gitindex.py
parent0b4e147009bffa7b720ee767633e3acf3bb68c3a (diff)
downloadmorph-65fc7474c12b7b0fccd57810ba4f06d2fbca895a.tar.gz
gitindex: Add GitIndex.set_to_tree(treeish) method
This is used to set the state of the index to that of a previously known commit. This is needed for the build without commit logic, so that commits generated are that of the last commit in the repository and anything uncommitted.
Diffstat (limited to 'morphlib/gitindex.py')
-rw-r--r--morphlib/gitindex.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/morphlib/gitindex.py b/morphlib/gitindex.py
index d8de8824..7cac2311 100644
--- a/morphlib/gitindex.py
+++ b/morphlib/gitindex.py
@@ -97,3 +97,7 @@ class GitIndex(object):
for code, to_path, from_path in self._get_status():
if code not in (STATUS_UNTRACKED, STATUS_IGNORED):
yield code, to_path, from_path
+
+ def set_to_tree(self, treeish):
+ '''Modify the index to contain the contents of the treeish.'''
+ self._run_git('read-tree', treeish)