summaryrefslogtreecommitdiff
path: root/morphlib/cachedrepo_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* cachedrepo: Remove unused load_morphology methodAdam Coldrick2014-08-141-4/+0
|
* Fix Morph failing to update some cached git reposSam Thursfield2014-07-071-1/+17
| | | | | | | | | | | | | | | | | | | | | | | I was getting the following error when running the 'do-release.py' script: ERROR:root:Command failed: morph --quiet --trove-host=git.baserock.org list-artifacts baserock:baserock/definitions sam/auto-release minimal-system-x86_32-generic ERROR: Ref d67a0e110187abd560a1de63fa172894a52839d5 is an invalid reference for repo git://git.baserock.org/delta/linux The commit that it wants did actually exist in git.baserock.org and the logs show that Morph hadn't done a `git remote update` to get the commit locally. This turned out to be because it'd had already looked up a different ref in linux.git. It hadn't needed to run 'git remote update', but it *had* added linux.git to a "don't need to update this repo again" list. Oops! I've moved the code in question to the cachedrepo module so that the repo object keeps that of whether it should be updated. The bug is now fixed. As a side effect this patch fixes the spurious 'Updating repo file:///...' messages, which were printed even though repos with file:/// URLs are never updated.
* Replaces Tempdir with fs.tempfs.TempFSDaniel Firth2013-12-201-32/+33
|
* Fix CachedRepo.resolve_ref unit test for missing SHA1Lars Wirzenius2013-10-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | CachedRepo.resolve_ref does, effectively, this: absref = git rev-parse --verify $ref git log -1 --format=format:%T $absref Roughly, "git rev-parse" takes any ref and returns the corresponding SHA1. If the ref looks like a SHA1 (40 hex digits), it is returned as-is, and despite --verify is not checked for existence. "git log" then takes the SHA1 and returns the **tree** SHA1, as opposed to the commit one, and if the commit doesn't exist, barfs. The unit test for resolve_ref with an invalid SHA1 currently succeeds for the wrong reason. The mocked _rev_parse fails for an unknown SHA1 (raising cliapp.AppException), which causes resolve_ref to raise InvalidReferenceError, which the unit test expects. However, the real implementation of _rev_parse wouldn't fail in that way, and so the unit test doesn't test the thing it's meant to test: that resolve_ref actually works the expected way for an unknown SHA1. What actually happens is that resolve_ref calls _show_tree_hash, which raises cliapp.AppException for an unknown SHA1, resulting in horror and despair, instead of resolve_ref raising InvalidReferenceError. This commit fixes the unit test so that it causes the right code path in resolve_ref to be executed. This makes the unit test suite to fail.
* Merge branch 'liw/deploy-not-exec-message'Lars Wirzenius2013-05-281-1/+1
|\ | | | | | | | | | | Updated copyright years so ./check passes. Reviewed-by: Richard Maw
* | Stop using bare except: statementsLars Wirzenius2013-04-161-4/+5
|/ | | | | | | | | 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: Check if the ref already exists before anything elseSam Thursfield2012-12-131-0/+6
| | | | | 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-23/+9
| | | | | | | | | | | | | 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`.
* Avoid caching repos that are on the local machine anywaySam Thursfield2012-11-121-0/+6
| | | | | Currently the message is still displayed "Updating xxx" but no update is actually done.
* Use repository cache for git access other than current system branchSam Thursfield2012-10-031-2/+12
| | | | | | | | | | | | | | The origin/ refs in the system branch checkout repos may or may not be up to date, and may or may not have been tampered with by the user. Much better to use our central cache for everything other than changes to the system branch ref itself, where we should indeed be honouring the user's local changes. At a later date we could warn if the user modifies refs other than the system branch ref but does not push, as these changes will have no effect. NOTE: this commit breaks 'morph merge'. It is fixed in the next commit.
* Update unit tests for bare repo caches.Daniel Silverstone2012-09-141-8/+28
| | | | Update the unit tests so that they pass with the new bare repository caches.
* Give more useful errors when cloning from local cache failsSam Thursfield2012-09-131-13/+9
|
* Resolve tree SHA1 along with commit SHA1 when resolving refsJannis Pohlmann2012-09-051-3/+20
| | | | Adjust all other parts and the tests to work with this.
* Support 'git ls-tree' in local and remote reposSam Thursfield2012-08-241-0/+23
|
* python scripts: pep8ize codebaseRichard Maw2012-08-011-16/+16
| | | | | | | | | This was done with the aid of the pep8 script, available by running `easy_install pep8`. It may be worth making this part of ./check, but that will require putting pep8 into the development tools stratum. This should be easy, given pep8 has no external dependencies.
* Fix unit tests to raise cliapp.AppException the right wayLars Wirzenius2012-06-071-5/+5
|
* morph: remove dead code and replace Execute with app.runcmdRichard Maw2012-05-301-6/+8
|
* Make morph's _clone_to_directory use CachedRepo.checkoutLars Wirzenius2012-05-041-2/+6
| | | | | | | | | This requires changing CachedRepo.checkout to handle non-sha1 refs, which resulted in some further changes in tests and their expected outputs. Also, a fix to CachedRepo to use the cwd keyword argument instead of pwd.
* Relax CachedRepo.checkout requirement that ref is a sha1Lars Wirzenius2012-05-041-5/+0
|
* Add original_name member to CachedRepo. Use it for SourcePool lookups.Jannis Pohlmann2012-04-171-2/+5
| | | | | | This is done to avoid a nasty mix of SourcePool lookups using CachedRepo objects (e.g. for strata within a system) versus lookups using repo names (e.g for sources within a stratum).
* Get rid of 2.7 syntax for assertRaises.Jannis Pohlmann2012-04-091-26/+27
|
* Add CachedRepo class with tests.Jannis Pohlmann2012-04-091-0/+181