summaryrefslogtreecommitdiff
path: root/morphlib/sysbranchdir.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/sysbranchdir.py')
-rw-r--r--morphlib/sysbranchdir.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/morphlib/sysbranchdir.py b/morphlib/sysbranchdir.py
index 4dbc5f6c..80e56b33 100644
--- a/morphlib/sysbranchdir.py
+++ b/morphlib/sysbranchdir.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2014 Codethink Limited
+# Copyright (C) 2013-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -107,6 +107,11 @@ class SystemBranchDirectory(object):
return os.path.join(self.root_directory, relative)
+ def relative_to_root_repo(self, path): # pragma: no cover
+ gitdirpath = self.get_git_directory_name(self.root_repository_url)
+
+ return os.path.relpath(os.path.abspath(path), gitdirpath)
+
def get_git_directory_name(self, repo_url):
'''Return directory pathname for a given git repository.
@@ -123,6 +128,7 @@ class SystemBranchDirectory(object):
'''
found_repo = self._find_git_directory(repo_url)
+
if not found_repo:
return self._fabricate_git_directory_name(repo_url)
return found_repo