From 4249b7ed46d383b48aa1fbcdb1fa6459022fb4db Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Fri, 12 Oct 2012 17:25:16 +0100 Subject: 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. --- morphlib/plugins/branch_and_merge_plugin.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'morphlib/plugins') 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: -- cgit v1.2.1