summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2013-11-11 16:35:16 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2013-11-12 14:14:53 +0000
commit2cf5f0691241fa0e771cd7e7a8999961dc7250e8 (patch)
treebaab911a37f1787a4fbaced885f8e8c7cd27aa16
parentc619991ffef6d98d20857953ec93292c69722eb9 (diff)
downloadmorph-richardipsum/s9532/fix_morph_edit_behaviour.tar.gz
Use contents of working tree, regardless of which ref is checked outrichardipsum/s9532/fix_morph_edit_behaviour
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
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py19
1 files 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