summaryrefslogtreecommitdiff
path: root/morphlib/localrepocache_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* Unify local and remote repo cache modulesSam Thursfield2016-03-161-149/+0
| | | | | | | | | | | | | | | | | | | | | There's not really any reason you'd want to use the RemoteRepoCache class except as a workaround for the slow speed of some LocalRepoCache operations, so I can't see this ruining anyone's day. The main reason for doing this is so we can simply the sourceresolver code. One reason that the sourceresolver class is so hopelessly complicated is that it right now has to use two incompatible interfaces for Git repo caches. I've taken the opportunity to detangle the RepoCache class from the App class. Now all of the configuration for the RepoCache class is passed into the constructor explicitly. This makes the class usable from outside Morph: resolver = morphlib.repoaliasresolver.RepoAliasResolver(aliases=[]) repo_cache = morphlib.repocache.RepoCache('/src/cache/gits', resolver) Change-Id: I596c81d7645b67504c88e555172a8c238f4f8a66
* Get rid of the CachedRepo class (almost)Sam Thursfield2016-03-031-16/+13
| | | | | | | | | | | | | | | | | | For a long time the CachedRepo class has basically been a wrapper around the GitDir class, but with a few extra methods that don't really even belong there. It is now a tiny class in the localrepocache module which just keeps track of a few extra attributes. All other functionality is provided by the gitdir module. This commit also removes the `git clone` approach for copying repos out of the cache. The alternative approach implemented by git.copy_repository() was slightly faster when I tested, so for now we should use that everywhere. Longer term we should find out why this is quicker than `git clone`, and fix Git itself to be fast. Change-Id: I1686ab43253d44c3903d9a0bad8bb75528e9cf75
* Hide get_repo() and cache_repo() functions, always use get_updated_repo()Sam Thursfield2016-03-031-35/+14
| | | | | | | | | | This allows us to simplify a couple of places. I cannot think of a single situation where'd you want to get the cached copy of a repo, but not update it. Think about it -- the repo might be *years* behind the upstream remote. Change-Id: I60340c7fb33e7bfe871ad30c0a9322a7202548e2
* Remove old cruftTiago Gomes2015-11-201-3/+0
| | | | | | | Static analysis showed this code is not being used, and we can always bring it back if necessary through git. Change-Id: Id8bf7d73436b5c3d0dfe050befaae034a05afc86
* Show progress of downloads when --verbose is passed, not --debugSam Thursfield2015-05-061-1/+2
| | | | | | | This commit undoes behaviour changes from commit aa6dfcbb70c03dfeb3f9af02. Change-Id: Ie677fb9c4e6bcd6edeba2cdd87f4f6125dcae7a4
* Use --verbose/-v to show build output, --debug/-d for morph debugJavier Jardón2015-04-221-1/+1
| | | | | | | | | | | Its going to be more likely that a baserock user is more interesed in the build log than actually the debug output from morph. And also the intuitive option would be to use -v for this. --verbose/-v: show build output --debug/-d: show morph debug output Change-Id: I1fb99034dc8680a5f168f6306724663aea33ebc5
* Use the modern way of the GPL copyright header: URL instead real addressJavier Jardón2015-03-161-2/+1
| | | | Change-Id: I992dc0c1d40f563ade56a833162d409b02be90a0
* sourceresolver: Factor out 'cache repo locally' code into a functionSam Thursfield2015-02-201-2/+6
| | | | | | | Also, move the repo.update() call into the 'fetch from tarball' code path in the localrepocache module -- there's no need to update straight after doing a `git clone`, but we do need to do one if we got the repo from a `git archive` tarball that may be out of date.
* Rework CachedRepo to use the GitDirectory class where possibleSam Thursfield2014-12-031-0/+7
| | | | | | | | | | | | | This consolidates a bunch of code paths that were previously duplicated. This also changes the API for local cached repos to match the function names GitDirectory uses. Note that the remote repo cache still uses the old names, and should be fixed when time permits. Some unit tests that use the CachedRepo module required a bit of inelegant monkey-patching in order that they continue to work. A better way to do this would be with the 'mock' library (which would need to be added to Baserock 'build' and 'devel' systems before we could use it).
* Echo stderr of subcommands that do network IO when --verbose is usedSam Thursfield2014-10-291-3/+8
| | | | | | | | | | | | Morph can appear to hang in situations where it is actually waiting on a slow network operation. This change gives users a way to see the output of the subcommands that are doing the network IO (either 'wget', 'git clone' or 'git remote update'). The status information goes onto stderr, because that is where the subcommands write it. Morph tends to put its status output on stdout, but (a) some commands are machine-parsed, such as `serialise-artifact` and (b) it's tricky to get Git to put status output on stdout.
* Refactored localrepocacheDaniel Firth2013-12-201-35/+25
|
* Avoid caching repos that are on the local machine anywaySam Thursfield2012-11-121-0/+5
| | | | | Currently the message is still displayed "Updating xxx" but no update is actually done.
* Use tarballs instead of bundlesDaniel Silverstone2012-09-251-8/+27
| | | | | | | This makes a non-backward-compatible change to morph which switches it to using tarballs instead of bundles when initialising cached git repositories. This is faster because it doesn't require index-pack --fix-thin operations on the machine running morph.
* Update unit tests for bare repo caches.Daniel Silverstone2012-09-141-3/+3
| | | | Update the unit tests so that they pass with the new bare repository caches.
* python scripts: pep8ize codebaseRichard Maw2012-08-011-9/+8
| | | | | | | | | 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-1/+1
|
* morph: remove dead code and replace Execute with app.runcmdRichard Maw2012-05-301-2/+4
|
* Change LocalRepoCache to use the new RepoAliasResolver.Jannis Pohlmann2012-05-041-16/+3
|
* Remove %s from one of the url patterns, to improve test coverageLars Wirzenius2012-05-041-1/+1
|
* Remove use of baseurls in LocalRepoCacheLars Wirzenius2012-05-041-0/+6
| | | | The tests, they still fail.
* Implement repo-alias expansionLars Wirzenius2012-05-041-2/+2
| | | | | | | | Changed the delimieter between push and pull patterns to be #, since = is reasonably frequent in URLs, and # should never be necessary in git urls. Oh my how many tests now fail.
* Add tests for repo-alias expansionLars Wirzenius2012-05-041-0/+7
|
* Update LocalRepoCache tests to use repo aliases instead of baseurlsLars Wirzenius2012-05-041-6/+6
|
* Fix LocalRepoCache tests.Jannis Pohlmann2012-04-191-3/+3
|
* localrepocache tests: fake_git accept cwdRichard Maw2012-04-111-1/+1
|
* localrepocache unit tests: fix the bundle urlRichard Maw2012-04-111-1/+1
| | | | | Bundle urls generated by lorry end with .bndl, this was fixed but the test was not adjusted, doh!
* tests: clones should have origin url not be bundleRichard Maw2012-04-111-3/+7
|
* localrepocache: return error descriptionRichard Maw2012-04-111-2/+3
| | | | | | | | Also change _fetch to throw its exception as since it is more pythonic to throw exceptions than return exit status, other error handling needed to be caught, so it hsa been kept consistent. This required the tests to throw an exception as well
* Create cache directory when needed in LocalRepoCacheLars Wirzenius2012-04-101-0/+11
|
* Fix unit test to remember it's created a file when faking a downloadLars Wirzenius2012-04-101-0/+1
|
* Remove downloaded bundle after it has been clonedLars Wirzenius2012-04-091-0/+6
|
* Add bundle support to LocalRepoCacheLars Wirzenius2012-04-091-1/+25
|
* Add a LocalRepoCache classLars Wirzenius2012-04-091-0/+98
Jannis and I discussed a refactoring of most of morph's internals to reduce coupling and increase cohesion. This is one of the results: we'll want a couple of classes to manage locally cached git repositories. This commit adds the LocalRepoCache class to manage a the git cache directory. Later on, we'll add the CachedRepo class to represent individual repositories.