diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-08-07 11:31:14 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-08-07 11:31:14 +0000 |
commit | 6c0e0fb41df901771be8074d1e2603ceb26a3926 (patch) | |
tree | 53614d4626371a6e8d8682c1b8b2b886b24ef7f0 /morphlib/workspace.py | |
parent | 0f2594f79c69ae711cee66a5f8b146550277e01e (diff) | |
parent | 16f17f5d713960ab3ed9981b0b554e3657fb82f9 (diff) | |
download | definitions-6c0e0fb41df901771be8074d1e2603ceb26a3926.tar.gz |
Merge branch 'liw/refactor-checkout-etc-v2'
Reviewed-by: various
Diffstat (limited to 'morphlib/workspace.py')
-rw-r--r-- | morphlib/workspace.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/morphlib/workspace.py b/morphlib/workspace.py index 3a2269c8..93f699e6 100644 --- a/morphlib/workspace.py +++ b/morphlib/workspace.py @@ -53,6 +53,40 @@ class Workspace(object): def __init__(self, root_directory): self.root = root_directory + def get_default_system_branch_directory_name(self, system_branch_name): + '''Determine directory where a system branch would be checked out. + + Return the fully qualified pathname to the directory where + a system branch would be checked out. The directory may or may + not exist already. + + If the system branch is checked out, but into a directory of + a different name (which is allowed), that is ignored: this method + only computed the default name. + + ''' + + return os.path.join(self.root, system_branch_name) + + def create_system_branch_directory(self, + root_repository_url, system_branch_name): + '''Create a directory for a system branch. + + Return a SystemBranchDirectory object that represents the + directory. The directory must not already exist. The directory + gets created and initialised (the .morph-system-branch/config + file gets created and populated). The root repository of the + system branch does NOT get checked out, the caller needs to + do that. + + ''' + + dirname = self.get_default_system_branch_directory_name( + system_branch_name) + sb = morphlib.sysbranchdir.create( + dirname, root_repository_url, system_branch_name) + return sb + def open(dirname): '''Open an existing workspace. |