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

commit: introduce 'push after commit' setting

Instead of a bool, ala hgtk ci, the configuration is now an alias or
URL. The setting is currently ignored - I plan to switch the commit
tool to use a cmdui.Runner that is optionally connected to the workbench
log widget.

Changeset 0b422a275a2f

Parent f1a171ba9fea

by Steve Borho

Changes to 2 files · Browse files at 0b422a275a2f Showing diff from parent f1a171ba9fea Diff from another changeset...

 
14
15
16
17
 
18
19
20
 
21
22
23
24
25
26
27
28
29
30
31
 
47
48
49
 
 
50
51
52
 
557
558
559
 
560
561
562
 
669
670
671
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
672
 
673
674
675
 
690
691
692
693
694
695
696
 
697
698
699
 
712
713
714
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
715
716
717
 
730
731
732
733
734
735
736
 
740
741
742
 
 
 
 
 
 
743
744
745
 
14
15
16
 
17
18
19
20
21
22
23
24
25
26
27
 
 
28
29
30
 
46
47
48
49
50
51
52
53
 
558
559
560
561
562
563
564
 
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
 
715
716
717
 
718
719
 
720
721
722
723
 
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
 
777
778
779
 
780
781
782
 
786
787
788
789
790
791
792
793
794
795
796
797
@@ -14,18 +14,17 @@
 from PyQt4.QtGui import *    from tortoisehg.hgqt.i18n import _ -from tortoisehg.util import hglib, shlib, paths +from tortoisehg.util import hglib, shlib, paths, wconfig  from tortoisehg.util.util import format_desc    from tortoisehg.hgqt import qtlib, status, cmdui, branchop +from tortoisehg.hgqt.sync import loadIniFile    # Technical Debt for CommitWidget  # threaded / wrapped commit (need a CmdRunner equivalent)  # 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) -# pushafterci list -# qnew/shelve-patch creation dialog (in another file)  # spell check / tab completion  # in-memory patching / committing chunk selected files   @@ -47,6 +46,8 @@
  self.stwidget.loadComplete.connect(lambda: self.loadComplete.emit())   self.msghistory = []   self.qref = False + self.opts['pushafter'] = self.stwidget.repo.ui.config('tortoisehg', + 'cipushafter', '')     layout = QVBoxLayout()   layout.setContentsMargins(0, 0, 0, 0) @@ -557,6 +558,7 @@
  if fname:   cmdline.extend(['--include', fname])   + # TODO: self.opts['pushafter']   ret = dispatch._dispatch(_ui, cmdline)   if not ret:   self.addMessageToHistory() @@ -669,7 +671,30 @@
  hbox.addWidget(curdate)   layout.addLayout(hbox)   + # pushafterci + hbox = QHBoxLayout() + self.pushaftercb = QCheckBox(_('Push After Commit:')) + self.pushafterle = QLineEdit() + self.pushafterle.setEnabled(False) + self.pushaftercb.toggled.connect(self.pushafterle.setEnabled) + + pushaftersave = QPushButton(_('Save in Repo')) + pushaftersave.clicked.connect(self.savePushAfter) + pushaftersave.setEnabled(False) + self.pushaftercb.toggled.connect(pushaftersave.setEnabled) + + if opts.get('pushafter'): + val = hglib.tounicode(opts['pushafter']) + self.pushafterle.setText(val) + self.pushaftercb.setChecked(True) + + hbox.addWidget(self.pushaftercb) + hbox.addWidget(self.pushafterle) + hbox.addWidget(pushaftersave) + layout.addLayout(hbox) +   if 'mq' in self.repo.extensions(): + # qnew/shelve-patch creation dialog (in another file)   hbox = QHBoxLayout()     BB = QDialogButtonBox @@ -690,10 +715,9 @@
  self.saveToPath(util.user_rcpath())     def saveToPath(self, path): - from tortoisehg.hgqt.sync import loadIniFile   fn, cfg = loadIniFile(path, self)   if not hasattr(cfg, 'write'): - qtlib.WarningMsgBox(_('Unable to save post pull operation'), + qtlib.WarningMsgBox(_('Unable to save username'),   _('Iniparse must be installed.'), parent=self)   return   if fn is None: @@ -712,6 +736,29 @@
  qtlib.WarningMsgBox(_('Unable to write configuration file'),   hglib.tounicode(e), parent=self)   + def savePushAfter(self): + path = os.path.join(self.repo.root, '.hg', 'hgrc') + fn, cfg = loadIniFile([path], self) + if not hasattr(cfg, 'write'): + qtlib.WarningMsgBox(_('Unable to save after commit push'), + _('Iniparse must be installed.'), parent=self) + return + if fn is None: + return + try: + remote = hglib.fromunicode(self.pushafterle.text()) + if remote: + cfg.set('tortoisehg', 'cipushafter', remote) + else: + try: + del cfg['tortoisehg']['cipushafter'] + except KeyError: + pass + wconfig.writefile(cfg, fn) + except IOError, e: + qtlib.WarningMsgBox(_('Unable to write configuration file'), + hglib.tounicode(e), parent=self) +   def accept(self):   outopts = {}   if self.datecb.isChecked(): @@ -730,7 +777,6 @@
  user = hglib.fromunicode(self.usercombo.currentText())   else:   user = '' -   outopts['user'] = user   if not user:   try: @@ -740,6 +786,12 @@
  hglib.tounicode(e), parent=self)   return   + if self.pushaftercb.isChecked(): + remote = hglib.fromunicode(self.pushafterle.text()) + outopts['pushafter'] = remote + else: + outopts['pushafter'] = '' +   self.outopts = outopts   QDialog.accept(self)  
 
327
328
329
330
331
332
 
 
 
333
334
335
 
327
328
329
 
 
 
330
331
332
333
334
335
@@ -327,9 +327,9 @@
  (_('Close After Commit'), 'tortoisehg.closeci', genBoolCombo,   _('Close the commit tool after every successful'   ' commit. Default: False')), - (_('Push After Commit'), 'tortoisehg.pushafterci', genBoolCombo, - _('Attempt to push to default push target after every successful' - ' commit. Default: False')), + (_('Push After Commit'), 'tortoisehg.cipushafter', genEditCombo, + _('Attempt to push to specified URL or alias after each successful' + ' commit. Default: No push')),   (_('Auto Commit List'), 'tortoisehg.autoinc', genEditCombo,   _('Comma separated list of files that are automatically included'   ' in every commit. Intended for use only as a repository setting.'