Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.1, 1.1.1, and 1.1.2

Merge with stable

Changeset 691bd7e30f06

Parents 104e7441e988

Parents 66c16fa056e0

by Yuki KODAMA

Changes to one file · Browse files at 691bd7e30f06 Showing diff from parent 104e7441e988 66c16fa056e0 Diff from another changeset...

 
550
551
552
 
 
 
553
554
555
 
607
608
609
 
610
611
612
 
687
688
689
690
691
692
693
694
695
 
696
697
698
 
704
705
706
707
708
709
710
711
 
 
 
 
 
 
 
 
 
 
 
 
712
713
714
715
716
 
717
718
719
 
735
736
737
738
 
739
740
741
 
752
753
754
755
 
756
757
758
 
770
771
772
773
 
774
775
776
 
1268
1269
1270
1271
 
1272
1273
1274
 
1328
1329
1330
1331
 
1332
1333
1334
 
550
551
552
553
554
555
556
557
558
 
610
611
612
613
614
615
616
 
691
692
693
 
 
694
695
696
 
697
698
699
700
 
706
707
708
 
 
 
 
 
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
 
725
726
727
728
 
744
745
746
 
747
748
749
750
 
761
762
763
 
764
765
766
767
 
779
780
781
 
782
783
784
785
 
1277
1278
1279
 
1280
1281
1282
1283
 
1337
1338
1339
 
1340
1341
1342
1343
@@ -550,6 +550,9 @@
  ret += netloc + '/' + folder   return ret   +CONF_GLOBAL = 0 +CONF_REPO = 1 +  class ConfigDialog(gtk.Dialog):   def __init__(self, configrepo=False, focus=None):   """ Initialize the Dialog. """ @@ -607,6 +610,7 @@
  if repo:   combo.append_text(_('%s repository settings') % hglib.toutf(name))   combo.connect('changed', self.fileselect) + self.confcombo = combo     hbox = gtk.HBox()   hbox.pack_start(combo, False, False) @@ -687,12 +691,10 @@
  descframe.add(scrolled)   self.descbuffer = desctext.get_buffer()   - self.configrepo = configrepo -   # Force dialog into clean state in the beginning   self._btn_apply.set_sensitive(False)   self.dirty = False - combo.set_active(configrepo and 1 or 0) + combo.set_active(configrepo and CONF_REPO or CONF_GLOBAL)     # focus 'general' page or specified field   if focus: @@ -704,16 +706,23 @@
  def fileselect(self, combo):   'select another hgrc file'   if self.dirty: - ret = gdialog.Confirm(_('Unapplied changes'), [], self, - _('Lose changes and switch files?.')).run() - if ret != gtk.RESPONSE_YES: - return - self.configrepo = combo.get_active() and True or False + ret = gdialog.CustomPrompt(_('Confirm Switch'), + _('Switch after saving changes?'), self, + (_('&Save'), _('&Discard'), _('&Cancel')), + default=2, esc=2).run() + if ret == 2: + combo.handler_block_by_func(self.fileselect) + repo = combo.get_active() == CONF_GLOBAL + combo.set_active(repo and CONF_REPO or CONF_GLOBAL) + combo.handler_unblock_by_func(self.fileselect) + return + elif ret == 0: + self.apply_changes()   self.refresh()     def refresh(self):   # determine target config file - if self.configrepo: + if self.confcombo.get_active() == CONF_REPO:   repo = hg.repository(ui.ui(), self.root)   name = hglib.get_reponame(repo)   self.rcpath = [os.sep.join([repo.root, '.hg', 'hgrc'])] @@ -735,7 +744,7 @@
    def edit_clicked(self, button):   # reload configs, in case they have been written since opened - if self.configrepo: + if self.confcombo.get_active() == CONF_REPO:   repo = hg.repository(ui.ui(), self.root)   u = repo.ui   else: @@ -752,7 +761,7 @@
    def should_live(self, dialog=None, resp=None):   if resp == gtk.RESPONSE_APPLY: - self._apply_clicked() + self.apply_changes()   self.emit_stop_by_name('response')   return True   elif resp == gtk.RESPONSE_CANCEL: @@ -770,7 +779,7 @@
  self.emit_stop_by_name('response')   return True   elif ret == 0: - self._apply_clicked() + self.apply_changes()   return False     def cursor_changed(self, treeview): @@ -1268,7 +1277,7 @@
  # Try to create a file from rcpath   try:   f = open(fn, 'w') - f.write(_('# Generated by tortoisehg-config\n')) + f.write('# Generated by TortoiseHg setting dialog\n')   f.close()   break   except (IOError, OSError): @@ -1328,7 +1337,7 @@
  self.history.get_value(cpath).remove(newvalue)   self.history.mrul(cpath).add(newvalue)   - def _apply_clicked(self, *args): + def apply_changes(self):   if self.readonly:   #dialog? Read only access, please install ...   return