summaryrefslogtreecommitdiff
path: root/morphlib/sourcemanager.py
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-26 15:38:45 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-01-26 16:56:32 +0000
commit95e080de7ae579db864b68c8fbd2aead7e429c78 (patch)
tree29f7632054fc836ee086f1244ac14991de374fdc /morphlib/sourcemanager.py
parent6a10de5f6477065ce94404688dd78a483b547379 (diff)
downloadmorph-95e080de7ae579db864b68c8fbd2aead7e429c78.tar.gz
Add an update option to prevent the source manager from updating origin.
This is useful because we still have a mix of sudo and fakeroot, which can cause permission issues in repos. This way, we can work around this problem in some situations.
Diffstat (limited to 'morphlib/sourcemanager.py')
-rw-r--r--morphlib/sourcemanager.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/morphlib/sourcemanager.py b/morphlib/sourcemanager.py
index a5ae9124..06b062f4 100644
--- a/morphlib/sourcemanager.py
+++ b/morphlib/sourcemanager.py
@@ -45,11 +45,12 @@ class SourceNotFound(Exception):
class SourceManager(object):
- def __init__(self, app, cachedir=None):
+ def __init__(self, app, cachedir=None, update=True):
self.real_msg = app.msg
self.settings = app.settings
self.cached_treeishes = {}
self.cache_dir = cachedir
+ self.update = update
if not self.cache_dir:
self.cache_dir = os.path.join(app.settings['cachedir'], 'gits')
self.indent = 0
@@ -69,8 +70,11 @@ class SourceManager(object):
location = self.cache_dir + '/' + name
if os.path.exists(location):
- self.msg('Cached clone exists, updating origin')
- morphlib.git.update_remote(location, "origin", self.msg)
+ if self.update:
+ self.msg('Cached clone exists, updating origin')
+ morphlib.git.update_remote(location, "origin", self.msg)
+ else: # pragma: no cover
+ self.msg('Cached clone exists, assuming origin is up to date')
return True, location
else:
self.msg('No cached clone found, fetching from %s' % repo)