diff options
24 files changed, 88 insertions, 84 deletions
diff --git a/doc/branching-merging-systems.mdwn b/doc/branching-merging-systems.mdwn index 3daee73b..c2e24d77 100644 --- a/doc/branching-merging-systems.mdwn +++ b/doc/branching-merging-systems.mdwn @@ -57,15 +57,15 @@ we introduce the following concepts (FIXME: naming needs attention): a system branch; it need not contain all the repositories, just the ones that are being worked on by the user, or that the user for other reasons have checked out -* **morph mine** is where all Morph keeps global +* **morph workspace** is where all Morph keeps global state and shared caches, so that creating a system branch directory is a fairly cheap operation; all the system branch directories are - inside the morph mine directory + inside the morph workspace directory As a picture: /home/liw/ -- user's home directory - baserock/ -- morph mine + baserock/ -- morph workspace .morph/ -- morph shared state, cache, etc unstable/ -- system branch directory: mainline devel morphs/ -- git repository for system, stratum morphs @@ -76,13 +76,13 @@ As a picture: To use the system branching and merging, you do the following (which we'll cover in more detail later): -1. Initialize the morph mine. This creates the `.morph` directory and - populates it with some initial stuff. You can have as many mines as +1. Initialize the morph workspace. This creates the `.morph` directory and + populates it with some initial stuff. You can have as many workspaces as you want, but you don't have to have more than one, and you only need to initialize it once. 2. Branch the system from some version of it (e.g., `master`) to work on a new feature or bug fix. - This creates a system branch directory under the mine directory. + This creates a system branch directory under the workspace directory. The system branch directory initially contains a clone of the `morphs` git repository, with some changes specific to this system branch. (See petrification, below.) @@ -105,7 +105,7 @@ still fairly high level, and implementation details will come later. morph init ~/baserock This creates the `~/baserock` directory if it does not exist, and then -initializes it as a "morph mine" directory, by creating a `.morph` +initializes it as a "morph workspace" directory, by creating a `.morph` subdirectory. `.morph` will contain the Morph cache directory, and other shared state between the various branches. As part of the cache, any git repositories that Morph clones get put into the cache first, @@ -197,7 +197,7 @@ Usage: morph branch BRANCH [COMMIT] -This needs to be run in the morph mine directory (the one initialized +This needs to be run in the morph workspace directory (the one initialized with `morph init`). * If `./BRANCH` as a directory exists, abort. @@ -206,7 +206,7 @@ with `morph init`). * Create a new branch called `BRANCH` in morphs, based either the tip of `master` or from `COMMIT` if given. Store the SHA-1 of the branch origin in some way so we get at it later. - + Implementation: `morph checkout` -------------- @@ -215,7 +215,7 @@ Usage: morph checkout BRANCH -This needs to be run in the morph mine directory. It works like +This needs to be run in the morph workspace directory. It works like `morph branch`, except it does not create the new branch and requires it to exist instead. @@ -289,8 +289,8 @@ Usage: morph git -- log -p master..HEAD -This is to be run in the morph mine. It runs git with the arguments on -the command line in each local git repository in the mine. (The `--` is +This is to be run in the morph workspace. It runs git with the arguments on +the command line in each local git repository in the workspace. (The `--` is only necessary if the git arguments are to contain options.) @@ -303,7 +303,7 @@ Usage: This needs to be run inside a system branch directory's `morphs` repository, and `BRANCH` must be another system branch checked out -in the morph mine. +in the morph workspace. * In each git repository modified by the `BRANCH` system branch, run `git merge --no-commit BRANCH`, then undo any changes to @@ -318,7 +318,7 @@ Usage: morph mass-merge BRANCH [TARGET]... -To be run in the morph mine directory. +To be run in the morph workspace directory. This just runs `morph merge BRANCH` in each `TARGET` system branch. diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index 670b3117..2304fc0f 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -32,7 +32,8 @@ class BranchAndMergePlugin(cliapp.Plugin): self.app.add_subcommand('petrify', self.petrify, arg_synopsis='STRATUM...') self.app.add_subcommand('init', self.init, arg_synopsis='[DIR]') - self.app.add_subcommand('minedir', self.minedir, arg_synopsis='') + self.app.add_subcommand('workspace', self.workspace, + arg_synopsis='') self.app.add_subcommand('branch', self.branch, arg_synopsis='NEW [OLD]') self.app.add_subcommand('checkout', self.checkout, @@ -48,7 +49,7 @@ class BranchAndMergePlugin(cliapp.Plugin): pass @staticmethod - def deduce_mine_directory(): + def deduce_workspace(): dirname = os.getcwd() while dirname != '/': dot_morph = os.path.join(dirname, '.morph') @@ -59,18 +60,18 @@ class BranchAndMergePlugin(cliapp.Plugin): @classmethod def deduce_system_branch(cls): - minedir = cls.deduce_mine_directory() - if minedir is None: + workspace = cls.deduce_workspace() + if workspace is None: return None - if not minedir.endswith('/'): - minedir += '/' + if not workspace.endswith('/'): + workspace += '/' cwd = os.getcwd() - if not cwd.startswith(minedir): + if not cwd.startswith(workspace): return None - return os.path.dirname(cwd[len(minedir):]) + return os.path.dirname(cwd[len(workspace):]) @staticmethod def clone_to_directory(app, dirname, reponame, ref): @@ -181,7 +182,7 @@ class BranchAndMergePlugin(cliapp.Plugin): self.write_morphology(filename, morph) def init(self, args): - '''Initialize a mine.''' + '''Initialize a workspace directory.''' if not args: args = ['.'] @@ -190,28 +191,29 @@ class BranchAndMergePlugin(cliapp.Plugin): dirname = args[0] - # verify the mine directory is empty (and thus, can be used) or + # 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: %s' % dirname) + 'directory as a workspace: %s' % + dirname) else: try: os.makedirs(dirname) except: - raise cliapp.AppException('failed to create mine ' - 'directory: %s' % dirname) + raise cliapp.AppException('failed to create workspace: %s' % + dirname) os.mkdir(os.path.join(dirname, '.morph')) - self.app.status(msg='Initialized morph mine', chatty=True) + self.app.status(msg='Initialized morph workspace', chatty=True) - def minedir(self, args): - '''Find morph mine directory from current working directory.''' + def workspace(self, args): + '''Find morph workspace directory from current working directory.''' - dirname = self.deduce_mine_directory() + dirname = self.deduce_workspace() if dirname is None: - raise cliapp.AppException("Can't find the mine directory") + raise cliapp.AppException("Can't find the workspace directory") self.app.output.write('%s\n' % dirname) def branch(self, args): @@ -274,14 +276,14 @@ class BranchAndMergePlugin(cliapp.Plugin): app = self.app other_branch = args[0] - mine = self.deduce_mine_directory() + workspace = self.deduce_workspace() this_branch = self.deduce_system_branch() for repo in args[1:]: repo = self.resolve_reponame(app, repo) basename = os.path.basename(repo) - pull_from = os.path.join(mine, other_branch, basename) - repo_dir = os.path.join(mine, this_branch, basename) + pull_from = os.path.join(workspace, other_branch, basename) + repo_dir = os.path.join(workspace, this_branch, basename) app.runcmd(['git', 'pull', pull_from, other_branch], cwd=repo_dir) def edit(self, args): @@ -292,12 +294,12 @@ class BranchAndMergePlugin(cliapp.Plugin): 'and commit ref as argument') app = self.app - mine_directory = self.deduce_mine_directory() + workspace = self.deduce_workspace() system_branch = self.deduce_system_branch() if system_branch is None: raise morphlib.Error('Cannot deduce system branch') - morphs_dirname = os.path.join(mine_directory, system_branch, 'morphs') + morphs_dirname = os.path.join(workspace, system_branch, 'morphs') if morphs_dirname is None: raise morphlib.Error('Can not find morphs directory') @@ -310,7 +312,7 @@ class BranchAndMergePlugin(cliapp.Plugin): if ref is None: raise morphlib.Error('Cannot deduce commit to start edit from') - new_repo = os.path.join(mine_directory, system_branch, + new_repo = os.path.join(workspace, system_branch, os.path.basename(repo)) self.clone_to_directory(app, new_repo, args[0], ref) diff --git a/tests.branching/branch-creates-new-system-branch-not-from-master.script b/tests.branching/branch-creates-new-system-branch-not-from-master.script index 9ab44809..1116ae76 100755 --- a/tests.branching/branch-creates-new-system-branch-not-from-master.script +++ b/tests.branching/branch-creates-new-system-branch-not-from-master.script @@ -18,7 +18,7 @@ set -eu -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch origin/alfred @@ -32,4 +32,4 @@ echo "Current branches:" echo "Current origin:" "$SRCDIR/scripts/run-git-in" newbranch/morphs remote show origin | - sed 's,\(TMP/mine/\.morph/cache/gits/file_\).*_,\1,g' + sed 's,\(TMP/workspace/\.morph/cache/gits/file_\).*_,\1,g' diff --git a/tests.branching/branch-creates-new-system-branch.script b/tests.branching/branch-creates-new-system-branch.script index 61e9daf4..9f3b3b4f 100755 --- a/tests.branching/branch-creates-new-system-branch.script +++ b/tests.branching/branch-creates-new-system-branch.script @@ -18,7 +18,7 @@ set -eu -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch @@ -32,4 +32,4 @@ echo "Current branches:" echo "Current origin:" "$SRCDIR/scripts/run-git-in" newbranch/morphs remote show origin | - sed 's,\(TMP/mine/\.morph/cache/gits/file_\).*_,\1,g' + sed 's,\(TMP/workspace/\.morph/cache/gits/file_\).*_,\1,g' diff --git a/tests.branching/branch-when-branchdir-exists-locally.script b/tests.branching/branch-when-branchdir-exists-locally.script index 4692b5f6..27d32062 100755 --- a/tests.branching/branch-when-branchdir-exists-locally.script +++ b/tests.branching/branch-when-branchdir-exists-locally.script @@ -19,7 +19,7 @@ set -eu -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init mkdir newbranch diff --git a/tests.branching/checkout-existing-branch.script b/tests.branching/checkout-existing-branch.script index 74941e18..54697a1d 100755 --- a/tests.branching/checkout-existing-branch.script +++ b/tests.branching/checkout-existing-branch.script @@ -21,7 +21,7 @@ set -eu -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" checkout master diff --git a/tests.branching/edit-checkouts-existing-chunk.script b/tests.branching/edit-checkouts-existing-chunk.script index 4e88ec7c..a3a8d01e 100755 --- a/tests.branching/edit-checkouts-existing-chunk.script +++ b/tests.branching/edit-checkouts-existing-chunk.script @@ -21,7 +21,7 @@ set -eu # Checkout the master system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" checkout alfred @@ -30,10 +30,10 @@ cd alfred/morphs "$SRCDIR/scripts/test-morph" edit baserock:hello alfred echo "Current branches, morphs:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/mine/alfred/morphs" branch +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/alfred/morphs" branch echo "Current branches, hello:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/mine/alfred/hello" branch +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/alfred/hello" branch echo "Files in hello:" -ls "$DATADIR/mine/alfred/hello" +ls "$DATADIR/workspace/alfred/hello" diff --git a/tests.branching/edit-clones-chunk.script b/tests.branching/edit-clones-chunk.script index 8b87b4d2..38f2cd75 100755 --- a/tests.branching/edit-clones-chunk.script +++ b/tests.branching/edit-clones-chunk.script @@ -21,7 +21,7 @@ set -eu # Create system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch @@ -30,15 +30,17 @@ cd newbranch/morphs "$SRCDIR/scripts/test-morph" edit baserock:hello master echo "Current branches, morphs:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/mine/newbranch/morphs" branch +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/newbranch/morphs" branch echo "Current origin, morphs:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/mine/newbranch/morphs" \ - remote show origin | sed 's,\(TMP/mine/\.morph/cache/gits/file_\).*_,\1,g' +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/newbranch/morphs" \ + remote show origin | \ + sed 's,\(TMP/workspace/\.morph/cache/gits/file_\).*_,\1,g' echo "Current branches, hello:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/mine/newbranch/hello" branch +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/newbranch/hello" branch echo "Current origin, hello:" -"$SRCDIR/scripts/run-git-in" "$DATADIR/mine/newbranch/hello" \ - remote show origin | sed 's,\(TMP/mine/\.morph/cache/gits/file_\).*_,\1,g' +"$SRCDIR/scripts/run-git-in" "$DATADIR/workspace/newbranch/hello" \ + remote show origin | \ + sed 's,\(TMP/workspace/\.morph/cache/gits/file_\).*_,\1,g' diff --git a/tests.branching/edit-updates-stratum.script b/tests.branching/edit-updates-stratum.script index a3e213e5..4a2f6a10 100755 --- a/tests.branching/edit-updates-stratum.script +++ b/tests.branching/edit-updates-stratum.script @@ -21,7 +21,7 @@ set -eu # Create system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch diff --git a/tests.branching/edit-uses-ref-from-stratum.script b/tests.branching/edit-uses-ref-from-stratum.script index 74c26d5a..8b952b02 100755 --- a/tests.branching/edit-uses-ref-from-stratum.script +++ b/tests.branching/edit-uses-ref-from-stratum.script @@ -21,7 +21,7 @@ set -eu # Create system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch diff --git a/tests.branching/init-cwd.script b/tests.branching/init-cwd.script index 91c23506..61a62b1d 100755 --- a/tests.branching/init-cwd.script +++ b/tests.branching/init-cwd.script @@ -19,7 +19,7 @@ set -eu # Test that "morph init" works for the current working directory. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init . -"$SRCDIR/scripts/list-tree" "$DATADIR/mine" +"$SRCDIR/scripts/list-tree" "$DATADIR/workspace" diff --git a/tests.branching/init-default.script b/tests.branching/init-default.script index 5ec5148d..f6abf7d0 100755 --- a/tests.branching/init-default.script +++ b/tests.branching/init-default.script @@ -19,6 +19,6 @@ set -eu # Test that "morph init" works without an explicit argument. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/list-tree" "$DATADIR/mine" +"$SRCDIR/scripts/list-tree" "$DATADIR/workspace" diff --git a/tests.branching/init-existing.script b/tests.branching/init-existing.script index 59b658aa..b4031082 100755 --- a/tests.branching/init-existing.script +++ b/tests.branching/init-existing.script @@ -20,5 +20,5 @@ set -eu # Test that "morph init" works when given the name of an existing, # empty directory. -"$SRCDIR/scripts/test-morph" init "$DATADIR/mine" -"$SRCDIR/scripts/list-tree" "$DATADIR/mine" +"$SRCDIR/scripts/test-morph" init "$DATADIR/workspace" +"$SRCDIR/scripts/list-tree" "$DATADIR/workspace" diff --git a/tests.branching/init-nonempty.script b/tests.branching/init-nonempty.script index 28762d08..3bcb8e88 100755 --- a/tests.branching/init-nonempty.script +++ b/tests.branching/init-nonempty.script @@ -20,5 +20,5 @@ set -eu # Test that "morph init" fails when given the name of an existing, # non-empty directory. -touch "$DATADIR/mine/foo" -"$SRCDIR/scripts/test-morph" init "$DATADIR/mine" +touch "$DATADIR/workspace/foo" +"$SRCDIR/scripts/test-morph" init "$DATADIR/workspace" diff --git a/tests.branching/init-nonempty.stderr b/tests.branching/init-nonempty.stderr index 4ed4bba8..bc0ef0e1 100644 --- a/tests.branching/init-nonempty.stderr +++ b/tests.branching/init-nonempty.stderr @@ -1 +1 @@ -ERROR: can only initialize empty directory: TMP/mine +ERROR: can only initialize empty directory as a workspace: TMP/workspace diff --git a/tests.branching/merge-explicitly-named-repos.script b/tests.branching/merge-explicitly-named-repos.script index 48705f8a..a8509045 100755 --- a/tests.branching/merge-explicitly-named-repos.script +++ b/tests.branching/merge-explicitly-named-repos.script @@ -22,7 +22,7 @@ set -eu # Create system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch @@ -35,7 +35,7 @@ git add newfile.txt git commit -m foo --quiet # Merge changes to a new system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch otherbranch cd otherbranch/morphs "$SRCDIR/scripts/test-morph" edit baserock:hello master diff --git a/tests.branching/minedir-not-found.script b/tests.branching/minedir-not-found.script index eb8c9d51..66e3336e 100755 --- a/tests.branching/minedir-not-found.script +++ b/tests.branching/minedir-not-found.script @@ -14,6 +14,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -scripts/test-morph init "$DATADIR/mine" +scripts/test-morph init "$DATADIR/workspace" cd "$DATADIR" -"$SRCDIR/scripts/test-morph" minedir +"$SRCDIR/scripts/test-morph" workspace diff --git a/tests.branching/minedir-not-found.stderr b/tests.branching/minedir-not-found.stderr index 46dbd84b..ea9fb165 100644 --- a/tests.branching/minedir-not-found.stderr +++ b/tests.branching/minedir-not-found.stderr @@ -1 +1 @@ -ERROR: Can't find the mine directory +ERROR: Can't find the workspace directory diff --git a/tests.branching/minedir.script b/tests.branching/minedir.script index 5f3574b7..88a7b5ef 100755 --- a/tests.branching/minedir.script +++ b/tests.branching/minedir.script @@ -14,7 +14,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -scripts/test-morph init "$DATADIR/mine" -mkdir -p "$DATADIR/mine/a/b/c" -cd "$DATADIR/mine/a/b/c" -"$SRCDIR/scripts/test-morph" minedir +scripts/test-morph init "$DATADIR/workspace" +mkdir -p "$DATADIR/workspace/a/b/c" +cd "$DATADIR/workspace/a/b/c" +"$SRCDIR/scripts/test-morph" workspace diff --git a/tests.branching/minedir.stdout b/tests.branching/minedir.stdout index 0fc25ee9..14c44f7d 100644 --- a/tests.branching/minedir.stdout +++ b/tests.branching/minedir.stdout @@ -1 +1 @@ -TMP/mine +TMP/workspace diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script index 303d7f72..02d5f1d8 100755 --- a/tests.branching/petrify.script +++ b/tests.branching/petrify.script @@ -21,7 +21,7 @@ set -eu -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" update-gits baserock:morphs master \ hello-stratum.morph diff --git a/tests.branching/setup b/tests.branching/setup index 84d1d545..1705c9b4 100755 --- a/tests.branching/setup +++ b/tests.branching/setup @@ -18,7 +18,7 @@ # Set up $DATADIR. # # - a morph.conf configuration file -# - an empty morph mine directory +# - an empty morph workspace directory # - a git repository called "morphs" for fake system, stratum morphologies # - a git repository calle "hello" for a dummy chunk @@ -41,7 +41,7 @@ GIT_COMMITTER_DATE="1343753514 +0000" cat <<EOF > "$DATADIR/morph.conf" [config] repo-alias = baserock=file://$DATADIR/%s#file://$DATADIR/%s -cachedir = $DATADIR/mine/.morph/cache +cachedir = $DATADIR/workspace/.morph/cache log = $DATADIR/morph.log keep-path = true no-distcc = true @@ -49,8 +49,8 @@ quiet = true EOF -# Create an empty directory to be used as a morph mine -mkdir "$DATADIR/mine" +# Create an empty directory to be used as a morph workspace +mkdir "$DATADIR/workspace" # Create a fake morphs repository diff --git a/tests.branching/show-system-branch-shows-name-correctly.script b/tests.branching/show-system-branch-shows-name-correctly.script index 38b2aa14..9bbbc27c 100755 --- a/tests.branching/show-system-branch-shows-name-correctly.script +++ b/tests.branching/show-system-branch-shows-name-correctly.script @@ -22,7 +22,7 @@ set -eu # Create system branch. -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch newbranch diff --git a/tests.branching/workflow.script b/tests.branching/workflow.script index 6a365d8e..0c4f8578 100755 --- a/tests.branching/workflow.script +++ b/tests.branching/workflow.script @@ -21,7 +21,7 @@ set -eu -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch me/readme-fix cd me/readme-fix/morphs @@ -31,7 +31,7 @@ echo > README yoyoyo git add README git commit -m "Fix README, yo!" --quiet -cd "$DATADIR/mine" +cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" checkout master cd master/morphs "$SRCDIR/scripts/test-morph" edit baserock:hello master |