summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py28
-rwxr-xr-xtests.branching/merge.script8
-rw-r--r--tests.branching/merge.stdout5
3 files changed, 25 insertions, 16 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index 2ab18869..a1afd25d 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -575,7 +575,7 @@ class BranchAndMergePlugin(cliapp.Plugin):
'been comitted')
def merge_repo(self, name, from_dir, from_branch, to_dir, to_branch,
- is_morphs_repo = False):
+ commit = False):
'''Merge changes for a system branch in a specific repository'''
if self.get_uncommitted_changes(from_dir) != []:
@@ -583,14 +583,11 @@ class BranchAndMergePlugin(cliapp.Plugin):
'changes', name)
# repo must be made into a URL to avoid ':' in pathnames confusing git
from_url = urlparse.urljoin('file://', from_dir)
- if is_morphs_repo:
- # We use --no-commit in this case, so we can then revert the refs
- # that were changed for the system branch in the merge commit
- self.app.runcmd(['git', 'pull', '--no-commit', '--no-ff', from_url,
- from_branch], cwd=to_dir)
- else:
- self.app.runcmd(['git', 'pull', '--no-ff', from_url, from_branch],
- cwd=to_dir)
+ self.app.runcmd(['git', 'pull', '--no-commit', '--no-ff', from_url,
+ from_branch], cwd=to_dir)
+ if commit:
+ msg = "Merge system branch '%s'" % from_branch
+ self.app.runcmd(['git', 'commit', '-m%s' % msg], cwd=to_dir)
def merge(self, args):
'''Pull and merge changes from a system branch into the current one.'''
@@ -619,8 +616,8 @@ class BranchAndMergePlugin(cliapp.Plugin):
from_repo = self.find_repository(from_branch_dir, ci['repo'])
to_repo = self.make_repository_available(
to_branch, to_branch_dir, ci['repo'], to_branch)
- self.merge_repo(
- ci['repo'], from_repo, from_branch, to_repo, to_branch)
+ self.merge_repo(ci['repo'], from_repo, from_branch,
+ to_repo, to_branch, commit=True)
def _merge_stratum(si):
if si['repo'] == root_repo:
@@ -629,10 +626,9 @@ class BranchAndMergePlugin(cliapp.Plugin):
from_repo = self.find_repository(from_branch_dir, si['repo'])
to_repo = self.make_repository_available(
to_branch, to_branch_dir, si['repo'], to_branch)
- self.merge_repo(
- si['repo'], from_repo, from_branch, to_repo, to_branch,
- is_morphs_repo=True)
# We will do a merge commit in this repo later on
+ self.merge_repo(si['repo'], from_repo, from_branch,
+ to_repo, to_branch, commit=False)
morphs_repo_list.add(to_repo)
stratum = self.load_morphology(to_repo, si['morph'])
@@ -645,8 +641,8 @@ class BranchAndMergePlugin(cliapp.Plugin):
from_root_dir = self.find_repository(from_branch_dir, root_repo)
to_root_dir = self.find_repository(to_branch_dir, root_repo)
self.app.runcmd(['git', 'checkout', to_branch], cwd=to_root_dir)
- self.merge_repo(root_repo, from_root_dir, from_branch, to_root_dir,
- to_branch, is_morphs_repo = True)
+ self.merge_repo(root_repo, from_root_dir, from_branch,
+ to_root_dir, to_branch, commit=False)
morphs_repo_list = set([to_root_dir])
for f in glob.glob(os.path.join(to_root_dir, '*.morph')):
diff --git a/tests.branching/merge.script b/tests.branching/merge.script
index 7c433519..d8a28cb3 100755
--- a/tests.branching/merge.script
+++ b/tests.branching/merge.script
@@ -48,3 +48,11 @@ git status --short # make sure all changes are committed
# Make sure all refs to the merged branch have gone.
cd ../baserock:morphs
! grep "\"ref\": \"baserock/newbranch\"" *.morph
+
+echo "Commit message for baserock:morphs"
+git cat-file commit HEAD | tail -n 1
+
+echo
+echo "Commit message for baserock:hello"
+cd ../baserock:hello
+git cat-file commit HEAD | tail -n 1
diff --git a/tests.branching/merge.stdout b/tests.branching/merge.stdout
new file mode 100644
index 00000000..e5127734
--- /dev/null
+++ b/tests.branching/merge.stdout
@@ -0,0 +1,5 @@
+Commit message for baserock:morphs
+Merge system branch 'baserock/newbranch'
+
+Commit message for baserock:hello
+Merge system branch 'baserock/newbranch'