summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-08-28 14:22:01 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-08-29 15:07:32 +0000
commitb6b219d75ef63ca33a10cb6cd32dd9b1669ecfa8 (patch)
tree6eeb99eed605ef6c9944d2781ce57fed10361f10
parentf3293ecbda184248ea370aa8a419968cb005ba03 (diff)
downloadmorph-b6b219d75ef63ca33a10cb6cd32dd9b1669ecfa8.tar.gz
Revert "Merge branch 'liw/restore-old-cmds'"
This reverts commit 2dc382a2a9ae977b1158002cd2631ec5593959c1, reversing changes made to 89a019af088ff62459699a6efdadf8ac8fe35dd9. We decided to restore the old commands for the release, as we weren't confident the new implementations were correct yet. To gain that confidence we need to use them, so the old versions are no longer available, and the new edit code is used when the edit subcommand is invoked. Doing so also requires the test suite to use the edit command instead of new-edit.
-rw-r--r--morphlib/plugins/branch_and_merge_new_plugin.py2
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py166
-rwxr-xr-xtests.as-root/build-handles-stratum-build-depends.script2
-rwxr-xr-xtests.as-root/build-with-external-strata.script2
-rwxr-xr-xtests.branching/add-then-edit.script4
-rwxr-xr-xtests.branching/edit-checkouts-existing-chunk.script2
-rwxr-xr-xtests.branching/edit-clones-chunk.script2
-rwxr-xr-xtests.branching/edit-handles-submodules.script2
-rwxr-xr-xtests.branching/edit-updates-stratum-build-depends.script2
-rwxr-xr-xtests.branching/edit-updates-stratum.script2
-rwxr-xr-xtests.branching/edit-works-after-branch-root-was-renamed.script2
-rwxr-xr-xtests.branching/petrify.script2
-rwxr-xr-xtests.merging/move-chunk-repo.script4
-rwxr-xr-xtests.merging/rename-stratum.script2
-rw-r--r--yarns/branches-workspaces.yarn2
-rw-r--r--yarns/implementations.yarn4
16 files changed, 21 insertions, 181 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py
index 9dd9c915..e5fe52e6 100644
--- a/morphlib/plugins/branch_and_merge_new_plugin.py
+++ b/morphlib/plugins/branch_and_merge_new_plugin.py
@@ -42,7 +42,7 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin):
self.app.add_subcommand(
'branch', self.branch, arg_synopsis='REPO NEW [OLD]')
self.app.add_subcommand(
- 'new-edit', self.edit, arg_synopsis='SYSTEM STRATUM [CHUNK]')
+ 'edit', self.edit, arg_synopsis='SYSTEM STRATUM [CHUNK]')
self.app.add_subcommand(
'show-system-branch', self.show_system_branch, arg_synopsis='')
self.app.add_subcommand(
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index 53b94859..85e74501 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -57,15 +57,10 @@ class BranchAndMergePlugin(cliapp.Plugin):
def enable(self):
# User-facing commands
- self.app.add_subcommand('old-init', self.init, arg_synopsis='[DIR]')
- self.app.add_subcommand('old-branch', self.branch,
- arg_synopsis='REPO NEW [OLD]')
- self.app.add_subcommand('old-checkout', self.checkout,
- arg_synopsis='REPO BRANCH')
self.app.add_subcommand('merge', self.merge,
arg_synopsis='BRANCH')
- self.app.add_subcommand('edit', self.edit,
- arg_synopsis='SYSTEM STRATUM [CHUNK]')
+# self.app.add_subcommand('edit', self.edit,
+# arg_synopsis='SYSTEM STRATUM [CHUNK]')
self.app.add_subcommand('petrify', self.petrify)
self.app.add_subcommand('unpetrify', self.unpetrify)
self.app.add_subcommand(
@@ -87,15 +82,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
self.app.add_subcommand('foreach', self.foreach,
arg_synopsis='-- COMMAND [ARGS...]')
- # Plumbing commands (FIXME: should be hidden from --help by default)
- self.app.add_subcommand('old-workspace', self.workspace,
- arg_synopsis='')
- self.app.add_subcommand(
- 'old-show-system-branch', self.show_system_branch,
- arg_synopsis='')
- self.app.add_subcommand('old-show-branch-root', self.show_branch_root,
- arg_synopsis='')
-
def disable(self):
pass
@@ -367,7 +353,7 @@ class BranchAndMergePlugin(cliapp.Plugin):
'cluster': [
'name',
'systems',
- ]
+ ],
}
also_known = {
@@ -555,50 +541,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
return system_key, metadata_cache_id_lookup
- def init(self, args):
- '''Initialize a workspace directory.
-
- Command line argument:
-
- * `DIR` is the directory to use as a workspace, and defaults to
- the current directory.
-
- This creates a workspace, either in the current working directory,
- or if `DIR` is given, in that directory. If the directory doesn't
- exist, it is created. If it does exist, it must be empty.
-
- You need to run `morph init` to initialise a workspace, or none
- of the other system branching tools will work: they all assume
- an existing workspace. Note that a workspace only exists on your
- machine, not on the git server.
-
- Example:
-
- morph init /src/workspace
- cd /src/workspace
-
- '''
-
- if not args:
- args = ['.']
- elif len(args) > 1:
- raise cliapp.AppException('init must get at most one argument')
-
- dirname = args[0]
-
- # verify the workspace is empty (and thus, can be used) or
- # create it if it doesn't exist yet
- if os.path.exists(dirname):
- if os.listdir(dirname) != []:
- raise cliapp.AppException('can only initialize empty '
- 'directory as a workspace: %s' %
- dirname)
- else:
- os.makedirs(dirname)
-
- os.mkdir(os.path.join(dirname, '.morph'))
- self.app.status(msg='Initialized morph workspace', chatty=True)
-
def _create_branch(self, workspace, branch_name, repo, original_ref):
'''Create a branch called branch_name based off original_ref.
@@ -638,81 +580,6 @@ class BranchAndMergePlugin(cliapp.Plugin):
self.remove_branch_dir_safe(workspace, branch_name)
raise
- @warns_git_identity
- def branch(self, args):
- '''Create a new system branch.
-
- Command line arguments:
-
- * `REPO` is a repository URL.
- * `NEW` is the name of the new system branch.
- * `OLD` is the point from which to branch, and defaults to `master`.
-
- This creates a new system branch. It needs to be run in an
- existing workspace (see `morph workspace`). It creates a new
- git branch in the clone of the repository in the workspace. The
- system branch will not be visible on the git server until you
- push your changes to the repository.
-
- Example:
-
- cd /src/workspace
- morph branch baserock:baserock:morphs jrandom/new-feature
-
- '''
-
- if len(args) not in [2, 3]:
- raise cliapp.AppException('morph branch needs name of branch '
- 'as parameter')
-
- repo = args[0]
- new_branch = args[1]
- commit = 'master' if len(args) == 2 else args[2]
-
- self.lrc, self.rrc = morphlib.util.new_repo_caches(self.app)
- if self.get_cached_repo(repo).ref_exists(new_branch):
- raise cliapp.AppException('branch %s already exists in '
- 'repository %s' % (new_branch, repo))
-
- # Create the system branch directory.
- workspace = self.deduce_workspace()
- self._create_branch(workspace, new_branch, repo, commit)
-
- @warns_git_identity
- def checkout(self, args):
- '''Check out an existing system branch.
-
- Command line arguments:
-
- * `REPO` is the URL to the repository to the root repository of
- a system branch.
- * `BRANCH` is the name of the system branch.
-
- This will check out an existing system branch to an existing
- workspace. You must create the workspace first. This only checks
- out the root repository, not the repositories for individual
- components. You need to use `morph edit` to check out those.
-
- Example:
-
- cd /src/workspace
- morph checkout baserock:baserock/morphs master
-
- '''
-
- if len(args) != 2:
- raise cliapp.AppException('morph checkout needs a repo and the '
- 'name of a branch as parameters')
-
- repo = args[0]
- system_branch = args[1]
-
- self.lrc, self.rrc = morphlib.util.new_repo_caches(self.app)
-
- # Create the system branch directory.
- workspace = self.deduce_workspace()
- self._create_branch(workspace, system_branch, repo, system_branch)
-
def checkout_repository(self, branch_dir, repo, ref, parent_ref=None):
'''Make a chunk or stratum repository available for a system branch
@@ -2052,30 +1919,3 @@ class BranchAndMergePlugin(cliapp.Plugin):
raise cliapp.AppException(
'Command failed at repo %s: %s' % (repo, ' '.join(args)))
- def workspace(self, args):
- '''Show the toplevel directory of the current workspace.'''
-
- self.app.output.write('%s\n' % self.deduce_workspace())
-
- def show_system_branch(self, args):
- '''Show the name of the current system branch.'''
-
- branch, dirname = self.deduce_system_branch()
- self.app.output.write('%s\n' % branch)
-
- def show_branch_root(self, args):
- '''Show the name of the repository holding the system morphologies.
-
- This would, for example, write out something like:
-
- /src/ws/master/baserock:baserock/morphs
-
- when the master branch of the `baserock:baserock/morphs`
- repository is checked out.
-
- '''
-
- workspace = self.deduce_workspace()
- system_branch, branch_dir = self.deduce_system_branch()
- branch_root = self.get_branch_config(branch_dir, 'branch.root')
- self.app.output.write('%s\n' % branch_root)
diff --git a/tests.as-root/build-handles-stratum-build-depends.script b/tests.as-root/build-handles-stratum-build-depends.script
index fd6a0544..22d07c72 100755
--- a/tests.as-root/build-handles-stratum-build-depends.script
+++ b/tests.as-root/build-handles-stratum-build-depends.script
@@ -39,7 +39,7 @@ cd test/stratum-build-depends/test:morphs
# be updated here. Any build-depends of any altered strata also need to
# be altered, such as the 'tools-stratum' which depends on linux-stratum
# If they are not updated, the build command will fail.
-"$SRCDIR/scripts/test-morph" new-edit linux-system hello-stratum
+"$SRCDIR/scripts/test-morph" edit linux-system hello-stratum
# Likewise, this command must update build-depends or the 'repo' field will
# not be changed in the temporary build branch, leading to:
diff --git a/tests.as-root/build-with-external-strata.script b/tests.as-root/build-with-external-strata.script
index d722f907..f5d86dfe 100755
--- a/tests.as-root/build-with-external-strata.script
+++ b/tests.as-root/build-with-external-strata.script
@@ -34,7 +34,7 @@ cd "$DATADIR/workspace"
# don't commit it, in one of the external strata, as a challenge for
# 'morph build'.
cd "branch1"
-"$SRCDIR/scripts/test-morph" new-edit hello-system stratum2
+"$SRCDIR/scripts/test-morph" edit hello-system stratum2
cd "test:external-strata"
awk '
diff --git a/tests.branching/add-then-edit.script b/tests.branching/add-then-edit.script
index cdb28fd2..d6a2270f 100755
--- a/tests.branching/add-then-edit.script
+++ b/tests.branching/add-then-edit.script
@@ -30,7 +30,7 @@ cd "me/add-then-edit"
cd test:morphs
## Sub-optimally, to alter the stratum, you have to `morph edit` it first
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum
git apply <<'EOF'
diff --git a/hello-stratum.morph b/hello-stratum.morph
@@ -50,7 +50,7 @@ index 3b7be17..c79a9af 100644
name: hello-stratum
EOF
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum goodbye
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye
# check whether the stratum still contains the goodbye chunk
grep -qFe goodbye hello-stratum.morph
diff --git a/tests.branching/edit-checkouts-existing-chunk.script b/tests.branching/edit-checkouts-existing-chunk.script
index 9584d1a3..9e66ceb0 100755
--- a/tests.branching/edit-checkouts-existing-chunk.script
+++ b/tests.branching/edit-checkouts-existing-chunk.script
@@ -27,7 +27,7 @@ cd "$DATADIR/workspace"
# Edit the hello chunk in alfred.
cd "alfred"
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
echo "Current branches:"
"$SRCDIR/scripts/test-morph" foreach git branch
diff --git a/tests.branching/edit-clones-chunk.script b/tests.branching/edit-clones-chunk.script
index ecc2c55e..d3324078 100755
--- a/tests.branching/edit-clones-chunk.script
+++ b/tests.branching/edit-clones-chunk.script
@@ -26,7 +26,7 @@ cd "$DATADIR/workspace"
"$SRCDIR/scripts/test-morph" branch test:morphs newbranch
# Edit chunk.
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
echo "Current branches:"
"$SRCDIR/scripts/test-morph" foreach git branch
diff --git a/tests.branching/edit-handles-submodules.script b/tests.branching/edit-handles-submodules.script
index 389784ed..72344119 100755
--- a/tests.branching/edit-handles-submodules.script
+++ b/tests.branching/edit-handles-submodules.script
@@ -26,7 +26,7 @@ cd "$DATADIR/workspace"
"$SRCDIR/scripts/test-morph" branch test:morphs newbranch
# Submodules should be set up automatically
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
cd "$DATADIR/workspace/newbranch/test:hello"
[ -e foolib/README ]
diff --git a/tests.branching/edit-updates-stratum-build-depends.script b/tests.branching/edit-updates-stratum-build-depends.script
index ed11b584..a108ce8a 100755
--- a/tests.branching/edit-updates-stratum-build-depends.script
+++ b/tests.branching/edit-updates-stratum-build-depends.script
@@ -63,7 +63,7 @@ cd "$DATADIR/workspace"
"$SRCDIR/scripts/test-morph" branch test:morphs newbranch
# Edit chunk.
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
# See what effect the editing had.
"$SRCDIR/scripts/run-git-in" "newbranch/test:morphs" diff
diff --git a/tests.branching/edit-updates-stratum.script b/tests.branching/edit-updates-stratum.script
index 84974765..bfe16c8b 100755
--- a/tests.branching/edit-updates-stratum.script
+++ b/tests.branching/edit-updates-stratum.script
@@ -26,7 +26,7 @@ cd "$DATADIR/workspace"
"$SRCDIR/scripts/test-morph" branch test:morphs newbranch
# Edit chunk.
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
# See what effect the editing had.
"$SRCDIR/scripts/run-git-in" "newbranch/test:morphs" diff
diff --git a/tests.branching/edit-works-after-branch-root-was-renamed.script b/tests.branching/edit-works-after-branch-root-was-renamed.script
index 9591b587..c7043e27 100755
--- a/tests.branching/edit-works-after-branch-root-was-renamed.script
+++ b/tests.branching/edit-works-after-branch-root-was-renamed.script
@@ -35,7 +35,7 @@ cd "$DATADIR/workspace"
cd "$DATADIR/workspace/master"
mv test:morphs my-renamed-morphs
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
"$SRCDIR/scripts/list-tree" "$DATADIR/workspace" | grep -v '/\.git/' |
sed 's,/cache/gits/file_[^/]*_,/cache/gits/file_,' |
diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script
index 9a276d71..fed8e965 100755
--- a/tests.branching/petrify.script
+++ b/tests.branching/petrify.script
@@ -29,7 +29,7 @@ cd "$DATADIR/workspace"
cd test/petrify/test:morphs
git push --quiet origin HEAD
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum goodbye
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye
(cd ../test:goodbye && git push --quiet origin HEAD)
"$SRCDIR/scripts/test-morph" petrify
diff --git a/tests.merging/move-chunk-repo.script b/tests.merging/move-chunk-repo.script
index 40f3cc4a..3a00015b 100755
--- a/tests.merging/move-chunk-repo.script
+++ b/tests.merging/move-chunk-repo.script
@@ -26,7 +26,7 @@ cd "$DATADIR/workspace"
"$SRCDIR/scripts/test-morph" init
"$SRCDIR/scripts/test-morph" branch test:morphs baserock/newbranch
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
# Chunk moves to a new location (we manually update the ref back to master
# here, so 'morph edit' can create a system branch in the new repo from it).
@@ -38,7 +38,7 @@ sed -e 's/"repo": "test:hello"/"repo": "test:hello-lorried"/' \
git commit -q --all -m "'hello' repository has moved"
# Now we further edit the chunk, just for fun.
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum hello
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello
cd "$DATADIR/workspace/baserock/newbranch/test:hello-lorried"
touch newfile.txt
git add newfile.txt
diff --git a/tests.merging/rename-stratum.script b/tests.merging/rename-stratum.script
index 5fa13130..ba759fa3 100755
--- a/tests.merging/rename-stratum.script
+++ b/tests.merging/rename-stratum.script
@@ -31,7 +31,7 @@ cd "$DATADIR/workspace"
# associate hello-stratum and goodbye-stratum at all.
# Rename the stratum
-"$SRCDIR/scripts/test-morph" new-edit hello-system hello-stratum
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum
cd baserock/newbranch/test:morphs
sed -e 's/"morph": "hello-stratum"/"morph": "goodbye-stratum"/'\
diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn
index 7c8715a7..3af362a1 100644
--- a/yarns/branches-workspaces.yarn
+++ b/yarns/branches-workspaces.yarn
@@ -90,7 +90,7 @@ to check for that locally.
Similarly, attempting to branch a system branch should fail if the
repository does not contain any system morphologies.
- SCENARIO branching a system branch with no systems
+ SCENARIO checking out a system branch with no systems
GIVEN a workspace
AND a git server
WHEN morph attempts to branch a repository with no systems
diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn
index cc3ef3e5..cfb744f7 100644
--- a/yarns/implementations.yarn
+++ b/yarns/implementations.yarn
@@ -226,11 +226,11 @@ Editing morphologies with `morph edit`.
IMPLEMENTS WHEN editing stratum (\S+) in system (\S+) in branch (\S+)
cd "$DATADIR/workspace/$MATCH_3/test:morphs"
- run_morph new-edit "$MATCH_2" "$MATCH_1"
+ run_morph edit "$MATCH_2" "$MATCH_1"
IMPLEMENTS WHEN editing chunk (\S+) in (\S+) in (\S+) in branch (\S+)
cd "$DATADIR/workspace/$MATCH_4/test:morphs"
- run_morph new-edit "$MATCH_3" "$MATCH_2" "$MATCH_1"
+ run_morph edit "$MATCH_3" "$MATCH_2" "$MATCH_1"
IMPLEMENTS THEN edited chunk (\S+) has git branch (\S+)
ls -l "$DATADIR/workspace/$MATCH_2"