diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-10-12 17:25:16 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-10-12 17:33:55 +0100 |
commit | 4249b7ed46d383b48aa1fbcdb1fa6459022fb4db (patch) | |
tree | e3f28dc551cd164e00ec76d46a209b93e474778b | |
parent | 7ae8679cfbd22581d3bda8738b5a9b069db629ff (diff) | |
download | definitions-4249b7ed46d383b48aa1fbcdb1fa6459022fb4db.tar.gz |
morph status, foreach: Find root repo in correct way
Previously if the user had renamed the directory holding the root
repository, the commands would break tragically.
Also fix find_repository() to avoid aborting if it encounters a git
repo in the branch checkout that wasn't put there by Morph.
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 8c7b85ff..384f0550 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -125,7 +125,12 @@ class BranchAndMergePlugin(cliapp.Plugin): def find_repository(self, branch_dir, repo): for dirname in self.walk_special_directories(branch_dir, special_subdir='.git'): - original_repo = self.get_repo_config(dirname, 'morph.repository') + try: + original_repo = self.get_repo_config( + dirname, 'morph.repository') + except cliapp.AppException: + # The user may have manually put a git repo in the branch + continue if repo == original_repo: return dirname return None @@ -1326,8 +1331,7 @@ class BranchAndMergePlugin(cliapp.Plugin): return root_repo = self.get_branch_config(branch_path, 'branch.root') - root_repo_dir = self.convert_uri_to_path(root_repo) - root_repo_path = os.path.join(branch_path, root_repo_dir) + root_repo_path = self.find_repository(branch_path, root_repo) self.app.output.write("On branch %s, root %s\n" % (branch, root_repo)) @@ -1370,8 +1374,7 @@ class BranchAndMergePlugin(cliapp.Plugin): branch, branch_path = self.deduce_system_branch() root_repo = self.get_branch_config(branch_path, 'branch.root') - root_repo_dir = self.convert_uri_to_path(root_repo) - root_repo_path = os.path.join(branch_path, root_repo_dir) + root_repo_path = self.find_repository(branch_path, root_repo) for d in self.iterate_branch_repos(branch_path, root_repo_path): try: |