From 2cf5f0691241fa0e771cd7e7a8999961dc7250e8 Mon Sep 17 00:00:00 2001 From: Richard Ipsum Date: Mon, 11 Nov 2013 16:35:16 +0000 Subject: Use contents of working tree, regardless of which ref is checked out morph edit loads stratum morphs from the morphs repository. As a result a user can update a stratum morph and have their changes overwritten by morph edit. Even if the user commits their changes they will be overwritten if the ref the user committed to does not match the ref specified by the system morphology. This commit modifies morph edit so that stratum morphs are loaded from the user's file system rather than the morphs repository. If there is no stratum morph on the user's file system. then the stratum morph is loaded from the morphs repository --- morphlib/plugins/branch_and_merge_new_plugin.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 9c4cd53e..b2b96853 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -321,25 +321,10 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): logging.debug('Loading: %s %s %s' % (repo_url, ref, filename)) dirname = sb.get_git_directory_name(repo_url) - # Get the right morphology. The right ref might not be - # checked out, in which case we get the file from git. - # However, if it is checked out, we get it from the - # filesystem directly, in case the user has made any - # changes to it. If the entire repo hasn't been checked - # out yet, do that first. - if not os.path.exists(dirname): self._checkout(lrc, sb, repo_url, ref) - m = self._load_morphology_from_file( - loader, dirname, filename) - else: - gd = morphlib.gitdir.GitDirectory(dirname) - if gd.is_currently_checked_out(ref): - m = self._load_morphology_from_file( - loader, dirname, filename) - else: - m = self._load_morphology_from_git( - loader, gd, ref, filename) + + m = self._load_morphology_from_file(loader, dirname, filename) m.repo_url = repo_url m.ref = ref -- cgit v1.2.1