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

commit: add a history for usernames used in commits

Changeset 5c7a41e4670b

Parent 7489c15e6671

by Steve Borho

Changes to one file · Browse files at 5c7a41e4670b Showing diff from parent 7489c15e6671 Diff from another changeset...

 
26
27
28
29
30
31
32
 
64
65
66
67
68
69
70
71
72
73
74
75
 
338
339
340
341
 
342
 
 
343
344
345
 
354
355
356
 
357
358
359
 
368
369
370
371
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
373
374
 
430
431
432
433
434
435
436
 
 
437
438
439
 
26
27
28
 
29
30
31
 
63
64
65
 
 
 
 
 
 
66
67
68
 
331
332
333
 
334
335
336
337
338
339
340
 
349
350
351
352
353
354
355
 
364
365
366
 
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
 
450
451
452
 
 
 
 
453
454
455
456
457
@@ -26,7 +26,6 @@
 # qtlib decode failure dialog (ask for retry locale, suggest HGENCODING)  # Need a unicode-to-UTF8 function  # +1 / -1 head indication (not as important with workbench integration) -# recent committers history  # pushafterci list  # qnew/shelve-patch creation dialog (in another file)  # spell check / tab completion @@ -64,12 +63,6 @@
    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: - pass     self.commitButton = b = QPushButton(_('Commit'))   if hidebutton: @@ -338,8 +331,10 @@
  # message history is stored in unicode   self.split.restoreState(s.value('commit/split').toByteArray())   self.msghistory = list(s.value('commit/history-'+repoid).toStringList()) - self.msghistory = [s for s in self.msghistory if s] + self.msghistory = [m for m in self.msghistory if m]   self.msgcombo.reset(self.msghistory) + self.userhist = s.value('commit/userhist').toStringList() + self.refreshUserList()   try:   curmsg = repo.opener('cur-message.txt').read()   self.msgte.setPlainText(hglib.fromunicode(curmsg)) @@ -354,6 +349,7 @@
  repoid = str(repo[0])   s.setValue('commit/history-'+repoid, self.msghistory)   s.setValue('commit/split', self.split.saveState()) + s.setValue('commit/userhist', self.userhist)   try:   # current message is stored in local encoding   repo.opener('cur-message.txt', 'w').write(self.getMessage()) @@ -368,7 +364,31 @@
  self.msghistory.remove(umsg)   self.msghistory.insert(0, umsg)   self.msghistory = self.msghistory[:10] - self.msgcombo.reset(self.msghistory) + + def refreshUserList(self): + l = [] + try: + repo = self.stwidget.repo + wctx = repo[None] + if self.opts.get('user'): + val = hglib.tounicode(self.opts['user']) + l.append(val) + val = hglib.tounicode(wctx.user()) + l.append(val) + except util.Abort: + pass + for name in self.userhist: + if name not in l: + l.append(name) + for name in l: + self.usercombo.addItem(name) + + def addUsernameToHistory(self, user): + if user in self.userhist: + self.userhist.remove(user) + self.userhist.insert(0, user) + self.userhist = self.userhist[:10] + self.refreshUserList()     def commit(self):   repo = self.stwidget.repo @@ -430,10 +450,8 @@
  self.stwidget.tv.setFocus()   return   user = self.usercombo.currentText() - try: - user = hglib.fromunicode(user, 'strict') - except UnicodeEncodeError: - pass # TODO + self.addUsernameToHistory(user) + user = hglib.fromunicode(user, 'strict')   if not user:   try:   QMessageBox.information(self, _('Please enter a username'),