diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-09-12 15:26:24 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2012-09-14 19:44:40 +0100 |
commit | d3d278b6bdade8141836bcd35a47d7476ae49ecc (patch) | |
tree | 863c42953471c8f9083b67d177bb5d833c01b290 /morphlib/plugins | |
parent | 91661d646c39199483c7784949faead5337533c8 (diff) | |
download | morph-d3d278b6bdade8141836bcd35a47d7476ae49ecc.tar.gz |
morph merge: Only update refs that were pointing at the 'from' branch
This fixes a major bug which would update all sorts of refs that should
not have been updated. Also avoids rewriting morphs that haven't
changed at all.
Diffstat (limited to 'morphlib/plugins')
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index e4f6f91a..d05d7929 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -644,11 +644,14 @@ class BranchAndMergePlugin(cliapp.Plugin): morphs_repo_list.add(to_repo) stratum = self.load_morphology(to_repo, si['morph']) + changed = False for ci in stratum['chunks']: if ci['ref'] == from_branch: _merge_chunk(ci) ci['ref'] = to_branch - self.save_morphology(to_repo, si['morph'], stratum) + changed = True + if changed: + self.save_morphology(to_repo, si['morph'], stratum) from_root_dir = self.find_repository(from_branch_dir, root_repo) to_root_dir = self.find_repository(to_branch_dir, root_repo) @@ -662,11 +665,14 @@ class BranchAndMergePlugin(cliapp.Plugin): morphology = self.load_morphology(to_root_dir, name) if morphology['kind'] == 'system': + changed = False for si in morphology['strata']: if si['ref'] == from_branch: _merge_stratum(si) - si['ref'] = to_branch - self.save_morphology(to_root_dir, name, morphology) + si['ref'] = to_branch + changed = True + if changed: + self.save_morphology(to_root_dir, name, morphology) for repo in morphs_repo_list: msg = "Merge system branch '%s'" % from_branch |