Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

workbench: catch RepoError on openRepository()

Changeset ba5cfe4c170f

Parent 75e73501a792

by Adrian Buehlmann

Changes to one file · Browse files at ba5cfe4c170f Showing diff from parent 75e73501a792 Diff from another changeset...

 
14
15
16
17
18
 
 
19
20
21
22
 
 
23
24
25
 
320
321
322
323
 
324
325
326
 
327
328
329
330
 
 
 
 
 
 
331
332
333
 
14
15
16
 
 
17
18
19
20
21
22
23
24
25
26
27
 
322
323
324
 
325
326
 
 
327
328
329
 
 
330
331
332
333
334
335
336
337
338
@@ -14,12 +14,14 @@
   from PyQt4 import QtCore, QtGui, Qsci   -from mercurial import ui, hg -from mercurial import util +from mercurial import ui, hg, util +from mercurial.error import RepoError    from tortoisehg.util.util import tounicode, has_closed_branch_support  from tortoisehg.util.util import rootpath, find_repository   +from tortoisehg.util.i18n import _ +  from tortoisehg.hgqt.decorators import timeit    from tortoisehg.hgqt import icon as geticon @@ -320,14 +322,17 @@
  self.openRepository)     def openRepository(self): - caption = "Select repository directory to open" + caption = _('Select repository directory to open')   FD = QtGui.QFileDialog - path = FD.getExistingDirectory( - parent=self, caption=caption, + path = FD.getExistingDirectory(parent=self, caption=caption,   options=FD.ShowDirsOnly | FD.ReadOnly)   path = str(path) - repo = hg.repository(self.ui, path=path) - self.addRepoTab(repo) + try: + repo = hg.repository(self.ui, path=path) + self.addRepoTab(repo) + except RepoError: + QtGui.QMessageBox.warning(self, _('Failed to open repository'), + _('%s is not a valid repository') % path)     def startAtCurrentRev(self):   pass