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

commit: better fallback logic for a missing username

Changeset e5d57619cb86

Parent 321cb6dd8eda

by Steve Borho

Changes to one file · Browse files at e5d57619cb86 Showing diff from parent 321cb6dd8eda Diff from another changeset...

 
67
68
69
 
70
71
72
73
74
75
76
77
 
78
79
80
81
82
 
255
256
257
258
 
259
260
261
 
310
311
312
313
314
315
316
317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
318
319
320
 
323
324
325
326
 
327
328
329
 
334
335
336
337
 
338
339
340
341
342
 
343
344
345
 
67
68
69
70
71
72
73
74
75
 
 
 
76
77
 
78
79
80
 
253
254
255
 
256
257
258
259
 
308
309
310
 
 
 
 
 
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
 
331
332
333
 
334
335
336
337
 
342
343
344
 
345
346
347
348
349
 
350
351
352
353
@@ -67,16 +67,14 @@
  wctx = repo[None]     usercombo = QComboBox() + usercombo.setEditable(True)   try:   if opts.get('user'):   usercombo.addItem(hglib.tounicode(opts['user']))   usercombo.addItem(hglib.tounicode(wctx.user()))   except util.Abort: - import socket - user = '%s@%s' % (util.getuser(), socket.getfqdn()) - usercombo.addItem(hglib.tounicode(user)) + pass   - usercombo.setEditable(True)   form.addRow(_('Changeset:'), QLabel(_('Working Copy')))   for ctx in repo.parents():   desc = format_desc(ctx.description(), 80) @@ -255,7 +253,7 @@
  finally:   os.chdir(cwd)   - def _commit(self, repo, ui): + def _commit(self, repo, _ui):   msg = self.getMessage()   if not msg:   qtlib.WarningMsgBox(_('Nothing Commited'), @@ -310,11 +308,21 @@
  except UnicodeEncodeError:   pass # TODO   if not user: - qtlib.WarningMsgBox(_('Username required'), - _('Please enter a username'), - parent=self) - self.usercombo.setFocus() - return + try: + QMessageBox.information(self, _('Please enter a username'), + _('You must identify yourself to Mercurial'), + QMessageBox.Ok) + from tortoisehg.hgqt.settings import SettingsDialog + dlg = SettingsDialog(False, focus='ui.username') + dlg.exec_() + user = ui.ui().username() + if user: + self.usercombo.addItem(hglib.tounicode(user)) + except util.Abort: + pass + if not user: + self.usercombo.setFocus() + return   checkedUnknowns = self.stwidget.getChecked('?I')   if checkedUnknowns:   res = qtlib.CustomPrompt( @@ -323,7 +331,7 @@
  (_('&Ok'), ('&Cancel')), 0, 1,   checkedUnknowns).run()   if res == 0: - dispatch._dispatch(ui, ['add'] + checkedUnknowns) + dispatch._dispatch(_ui, ['add'] + checkedUnknowns)   else:   return   checkedMissing = self.stwidget.getChecked('!') @@ -334,12 +342,12 @@
  (_('&Ok'), ('&Cancel')), 0, 1,   checkedMissing).run()   if res == 0: - dispatch._dispatch(ui, ['remove'] + checkedMissing) + dispatch._dispatch(_ui, ['remove'] + checkedMissing)   else:   return   cmdline = ['commit', '--user', user, '--message', msg]   cmdline += brcmd + files - ret = dispatch._dispatch(ui, cmdline) + ret = dispatch._dispatch(_ui, cmdline)   if not ret:   self.addMessageToHistory()   self.msgte.clear()