summaryrefslogtreecommitdiff
path: root/morphlib/plugins/branch_and_merge_plugin.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Don't show git config messages for 'morph branch' in verbose modeRichard Dale2013-06-251-4/+4
|
* S7904: Add disk space checks before build & deployRichard Maw2013-06-051-0/+7
| | | | | | | The same check that cachedir and tempdir are large enough is used for both build and build-morphology. Deploy only checks for tempdir being large enough.
* Merge branch 'liw/kill-bare-except'Lars Wirzenius2013-05-281-8/+10
|\ | | | | | | | | | | | | Reviewed-by: Richard Maw I, Lars, note that we have an old version of CoverageTestRunner in Baserock. The new version hides the spurious logging messages.
| * Stop using bare except: statementsLars Wirzenius2013-04-161-8/+10
| | | | | | | | | | | | | | | | | | It is almost never a good idea to catch all exceptions, and then do nothing about them. This patch logs all caught exceptions so that the user has some possibilty to debug what is happening. Also, make ./check check for bare excepts and fail the test suite if it finds anything.
* | morph branch caches previously uncached reposRichard Holland2013-04-121-1/+1
|/ | | | | | Like morph checkout, morph branch will cache a previously uncached repo rather than giving an error. The if statement checking for an already existant branch will now no longer raise an error when repo is uncached.
* Improved error message when building or deploying outside system branchRic Holland2013-03-221-2/+7
|
* Changed metadata_dir from an optional argument to a settingRic Holland2013-03-141-2/+9
| | | | morph branch-from-image
* B&M: Share error message formatting codeRichard Maw2013-03-041-7/+10
| | | | | | | This makes the warning messages include how to fix the problem. morphlib.git.check_config_set will return the values of the keys which were set, so it can be used to get git config.
* B&M: Check git config before some subcommandsRichard Maw2013-03-011-0/+22
| | | | | | | | | Some subcommands use git to create commits, in which case user config needs to be set. Others imply commits may be created, e.g. by cloning a repository, at which point it is useful to have a reminder that the configuration needs to be set.
* B&M: Commit to build branches with user's emailRichard Maw2013-03-011-2/+1
| | | | | | While it may be useful to have the username and machine the commit was made on, it's more useful to have the committer's email address, and the email field is for email addresses.
* Add the ability for chunk morphs to specify devicesJonathan Maw2013-02-281-0/+1
| | | | | | | | | | | | | | | | | Within a linux-user-chroot, we do not want to allow arbitrary code to create device nodes, but still want it to be possible to create a device node. This commit creates and handles the 'devices' field in a chunk morphology, which takes: * filename. A string, e.g. "/dev/null" * uid. The ID of the user the file belongs to, e.g. 0 for root. * gid. The ID of the group the file belongs to, e.g. 0 for root. * type. A string of either 'c' for a character device or 'b' for a block device. * major. The device's major number. * minor. The device's minor number. * permissions. A string of the octal number that would be passed to chmod e.g. '0777'
* Make writing morphologies back out properly non-destructiveSam Thursfield2013-02-181-55/+47
| | | | | | Remove the special case hacks we had and do a proper comparison between original and new in-memory dict when writing updates to user morphologies.
* Merge branch 'baserock/richardmaw/fix-edit-build-depends'Sam Thursfield2013-02-131-33/+66
|\
| * morph edit: Recursively edit strataRichard Maw2013-02-131-33/+66
| | | | | | | | | | | | | | | | | | | | | | Previously the code would edit strata that dependended on the stratum being edited, but would ignore the dependency chain beyond that. In fact, we need to edit all strata in the dependency chain to avoid having two different versions of a stratum in the same build. This splits the modification into two steps: changing the stratum that points to the chunk, and recursively changing references to any strata that have been altered.
* | Merge branch 'liw/deployment-refactor' of ↵Richard Maw2013-02-121-0/+1
|\ \ | | | | | | | | | git://git.baserock.org/baserock/baserock/morph
| * | Add deployment pluginLars Wirzenius2013-02-061-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | This adds a new optional field to system morphologies: "configuration-extensions". The deployment plugin relies heavily on code from the branch and merge plugin. This needs to be eventually fixed by refactoring the codebase so that the shared code is in morphlib and not in plugins. However, doing that is beyond the scope of adding a deployment plugin.
* | branch and merge: add branch-from-image commandRichard Maw2013-02-111-0/+128
| | | | | | | | | | | | Branch from image takes a directory containing metadata, then creates a branch of what the System was built from and petrifies it to when the System was built.
* | branch and merge: combine checkout and branch logicRichard Maw2013-02-111-48/+37
| |
* | Make petrify more versatile than just making tagsRichard Maw2013-02-111-8/+18
|/ | | | | | | | Pass resolved_refs in with the key as a repo, ref pair to petrify to the value, rather than petrifying to the current state of the ref. Set update_working_tree to also change files in the working tree, instead of just the index.
* Merge branch 'jjardon/yaml-v2'Sam Thursfield2013-01-281-1/+0
|\
| * Remove unneded json module importsJavier Jardón2013-01-281-1/+0
| |
* | Make temporary build refs count changes against HEADRichard Maw2013-01-251-3/+4
|/ | | | | | | | | | | | | | | | | | | | | | | Before it would determine which files are changed by comparing your working tree to This gets even weirder, since it's effectively comparing your working tree, the last commit on the temporary build ref, and the last commit of your HEAD, so committing a change to remove a file isn't noticed, because it was in the temporary build branch. It could also cause a strange case of a file being both added and untracked. Now the working tree and HEAD are compared, and committed on top of the temporary build ref. Better handling of the status output is still required, a deleted file is treated identically to an added one if it is only removed in the index. It would also be nicer to keep the user's index, since they may have added or removed files from it.
* Merge remote-tracking branch 'origin/jonathanmaw/ccache-local-fix'Lars Wirzenius2013-01-031-1/+1
|\ | | | | | | Fixed a copyright year to make ./check happy.
* | Fix sporadic test failures caused by the unstable ordering of glob.glob()Sam Thursfield2013-01-031-2/+2
|/ | | | | | | | glob.glob() can return results in any order. In practice it varies at least according to the file system being used. This means that test results may be different. To avoid this, we should always use sorted(glob.iglob()) instead, so that the code always behaves in the same way given the same inputs.
* morph build: Update repo and ref in stratum build-depends fieldsSam Thursfield2012-12-181-0/+3
|
* morph edit: Update build-depends that refer to the edited stratumSam Thursfield2012-12-181-73/+84
| | | | | | | The code took some refactoring. The core functionality is now all inside one function with make_available() separate, as this is used other places. The code is still far from perfect, but will hopefully be rewritten to use the new abstractions of system branches etc. soon
* Drop committer info from git tag environment; update tag test outputsJannis Pohlmann2012-12-171-6/+0
| | | | | | | | | | | The committer information in the environment used to run git in morph tag is not needed. In morph build it makes sense as morph commits without the user knowing. With morph tag, it's the user that decides to create the commit and tag. There is something weird going on, where morph tag may end up generating commits with different SHA1s on different machines. The full log output in the morph tag tests might help investigate what happens.
* Merge remote-tracking branch 'remotes/origin/samthursfield/ambiguous-refs' ↵Jannis Pohlmann2012-12-131-8/+7
|\ | | | | | | into baserock/merge-queue
| * morph branch: Check if the ref already exists before anything elseSam Thursfield2012-12-131-6/+5
| | | | | | | | | | This was done to ensure tests.branching/branch-fails-if-branch-exists always passes, but also seems like the right approach in general.
| * Always use `git rev-parse --verify` to resolve refsSam Thursfield2012-12-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously some code used `git show-ref`, which is wrong -- given two refs named 'alpha/master' and 'master', `git show-ref master` will return both, sorted alphabetically. This can lead to build failures, etc. due to refs resolving to the wrong SHAs. We should also use `git rev-parse --verify` to verify SHA1s, which we previously did with `git rev-list`. Finally, `git rev-parse --verify` is more than twice as fast as `git show-ref`.
* | Fix morph tag usage of git commit-tree; fix detecting existing tagsJannis Pohlmann2012-12-131-12/+23
| |
* | Merge remote-tracking branch 'origin/jannispohlmann/morph-tag-v2'Sam Thursfield2012-12-131-0/+203
|\ \ | |/ |/|
| * Add an initial implementation of "morph tag"Jannis Pohlmann2012-12-131-0/+203
|/ | | | | | | | | | | | | | | | | | | | | | | | | | In order to make releases and freeze system branches entirely, we need to be able to 100% petrify a system branch (that is, resolve ALL refs into SHA1s) and tag this state to be able to check it out again later. This is essentially what "morph tag" does. It takes a tag name and an arbitrary amount of arguments to "git tag", petrifies all morphologies of the current system branch behind the scenes, creates a dangling commit and attaches an annotated tag to it. Petrifying in this case means that all refs used for chunks are resolved into commit SHA1s. For stratum and system morphologies, the refs are replaced by the name of the tag that's being created. The "tag" command also supports tagging when stratum morphologies are spread across multiple repositories. In this case, it will include all statum morphologies from other repos in the tag commi in the branch root repo. The references to these morphologies are updated so that they point to the branch root repo and the tag being created. This commit also adds a few tests for "morph tag" to verify that all this works.
* Merge branch 'samthursfield/build-without-push' of ↵Richard Maw2012-11-121-12/+31
|\ | | | | | | git://git.baserock.org/baserock/morph
| * morph build: Allow forcing build branches to be pushedSam Thursfield2012-11-121-4/+5
| | | | | | | | | | This is for users who prefer the old behaviour of building from the remote repos.
| * morph build: Use the user's own repos when buildingSam Thursfield2012-11-121-9/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | This means that Morph no longer requires changes to be pushed in order to build them. The repos from the system branch are currently cached in the local repo cache as part of the build process, which is far from ideal. Tests for 'morph build' now test build without push. The build metadata now includes a repo path that is inside the TMPDIR, so the tests have been rewritten to avoid having any hardcoded cache keys because the cache keys are no longer static.
| * Add docstrings for some build functionsSam Thursfield2012-11-121-0/+9
| |
* | Fix spelling mistakesSam Thursfield2012-11-121-3/+3
|/
* Process systems for merging in a fixed orderSam Thursfield2012-11-051-1/+1
| | | | | | | | | | | The test tests.merging/rename-stratum could potentially trigger two different errors in Morph, based on the order that the systems in the root repo were processed. This meant that the test would sometimes spuriously fail if TMPDIR was manually set, because of differences in the way file systems work. To fix the root cause requires proper 3-way merging, really.
* Fix use of variable before assignmentSam Thursfield2012-11-021-0/+1
| | | | | | BranchAndMergePlugin.load_morphology() would crash if a parse error occurred while reading a morphology from a specific revision in git, instead of from on disk.
* Improve command descriptions in --helpSam Thursfield2012-10-261-31/+25
| | | | | Make sure all commands have one line of description, and reduce the size of some which had large amounts of text.
* Merge branch 'samthursfield/morph-status-in-workspace-sorted'Sam Thursfield2012-10-181-2/+3
|\ | | | | | | Reviewed-By: Richard Maw <richard.maw@codethink.co.uk>
| * morph status: Sort list of system branches in a workspaceSam Thursfield2012-10-181-2/+3
| | | | | | | | | | Output needs to be stable, not least so that the test doesn't fail sporadically.
* | Merge branch 'samthursfield/petrify-avoid-edited-chunks' of ↵Richard Maw2012-10-181-18/+39
|\ \ | |/ |/| | | git://git.baserock.org/baserock/morph
| * morph petrify: Avoid petrifying chunks that have already been editedSam Thursfield2012-10-181-18/+39
|/ | | | | | | | | | | | | This change causes 'morph petrify' to avoid petrifying any chunk whose ref matches the current system branch, because it makes no sense to petrify something that is also being edited. It also improves efficiency slightly and adds warning where different systems point to different refs of the same stratum. A non-obvious effect of this is that if you try to petrify 'master', many of the chunks won't get petrified because they are built from 'master'. However, petrifying master makes no sense so I'm not sure that we need to worry.
* morph status, foreach: Find root repo in correct waySam Thursfield2012-10-121-5/+8
| | | | | | | | Previously if the user had renamed the directory holding the root repository, the commands would break tragically. Also fix find_repository() to avoid aborting if it encounters a git repo in the branch checkout that wasn't put there by Morph.
* Factor out common function iterate_branch_repos()Sam Thursfield2012-10-121-10/+14
|
* morph status: Add initial version of commandSam Thursfield2012-10-121-0/+57
| | | | This provides a user-friendly summary of the workspace or branch status.
* Reorder branch and merge plumbing commands to end of fileSam Thursfield2012-10-121-25/+30
| | | | | Users do not need these now due to 'morph status' existing. However, they are still useful for scripts to call.
* Merge remote-tracking branch ↵Daniel Silverstone2012-10-111-8/+83
|\ | | | | | | | | | | 'origin/samthursfield/S4873-warn-when-merge-causes-petrification' Renamed petrification test slightly as merge fixup.