summaryrefslogtreecommitdiff
path: root/morphlib/__init__.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-11-15 15:09:40 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-11-22 13:49:26 +0000
commit53d53ef939ee66de9b6dfbf5d2fe215fc7723400 (patch)
treeda35dfd0f45e427622ca2a51045b7d2a3122bda4 /morphlib/__init__.py
parent7e6bdb49957008b3981d570cbe8033627125efed (diff)
downloadmorph-53d53ef939ee66de9b6dfbf5d2fe215fc7723400.tar.gz
morphlib: Add branch context managers
This adds a LocalRefManager, which handles ref updates to local repositories (i.e. your workspace). It provides proxy methods for ref updates to a set of repositories. If an exception occurs in the body of the context manager, the updates will be rolled back to before the context manager was entered. The purpose for using a LocalRefManager instead of making the changes to the repositories directly, is to provide atomic updates to a set of refs in a set of repositories, where all refs are updated, or none are. This also adds a RemoteRefManager, which handles pushing branches to remote repositories. It provides a proxy push method, which will delete pushed branches, and re-push deleted branches after the context manager exits. Its purpose, instead of providing atomic updates to remote repositories, is to provide temporary branches. This is because it is used to provide temporary build branches. The difference between atomic update and temporary push, is that the remote branches are deleted when the context is left, rather than kept, as LocalRefManager does. The RemoteRefManager currently cannot provide the same atomicity guarantees as the LocalRefManager, so if there is a push between the branch being created and the RemoteRefManager cleaning it up, that change is lost without RemoteRefManager even knowing it existed. Git 1.8.5 will add functionality to make this possible.
Diffstat (limited to 'morphlib/__init__.py')
-rw-r--r--morphlib/__init__.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/morphlib/__init__.py b/morphlib/__init__.py
index 76b7a989..ef46866a 100644
--- a/morphlib/__init__.py
+++ b/morphlib/__init__.py
@@ -48,6 +48,7 @@ class Error(cliapp.AppException):
import artifact
import artifactcachereference
import artifactresolver
+import branchmanager
import bins
import buildcommand
import buildenvironment