summaryrefslogtreecommitdiff
path: root/morphlib/cachedrepo.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/cachedrepo.py')
-rw-r--r--morphlib/cachedrepo.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/cachedrepo.py b/morphlib/cachedrepo.py
index 312f580f..0a085bb2 100644
--- a/morphlib/cachedrepo.py
+++ b/morphlib/cachedrepo.py
@@ -104,6 +104,15 @@ class CachedRepo(object):
self.path = path
self.is_mirror = not url.startswith('file://')
+ def ref_exists(self, ref):
+ '''Returns True if the given ref exists in the repo'''
+
+ try:
+ self._rev_parse(ref)
+ except cliapp.AppException:
+ return False
+ return True
+
def resolve_ref(self, ref):
'''Attempts to resolve a ref into its SHA1 and tree SHA1.