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 autoinc to details dialog

Changeset 2b53a776c9ce

Parent 0b422a275a2f

by Steve Borho

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

 
46
47
48
49
50
 
 
 
 
51
52
53
 
553
554
555
556
 
557
558
559
 
671
672
673
674
675
676
677
 
693
694
695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
696
697
698
 
759
760
761
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
763
764
 
46
47
48
 
 
49
50
51
52
53
54
55
 
555
556
557
 
558
559
560
561
 
673
674
675
 
676
677
678
 
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
 
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
@@ -46,8 +46,10 @@
  self.stwidget.loadComplete.connect(lambda: self.loadComplete.emit())   self.msghistory = []   self.qref = False - self.opts['pushafter'] = self.stwidget.repo.ui.config('tortoisehg', - 'cipushafter', '') + + repo = self.stwidget.repo + self.opts['pushafter'] = repo.ui.config('tortoisehg', 'cipushafter', '') + self.opts['autoinc'] = repo.ui.config('tortoisehg', 'autoinc', '')     layout = QVBoxLayout()   layout.setContentsMargins(0, 0, 0, 0) @@ -553,7 +555,7 @@
  if self.qref:   cmdline[0] = 'qrefresh'   - for fname in repo.ui.config('tortoisehg', 'autoinc', '').split(','): + for fname in self.opts.get('autoinc', '').split(','):   fname = fname.strip()   if fname:   cmdline.extend(['--include', fname]) @@ -671,7 +673,6 @@
  hbox.addWidget(curdate)   layout.addLayout(hbox)   - # pushafterci   hbox = QHBoxLayout()   self.pushaftercb = QCheckBox(_('Push After Commit:'))   self.pushafterle = QLineEdit() @@ -693,6 +694,27 @@
  hbox.addWidget(pushaftersave)   layout.addLayout(hbox)   + hbox = QHBoxLayout() + self.autoinccb = QCheckBox(_('Auto Includes:')) + self.autoincle = QLineEdit() + self.autoincle.setEnabled(False) + self.autoinccb.toggled.connect(self.autoincle.setEnabled) + + autoincsave = QPushButton(_('Save in Repo')) + autoincsave.clicked.connect(self.saveAutoInc) + autoincsave.setEnabled(False) + self.autoinccb.toggled.connect(autoincsave.setEnabled) + + if opts.get('autoinc'): + val = hglib.tounicode(opts['autoinc']) + self.autoincle.setText(val) + self.autoinccb.setChecked(True) + + hbox.addWidget(self.autoinccb) + hbox.addWidget(self.autoincle) + hbox.addWidget(autoincsave) + layout.addLayout(hbox) +   if 'mq' in self.repo.extensions():   # qnew/shelve-patch creation dialog (in another file)   hbox = QHBoxLayout() @@ -759,6 +781,29 @@
  qtlib.WarningMsgBox(_('Unable to write configuration file'),   hglib.tounicode(e), parent=self)   + def saveAutoInc(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 auto include list'), + _('Iniparse must be installed.'), parent=self) + return + if fn is None: + return + try: + list = hglib.fromunicode(self.autoincle.text()) + if list: + cfg.set('tortoisehg', 'autoinc', list) + else: + try: + del cfg['tortoisehg']['autoinc'] + 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():