##// END OF EJS Templates
repositories: implemented faster dedicated checks for empty repositories
marcink -
r698:65b1b84c default
parent child Browse files
Show More
@@ -129,6 +129,15 b' class GitRemote(object):'
129 129 return params
130 130
131 131 @reraise_safe_exceptions
132 def is_empty(self, wire):
133 repo = self._factory.repo(wire)
134 try:
135 return not repo.head()
136 except Exception:
137 log.exception("failed to read object_store")
138 return True
139
140 @reraise_safe_exceptions
132 141 def add_object(self, wire, content):
133 142 repo = self._factory.repo(wire)
134 143 blob = objects.Blob()
@@ -172,6 +172,16 b' class HgRemote(object):'
172 172 return util.version()
173 173
174 174 @reraise_safe_exceptions
175 def is_empty(self, wire):
176 repo = self._factory.repo(wire)
177
178 try:
179 return len(repo) == 0
180 except Exception:
181 log.exception("failed to read object_store")
182 return False
183
184 @reraise_safe_exceptions
175 185 def archive_repo(self, archive_path, mtime, file_info, kind):
176 186 if kind == "tgz":
177 187 archiver = archival.tarit(archive_path, mtime, "gz")
@@ -139,6 +139,16 b' class SvnRemote(object):'
139 139 svn_ver = None
140 140 return svn_ver
141 141
142 @reraise_safe_exceptions
143 def is_empty(self, wire):
144 repo = self._factory.repo(wire)
145
146 try:
147 return self.lookup(wire, -1) == 0
148 except Exception:
149 log.exception("failed to read object_store")
150 return False
151
142 152 def check_url(self, url, config_items):
143 153 # this can throw exception if not installed, but we detect this
144 154 from hgsubversion import svnrepo
General Comments 0
You need to be logged in to leave comments. Login now