Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

reporegistry: do not load the subrepo list for repositories that cannot be open

This patch avoids trying to load the subrepo list if a repository that is
on the repo registry cannot be open. Whenever that happens, the error will be
silently ignored to replicate the behavior of thg before subrepo support was
added.

TODO: Add a "warning" overlay or some other sort of visual indicator to repos
that could not be load.

Changeset 4d707f88e484

Parent f5538fe16d60

by Angel Ezquerra

Changes to 2 files · Browse files at 4d707f88e484 Showing diff from parent f5538fe16d60 Diff from another changeset...

 
159
160
161
162
 
163
164
165
 
221
222
223
224
 
225
226
227
 
228
229
230
 
 
 
 
 
 
 
 
 
231
232
233
 
 
234
235
236
 
271
272
273
274
275
 
 
276
277
278
 
283
284
285
286
 
287
288
289
290
291
292
 
293
294
295
 
159
160
161
 
162
163
164
165
 
221
222
223
 
224
225
226
 
227
228
229
230
231
232
233
234
235
236
237
238
239
240
 
 
241
242
243
244
245
 
280
281
282
 
 
283
284
285
286
287
 
292
293
294
 
295
296
297
298
299
300
 
301
302
303
304
@@ -159,7 +159,7 @@
    def repotype(self):   return self._repotype - +   def basenode(self):   """Return node id of revision 0"""   return self._basenode @@ -221,16 +221,25 @@
  addSubrepos(   ri.child(ri.childCount()-1), sctx._repo)   except (EnvironmentError, error.RepoError, util.Abort), e: - # Add the repo to the list of repos/subrepos + # Add the repo to the list of repos/subrepos   # that could not be open   invalidRepoList.append(repo.root) - +   return invalidRepoList     root = self.rootpath() + try: + repo = hg.repository(ui.ui(), root) + except (EnvironmentError, error.RepoError, util.Abort), e: + # Do not try to show the list of subrepos when the top repository + # could not be open + # TODO: Mark the repo with a "warning" icon or similar to indicate + # that the repository cannot be open + return +   invalidRepoList = \ - addSubrepos(self, hg.repository(ui.ui(), root)) - + addSubrepos(self, repo) +   if invalidRepoList:   if invalidRepoList[0] == root:   qtlib.WarningMsgBox(_('Could not get subrepository list'), @@ -271,8 +280,8 @@
  'git': 'thg-git-subrepo',   'svn': 'thg-svn-subrepo',   } - - def __init__(self, model, repo=None, parent=None, parentrepo=None, + + def __init__(self, model, repo=None, parent=None, parentrepo=None,   subtype='hg'):   RepoItem.__init__(self, model, repo, parent)   self._parentrepo = parentrepo @@ -283,13 +292,13 @@
  def doNothing(dummy):   pass   self.dumpObject = doNothing - +   # Limit the context menu to those actions that are valid for non   # mercurial subrepos   def nonHgMenulist():   return ['remove', None, 'explore', 'terminal']   self.menulist = nonHgMenulist - +   def data(self, column, role):   if role == Qt.DecorationRole:   if column == 0:
 
245
246
247
248
 
249
250
251
 
252
253
254
255
256
 
 
 
 
 
 
 
 
 
 
257
258
 
259
260
261
 
245
246
247
 
248
249
250
 
251
252
 
 
 
 
253
254
255
256
257
258
259
260
261
262
263
 
264
265
266
267
@@ -245,17 +245,23 @@
  addSubrepos(   ri.child(ri.childCount()-1), sctx._repo)   except (EnvironmentError, error.RepoError, util.Abort), e: - # Add the repo to the list of repos/subrepos + # Add the repo to the list of repos/subrepos   # that could not be open   invalidRepoList.append(repo.root) - +   return invalidRepoList - - repo = hg.repository(ui.ui(), root) - invalidRepoList = \ - addSubrepos(rgi.child(rgi.childCount()-1), repo) + + try: + repo = hg.repository(ui.ui(), root) + invalidRepoList = \ + addSubrepos(rgi.child(rgi.childCount()-1), repo) + except (EnvironmentError, error.RepoError, util.Abort), e: + # TODO: Mark the repo with a "warning" icon or similar to indicate + # that the repository cannot be open + invalidRepoList = [root] +   self.endInsertRows() - +   if invalidRepoList:   if invalidRepoList[0] == root:   qtlib.WarningMsgBox(_('Could not get subrepository list'),