summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-11-01 14:42:43 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2013-11-01 14:42:43 +0000
commit0b6516bb591dd51c14993f6e60b0da3197a32054 (patch)
tree30810cdc3a37e9012bfe19d8498e764887f876c7
parent6d69eb0295f7d51399d8f341444bfcf90f6b0bb5 (diff)
parent8504f029bd2dffd1550b16c50d293aa58290d333 (diff)
downloadmorph-0b6516bb591dd51c14993f6e60b0da3197a32054.tar.gz
Merge remote-tracking branch 'origin/pedroalvarez/S9428'
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py3
-rw-r--r--yarns/branches-workspaces.yarn22
-rw-r--r--yarns/implementations.yarn6
-rw-r--r--yarns/regression.yarn20
4 files changed, 39 insertions, 12 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index 9a0ee484..dba529d9 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -134,6 +134,9 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
gd.update_submodules(self.app)
gd.update_remotes()
+ except morphlib.sysbranchdir.SystemBranchDirectoryAlreadyExists as e:
+ logging.error('Caught exception: %s' % str(e))
+ raise
except BaseException as e:
# Oops. Clean up.
logging.error('Caught exception: %s' % str(e))
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index cd3f7a0e..b90c054c 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -72,7 +72,7 @@ We can, instead, create a new system branch, off master.
SCENARIO branch off master
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
THEN the system branch foo is checked out
We can also branch off another system branch. However, we need to first
@@ -82,7 +82,7 @@ to check for that locally.
SCENARIO branch off non-master
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
AND pushing system branch foo to git server
AND creating system branch bar, based on foo
THEN the system branch bar is checked out
@@ -147,7 +147,7 @@ current directory, things should fail.
GIVEN a workspace
AND a git server
WHEN checking out the master system branch
- AND creating system branch foo
+ AND user creates system branch foo
AND attempting to report system branch in .
THEN morph failed
@@ -186,7 +186,7 @@ all the refs are unchanged.
SCENARIO morph branch does not edit refs
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
THEN in branch foo, system test-system refs test-stratum in master
AND in branch foo, stratum test-stratum refs test-chunk in master
@@ -214,7 +214,7 @@ repositories referenced in the system branch.
SCENARIO morph status reports changes correctly
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
THEN morph reports no outstanding changes in foo
WHEN editing stratum test-stratum in system test-system in branch foo
@@ -244,7 +244,7 @@ branch checkout.
SCENARIO morph foreach runs command in each git repo
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
AND editing chunk test-chunk in test-stratum in test-system in branch foo
AND running shell command in each repo in foo
THEN morph ran command in test:morphs in foo
@@ -261,7 +261,7 @@ unpetrify and verify that we have all the same refs as before.
SCENARIO morph petrifies and unpetrifies
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
AND pushing system branch foo to git server
AND remembering all refs in foo
AND petrifying foo
@@ -279,7 +279,7 @@ system branch itself, only the tag.
SCENARIO morph tags a system branch
GIVEN a workspace
AND a git server
- WHEN creating system branch foo
+ WHEN user creates system branch foo
AND tagging system branch foo as test123
THEN morph tag test123 in foo is an annotated git tag
AND morph tag test123 in foo refers to a petrified commit
@@ -314,7 +314,7 @@ wouldn't need to worry about changing the system branch ref.
GIVEN a workspace
AND a git server
AND null refs for local strata
- WHEN creating system branch foo
+ WHEN user creates system branch foo
THEN the system branch foo is checked out
When we edit a morphology with null refs, they stay null.
@@ -326,7 +326,7 @@ When we edit a morphology with null refs, they stay null.
When creating the branch, the refs remain null.
- WHEN creating system branch foo
+ WHEN user creates system branch foo
THEN in branch foo, system test-system refs test-stratum in None
After editing the stratum they remain null.
@@ -347,7 +347,7 @@ Petrifying also leaves null refs unmolested
GIVEN a workspace
AND a git server
AND null refs for local strata
- WHEN creating system branch foo
+ WHEN user creates system branch foo
AND pushing system branch foo to git server
AND remembering all refs in foo
AND petrifying foo
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index 22120130..985ab2bc 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -183,10 +183,14 @@ We also need to verify that a system branch has been checked out.
We can create a new branch, off master.
- IMPLEMENTS WHEN creating system branch (\S+)
+ IMPLEMENTS WHEN user creates system branch (\S+)
cd "$DATADIR/workspace"
run_morph branch test:morphs "$MATCH_1"
+ IMPLEMENTS WHEN user attempts to create system branch (\S+)
+ cd "$DATADIR/workspace"
+ attempt_morph branch test:morphs "$MATCH_1"
+
We can create a new branch, off another system branch.
IMPLEMENTS WHEN creating system branch (\S+), based on (\S+)
diff --git a/yarns/regression.yarn b/yarns/regression.yarn
index d1cc8e79..7480655d 100644
--- a/yarns/regression.yarn
+++ b/yarns/regression.yarn
@@ -12,3 +12,23 @@ Testing if we can build after checking out from a tag.
WHEN checking out the test-tag system tag
THEN morph build the system simple-system of the tag test-tag of the repo test:morphs
+
+Running `morph branch` when the branch directory exists doesn't
+remove the existing directory.
+
+ SCENARIO re-running 'morph branch' fails, original branch untouched
+ GIVEN a workspace
+ AND a git server
+ WHEN user creates system branch foo
+ THEN the system branch foo is checked out
+
+The branch is checked out correctly, now it should fail if the user executes
+`morph branch` with the same branch name.
+
+ WHEN user attempts to create system branch foo
+ THEN morph failed
+ AND the branch error message includes the string "File exists"
+
+The branch still checked out.
+
+ AND the system branch foo is checked out