summaryrefslogtreecommitdiff
path: root/morphlib/plugins/branch_and_merge_new_plugin.py
Commit message (Collapse)AuthorAgeFilesLines
* Allow omitting repo and ref when referring to strataRichard Maw2014-02-131-3/+3
|
* Modify morph to strip .morph extensions from parametersBen Brown2013-12-161-3/+5
|
* sysbranchdir: Move load_all_morphologies helper hereRichard Maw2013-11-291-9/+2
| | | | | | | | | | | | | | | This was previously a private method of the branch and merge plugin, but it's useful to other plugins, so has been moved to the SystemBranchDirectory class, where everything else can get to it. It has an unpleasant amount of coupling to other classes, but in a *good* object oriented design it would either be a tiny module on its own, or not exist and leave all its users to re-implement the same logic multiple ways, so we've opted for a less clean, but more useful design. It is left un-covered by the unit tests, since it requires a great deal of instrumentation to test, at which point it may be best to leave it to integration tests.
* GitDir: Add GitIndex classRichard Maw2013-11-221-1/+1
| | | | | | | | | | | | | | | This represents the state of the index of a GitDirectory. Methods that use the index are now used via the GitIndex class, rather than using the default index, as previously used when the methods were in GitDirectory. GitIndex may be constructed with an alternative path, which can be used to manipulate a git checkout without altering a developer's view of the repository i.e. The working tree and default index. This is needed for `morph build` and `morph deploy` to handle the build without commit logic.
* GitDir: Provide more specific object access than cat-fileRichard Maw2013-11-221-2/+2
| | | | | | | We need to use cat-file for files by SHA1, commits by SHA1 and files by ref and path, so provide access in separate methods, since while it's all the same thing "under the hood", it avoids the user needing to know the command-line syntax.
* Remove unused invent_new_branch methodRichard Maw2013-11-221-12/+0
|
* Added scenario test to prevent morph edit from being used without a system ↵Daniel Firth2013-11-011-0/+2
| | | | argument
* Don't remove an existing branch in 'morph branch'Pedro Alvarez2013-10-311-0/+3
|
* Merge branch 'danielfirth/RT193'Daniel Firth2013-10-111-1/+1
|\ | | | | | | | | Reviewed by: Lars Wirzenius Reviewed by: Pedro Alvarezwq
| * Added chunkname prefix to some elements of the debug log.Dan Firth2013-10-111-1/+1
| |
* | Merge remote-tracking branch 'origin/danielfirth/RT189'Lars Wirzenius2013-10-081-10/+0
|\ \ | |/ |/| | | Changed the error (exception) to list all obsolete fields.
| * Re-enabled validation for morph editDan Firth2013-10-011-10/+0
| |
* | Merge branch 'baserock/richardmaw/S8847/branch-from-image-v3'Jonathan Maw2013-09-301-36/+146
|\ \ | | | | | | | | | | | | Reviewed-by: Lars Wirzenius <lars.wirzenius@codethink.co.uk> Reviewed-by: Jonathan Maw <jonathan.maw@codethink.co.uk>
| * | B&M: refactor branch-from-imageRichard Maw2013-09-251-0/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the interface of branch-from-image to only take 1 parameter, the name of the new system branch, as the root repository is loaded from the metadata. This was also what the previous version of branch-from-image did, but that silently ignored the parameter. Given there are not many users of branch-from-image, I felt it was a reasonable change.
| * | b&m: checkout and branch use context managerRichard Maw2013-09-251-36/+7
| | |
| * | b&m: Add system branch initializing context managerRichard Maw2013-09-251-0/+35
| |/ | | | | | | | | | | | | | | | | | | | | | | | | This creates an object that the with statement can use to handle the context and clean up the workspace if the body raises an exception. This is roughly equivalent to having a function that takes a callback of what to do while the branch is being initialized, but with less boilerplate at the call site. contextlib is used to create a context manager from a generator function. This is less verbose than defining a class with __enter__ and __exit__ methods.
* | Make branch commands work with null refsRichard Maw2013-09-261-1/+6
|/
* b&m: Use new MorphSet api in unpetrifyRichard Maw2013-09-241-23/+1
|
* b&m: Refactor petrify to use new morphset methodsRichard Maw2013-09-241-17/+12
|
* b&m: Use new-status as the defaultRichard Maw2013-09-171-1/+1
| | | | The previous status is currently still available as old-status.
* b&m: morph new-status provides per-branch statusRichard Maw2013-09-171-1/+23
|
* b&m: Add new-status subcommandRichard Maw2013-09-171-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This currently performs the workspace-wide status, but not the system-branch status functionality of the older status subcommand. A quick estimate showed the new code to be 5x faster, comparing # time (echo 2 >/proc/sys/vm/drop_caches; morph status) System branches in current workspace: baserock/richardmaw/S8537/ssh-copy-id baserock/richardmaw/S8564/ro-staging-area baserock/richardmaw/S8591/lzo-shared baserock/richardmaw/cliapp-pipefail baserock/richardmaw/malformed-strata-test master tutorial-1/tutorial/master tutorial-1/tutorial/update-ssh real 0m2.517s user 0m0.998s sys 0m1.482s # time (echo 2 >/proc/sys/vm/drop_caches; morph new-status) System branches in current workspace: baserock/richardmaw/S8537/ssh-copy-id baserock/richardmaw/S8564/ro-staging-area baserock/richardmaw/S8591/lzo-shared baserock/richardmaw/cliapp-pipefail baserock/richardmaw/malformed-strata-test master tutorial-1/tutorial/master tutorial-1/tutorial/update-ssh real 0m0.506s user 0m0.207s sys 0m0.233s
* Merge branch 'baserock/richardmaw/S8717/refactor-petrify-v4'Richard Maw2013-09-161-0/+137
|\ | | | | | | | | | | | | | | Reviewed-by: Lars Wirzenius Reviewed-by: Daniel Silverstone Daniel gave his +1 with the caveat that he would like tests for petrifying a system branch other than master.
| * b&m: re-implement morph unpetrifyRichard Maw2013-09-051-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This also undoes the test suite change to keep it using the old petrify. Petrify and Unpetrify have the same structure: 1. Set up 2. Load all the morphologies 3. Make changes to the morphologies 4. Write back any changes This suggests some re-use in the form of passing a function callback to a morphology visitor.
| * b&m: Re-implement morph petrifyRichard Maw2013-09-051-0/+91
| | | | | | | | | | This includes amending the test suite to use the old petrify, since the old unpetrify depends on some implementation details of it.
* | foreach: sort repositories asciibeticallyRichard Maw2013-09-161-1/+1
|/ | | | | | | | | | | | | | | | | | | The test suite checks the output of the foreach command, this requires repositories to be returned in a stable order. The order returned from os.listdir differs by the filesystem used. btrfs returns roughly in insertion order, tmpfs alphabetically. This allowed the failure to sort pass through unchecked, since I was testing on btrfs, but people discovered issues when using /tmp, which is a tmpfs. To fix this, foreach sorts the result of list_git_directories() by directory name. The previous code would always return the root repository first, this was a unnecessary complication, so now everything is returned asciibetically and the tests amended to reflect this.
* b&m: Re-implement morph foreachRichard Maw2013-09-041-0/+58
| | | | | | | | | | | | | | The previous version attempted to separate the output of the commands run with newlines by printing a newline at the beginning if it wasn't the first repository. The check it used was for the first repository was flawed by assuming that the root repository was the first repository processed. Since the complication was not worth keeping the output identical, it has been changed to separate by printing a newline after every command and the test output has been amended to include the extra trailing newline.
* edit: Unset defaults before writingRichard Maw2013-08-301-0/+1
| | | | | | | | This also amends the test suite. The git apply command to alter the stratum proved inflexible when anything changed, so it has been replaced by a small in-line python script.
* morph edit: Check for sufficient argumentsRichard Maw2013-08-301-0/+5
| | | | | It's nicer to get a clean error message explaining what's wrong than a stack trace.
* Revert "Merge branch 'liw/restore-old-cmds'"Richard Maw2013-08-291-1/+1
| | | | | | | | | | | | | | | 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.
* Restore old branch and merge subcommandsLars Wirzenius2013-08-191-1/+1
| | | | | | | | | Most of the subcommands are available as "old-foo". The exception is edit, for which we've decided to stick with the old implementation by default. Thus the new implementation is "new-edit". This is all meant to be a safety net so that for BR10 we are not stuck in limbo in case the new implementations are broken in unexpected ways.
* Clarify _get_stratum_triplets codeLars Wirzenius2013-08-151-1/+15
| | | | Suggested by Richard Maw
* Fix "morph edit" to load morphologies from git when neededLars Wirzenius2013-08-151-1/+32
| | | | | | | | | | | | | | | This is a bug fix. The code would previously blithely load the morphology from the currently checked out ref (plus any local, uncommitted changes). This is obviously wrong. However, we can't check out the right ref, either, so the right thing to do is to "git cat-file" it. But only when the right ref is not checked out. This is fairly complex behaviour which may not be obvious to users either. But we'll worry about that later, this is what needs to happen now, and I don't want to make big behavioural changes in the middle of a refactoring. Bug found based on suggestion by Richard Maw.
* Re-implement "morph edit" using new infrastructureLars Wirzenius2013-08-141-0/+204
| | | | | | Test suite currently fails because MorphologyLoader validates differently from the old MorphologyFactory code, and because MorphSet changes refs more correctly (including, it seems, build-dependency refs).
* Load morphologies using the new mechanisms, not the oldLars Wirzenius2013-08-141-4/+4
|
* Remove unused argument from SystemBranchDirectory.clone_cached_repoLars Wirzenius2013-08-141-3/+2
| | | | | For some reason, there was an unused argument in the method. Remove it from the definition and all call sites.
* workflow-tools: check branch roots have systemsRichard Maw2013-08-081-0/+25
| | | | | | | | It's rather easy to accidentally try to create a system branch of the `morph` repository rather than the `morphs` repository. This commit verifies that a checked out branch contains system morphologies, otherwise it aborts and cleans up.
* workflow-tools: Fix typo in `morph help branch`Richard Maw2013-08-071-1/+1
| | | | Reviewed-by: Lars Wirzenius and Jonathan Maw on IRC
* Re-implement "morph branch" using new infrastructureLars Wirzenius2013-08-061-0/+73
|
* Re-implement "morph show-branch-root" using new infrastructureLars Wirzenius2013-08-061-0/+18
|
* Re-implement "morph show-system-branch" using new infrastructureLars Wirzenius2013-08-061-0/+9
|
* Re-implement "morph checkout" using new infrastructureLars Wirzenius2013-08-061-0/+99
|
* Re-implement "morph workspace" using the Workspace classLars Wirzenius2013-07-311-0/+7
| | | | | | | | | Put new implementation into new branch and merge plugin, and remove old implementation from the old plugin. Also change the error message for the NotInWorkspace exception, so that it matches what the test suite expects. It's a crappy error message, I think, but I don't want to change external behaviour during refactoring.
* Re-implement "morph init" using the new Workspace classLars Wirzenius2013-07-311-0/+63
Move "morph init" into a plugin, and remove it from the previously existing plugin. This keeps all the old, tricky code in the old plugin, and moves new, clean code into a new plugin. Eventually the old plugin can be removed, since it'll be empty.