diff options
-rwxr-xr-x | morph | 10 | ||||
-rw-r--r-- | tests.branching/branch-when-branchdir-exists-locally.exit | 1 | ||||
-rwxr-xr-x | tests.branching/branch-when-branchdir-exists-locally.script | 27 | ||||
-rw-r--r-- | tests.branching/branch-when-branchdir-exists-locally.stderr | 1 |
4 files changed, 39 insertions, 0 deletions
@@ -390,6 +390,16 @@ class Morph(cliapp.Application): raise cliapp.AppException("Can't find the mine directory") + def cmd_branch(self, args): + '''Branch the whole system.''' + + if len(args) != 1: + raise cliapp.AppException('morph branch needs name of branch ' + 'as parameter') + + branch = args[0] + os.makedirs(branch) + def msg(self, msg): '''Show a message to the user about what is going on.''' logging.debug(msg) diff --git a/tests.branching/branch-when-branchdir-exists-locally.exit b/tests.branching/branch-when-branchdir-exists-locally.exit new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests.branching/branch-when-branchdir-exists-locally.exit @@ -0,0 +1 @@ +1 diff --git a/tests.branching/branch-when-branchdir-exists-locally.script b/tests.branching/branch-when-branchdir-exists-locally.script new file mode 100755 index 00000000..4692b5f6 --- /dev/null +++ b/tests.branching/branch-when-branchdir-exists-locally.script @@ -0,0 +1,27 @@ +#!/bin/sh +# Copyright (C) 2012 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Make sure "morph branch" fails when the system branch directory already +# exists. + +set -eu + +cd "$DATADIR/mine" +"$SRCDIR/scripts/test-morph" init + +mkdir newbranch +"$SRCDIR/scripts/test-morph" branch newbranch + diff --git a/tests.branching/branch-when-branchdir-exists-locally.stderr b/tests.branching/branch-when-branchdir-exists-locally.stderr new file mode 100644 index 00000000..6c56c250 --- /dev/null +++ b/tests.branching/branch-when-branchdir-exists-locally.stderr @@ -0,0 +1 @@ +ERROR: newbranch: File exists |