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

hgqt: use util.Abort hint attribute

Changeset cbcd392bdeea

Parent c30783fbe84b

by Steve Borho

Changes to 7 files · Browse files at cbcd392bdeea Showing diff from parent c30783fbe84b Diff from another changeset...

 
107
108
109
110
 
111
 
 
 
 
 
 
 
112
113
114
 
121
122
123
124
 
125
 
 
 
 
 
 
 
126
127
128
 
107
108
109
 
110
111
112
113
114
115
116
117
118
119
120
121
 
128
129
130
 
131
132
133
134
135
136
137
138
139
140
141
142
@@ -107,8 +107,15 @@
  bb.setEnabled(True)   ble.setEnabled(True)   ble.setFocus() - except (util.Abort, error.RepoLookupError), e: + except error.RepoLookupError, e:   self.cmd.core.stbar.showMessage(hglib.tounicode(str(e))) + except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + self.cmd.core.stbar.showMessage(err)   def bverify():   bad = hglib.fromunicode(ble.text().simplified())   try: @@ -121,8 +128,15 @@
  cmds.append(prefix + ['--good', str(self.goodrev)])   cmds.append(prefix + ['--bad', str(self.badrev)])   self.cmd.run(*cmds) - except (util.Abort, error.RepoLookupError), e: + except error.RepoLookupError, e:   self.cmd.core.stbar.showMessage(hglib.tounicode(str(e))) + except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + self.cmd.core.stbar.showMessage(err)     gb.pressed.connect(gverify)   bb.pressed.connect(bverify)
 
598
599
600
601
 
 
 
 
 
 
602
603
604
 
893
894
895
896
897
 
 
 
 
 
 
898
899
900
 
909
910
911
 
 
 
 
 
912
913
 
914
915
916
 
598
599
600
 
601
602
603
604
605
606
607
608
609
 
898
899
900
 
 
901
902
903
904
905
906
907
908
909
 
918
919
920
921
922
923
924
925
926
 
927
928
929
930
@@ -598,7 +598,12 @@
  else:   dcmd = []   except error.Abort, e: - self.showMessage.emit(hglib.tounicode(str(e))) + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + self.showMessage.emit(err)   dcmd = []   if self.opts.get('patchName'):   cmdline = ['qnew', '--repository', repo.root, @@ -893,8 +898,12 @@
  try:   util.parsedate(date)   except error.Abort, e: - qtlib.WarningMsgBox(_('Invalid date format'), - hglib.tounicode(e), parent=self) + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + qtlib.WarningMsgBox(_('Invalid date format'), err, parent=self)   return   outopts['date'] = date   else: @@ -909,8 +918,13 @@
  try:   self.repo.ui.username()   except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e))   qtlib.WarningMsgBox(_('No username configured'), - hglib.tounicode(e), parent=self) + err, parent=self)   return     if self.pushaftercb.isChecked():
 
228
229
230
231
 
232
233
 
 
 
 
 
 
 
234
235
236
 
228
229
230
 
231
232
233
234
235
236
237
238
239
240
241
242
243
@@ -228,9 +228,16 @@
  self.repo.thginvalidate()   wctx = self.repo[None]   wctx.status(unknown=True) - except (util.Abort, error.RepoError), e: + except error.RepoError, e:   qtlib.WarningMsgBox(_('Unable to read repository status'),   uni(str(e)), parent=self) + except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (uni(str(e)), uni(e.hint)) + else: + err = uni(str(e)) + qtlib.WarningMsgBox(_('Unable to read repository status'), + err, parent=self)   return     self.lclunknowns = wctx.unknown()
 
175
176
177
 
 
 
 
 
178
179
180
 
181
182
183
 
175
176
177
178
179
180
181
182
183
 
 
184
185
186
187
@@ -175,9 +175,13 @@
  hglib.tounicode(str(inst)))   return False   except util.Abort, inst: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e))   qtlib.ErrorMsgBox(_('Error executing init'), - _('Error when creating repository'), - hglib.tounicode(str(inst))) + _('Error when creating repository'), err)   return False   except:   import traceback
 
335
336
337
338
 
339
 
 
 
 
 
 
 
340
341
342
343
344
345
346
 
347
 
 
 
 
 
 
 
348
349
350
 
335
336
337
 
338
339
340
341
342
343
344
345
346
347
348
349
350
351
 
 
352
353
354
355
356
357
358
359
360
361
362
363
@@ -335,16 +335,29 @@
  else:   wctx = self.repo[None]   wctx.status(**stopts) - except (OSError, IOError, util.Abort), e: + except (OSError, IOError), e:   self.showMessage.emit(hglib.tounicode(str(e))) + except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + self.showMessage.emit(err)   try:   wctx.dirtySubrepos = []   for s in wctx.substate:   if wctx.sub(s).dirty():   wctx.dirtySubrepos.append(s) - except (OSError, IOError, util.Abort, - error.RepoLookupError, error.ConfigError), e: + except (OSError, IOError, error.RepoLookupError, error.ConfigError), e:   self.showMessage.emit(hglib.tounicode(str(e))) + except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + self.showMessage.emit(err)   self.wctx = wctx   self.patchecked = patchecked  
 
273
274
275
 
 
276
277
278
 
273
274
275
276
277
278
279
280
@@ -273,6 +273,8 @@
  self.ret = dispatch._dispatch(ui, self.cmdline) or 0   except util.Abort, e:   ui.write_err(local._('abort: ') + str(e) + '\n') + if e.hint: + ui.write_err(local._('hint: ') + str(e.hint) + '\n')   except (error.RepoError, urllib2.HTTPError), e:   ui.write_err(str(e) + '\n')   except (Exception, OSError, IOError), e:
 
110
111
112
113
114
 
 
 
 
 
 
 
 
 
 
115
116
 
 
117
118
119
 
110
111
112
 
 
113
114
115
116
117
118
119
120
121
122
123
 
124
125
126
127
128
@@ -110,10 +110,19 @@
  elif notify:   wfiles = [repo.wjoin(x) for x in files]   shlib.shell_notify(wfiles) - except (util.Abort, IOError, OSError), e: - QMessageBox.critical(parent, name + _(' Aborted'), str(e)) + except (IOError, OSError), e: + err = hglib.tounicode(str(e)) + QMessageBox.critical(parent, name + _(' Aborted'), err) + except util.Abort, e: + if e.hint: + err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), + hglib.tounicode(e.hint)) + else: + err = hglib.tounicode(str(e)) + QMessageBox.critical(parent, name + _(' Aborted'), err)   except (error.LookupError), e: - QMessageBox.critical(parent, name + _(' Aborted'), str(e)) + err = hglib.tounicode(str(e)) + QMessageBox.critical(parent, name + _(' Aborted'), err)   except NotImplementedError:   QMessageBox.critical(parent, name + _(' not implemented'),   'Please add it :)')