diff options
-rw-r--r-- | morphlib/localrepocache.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/morphlib/localrepocache.py b/morphlib/localrepocache.py index 465e9f03..aa45cd3d 100644 --- a/morphlib/localrepocache.py +++ b/morphlib/localrepocache.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012-2013 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -285,3 +285,15 @@ class LocalRepoCache(object): self._cached_repo_objects[reponame] = repo return repo raise NotCached(reponame) + + def get_updated_repo(self, reponame): # pragma: no cover + '''Return object representing cached repository, which is updated.''' + + self._app.status(msg='Updating git repository %s in cache' % reponame) + if not self._app.settings['no-git-update']: + cached_repo = self.cache_repo(reponame) + cached_repo.update() + else: + cached_repo = self.get_repo(reponame) + return cached_repo + |