Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

history: add "Accept/Reject Bundle" menu items to "Synchronize" menu

Useful for when the toolbar is hidden.

I'm using the term "Bundle" because the window title shows "Bundle Preview"
in that state.

Changeset 9b947bdf4a98

Parent c5cf8d6ce1e9

by Adrian Buehlmann

Changes to one file · Browse files at 9b947bdf4a98 Showing diff from parent c5cf8d6ce1e9 Diff from another changeset...

 
185
186
187
 
 
 
 
 
 
 
188
189
190
 
1025
1026
1027
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
 
1087
1088
1089
1090
 
1091
1092
1093
 
1116
1117
1118
1119
1120
 
 
1121
1122
1123
 
 
 
1124
1125
 
1126
1127
1128
1129
1130
 
1131
1132
1133
1134
 
1135
1136
1137
 
185
186
187
188
189
190
191
192
193
194
195
196
197
 
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1083
1084
1085
 
1097
1098
1099
 
1100
1101
1102
1103
 
1126
1127
1128
 
 
1129
1130
1131
1132
1133
1134
1135
1136
1137
 
1138
1139
1140
1141
1142
 
1143
1144
1145
1146
 
1147
1148
1149
1150
@@ -185,6 +185,13 @@
  dict(text=_('Push'), func=self.push_clicked),   dict(text=_('Email...'), func=self.email_clicked),   dict(text='----'), + dict(text=_('Accept Bundle'), name='accept', + sensitive=bool(self.bfile), + func=self.apply_clicked, icon=gtk.STOCK_APPLY), + dict(text=_('Reject Bundle'), name='reject', + sensitive=bool(self.bfile), + func=self.reject_clicked, icon=gtk.STOCK_DIALOG_ERROR), + dict(text='----'),   dict(name='use-proxy-server', text=_('Use proxy server'),   ascheck=True, func=toggle_proxy),   dict(text=_('Force push'), ascheck=True, func=toggle_force), @@ -1025,51 +1032,54 @@
  def get_extras(self):   return self.stbar   + def apply_clicked(self, button): + ppullcombo, ppulldata = self.ppullcombo, self.ppulldata + sel = ppullcombo.get_active_text() + ppull = [name for (name, label) in ppulldata if sel == label][0] + if ppull == 'fetch': + cmd = ['fetch', '--message', 'merge'] + # load the fetch extension explicitly + extensions.load(self.ui, 'fetch', None) + else: + cmd = ['pull'] + if ppull == 'update': + cmd.append('--update') + elif ppull == 'rebase': + cmd.append('--rebase') + # load the rebase extension explicitly + extensions.load(self.ui, 'rebase', None) + + cmdline = ['hg'] + cmd + [self.bfile] + dlg = hgcmd.CmdDialog(cmdline) + dlg.show_all() + dlg.run() + dlg.hide() + self.remove_overlay('--rebase' in cmd) + + def remove_overlay(self, resettip): + self.bfile = None + self.npreviews = 0 + self.urlcombo.set_active(self.origurl) + self.repo = hg.repository(self.ui, path=self.repo.root) + self.graphview.set_repo(self.repo, self.stbar) + self.changeview.repo = self.repo + self.changeview.bfile = None + if resettip: + self.origtip = len(self.repo) + self.reload_log() + self.toolbar.remove(self.toolbar.get_nth_item(0)) + self.toolbar.remove(self.toolbar.get_nth_item(0)) + self.enable_cmd('accept', False) + self.enable_cmd('reject', False) + for w in self.incoming_disabled: + w.set_sensitive(True) + + def reject_clicked(self, button): + self.remove_overlay(False) +   def incoming_clicked(self, toolbutton):   ppullcombo, ppulldata = self.ppullcombo, self.ppulldata   - def apply_clicked(button, bfile): - sel = ppullcombo.get_active_text() - ppull = [name for (name, label) in ppulldata if sel == label][0] - if ppull == 'fetch': - cmd = ['fetch', '--message', 'merge'] - # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) - else: - cmd = ['pull'] - if ppull == 'update': - cmd.append('--update') - elif ppull == 'rebase': - cmd.append('--rebase') - # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) - - cmdline = ['hg'] + cmd + [bfile] - dlg = hgcmd.CmdDialog(cmdline) - dlg.show_all() - dlg.run() - dlg.hide() - remove_overlay('--rebase' in cmd) - - def reject_clicked(button): - remove_overlay(False) - - def remove_overlay(resettip): - self.bfile = None - self.npreviews = 0 - self.urlcombo.set_active(origurl) - self.repo = hg.repository(self.ui, path=self.repo.root) - self.graphview.set_repo(self.repo, self.stbar) - self.changeview.repo = self.repo - self.changeview.bfile = None - if resettip: - self.origtip = len(self.repo) - self.reload_log() - self.toolbar.remove(self.toolbar.get_nth_item(0)) - self.toolbar.remove(self.toolbar.get_nth_item(0)) - for w in disabled: - w.set_sensitive(True) -   def cleanup():   try:   shutil.rmtree(self.bundledir) @@ -1087,7 +1097,7 @@
  self.bundledir = tempfile.mkdtemp(prefix='thg-incoming-')   atexit.register(cleanup)   - origurl = self.urlcombo.get_active() + self.origurl = self.urlcombo.get_active()   bfile = path   for badchar in (':', '*', '\\', '?', '#'):   bfile = bfile.replace(badchar, '') @@ -1116,22 +1126,25 @@
  reject.set_label(_('Reject'))   reject.show()   - apply.connect('clicked', apply_clicked, bfile) - reject.connect('clicked', reject_clicked) + apply.connect('clicked', self.apply_clicked) + reject.connect('clicked', self.reject_clicked)     self.toolbar.insert(reject, 0)   self.toolbar.insert(apply, 0) + + self.enable_cmd('accept', True) + self.enable_cmd('reject', True)   - disabled = [] + self.incoming_disabled = []   for cmd in ('refresh', 'synchronize', 'mq'):   tb = self.get_toolbutton(cmd)   if tb:   tb.set_sensitive(False) - disabled.append(tb) + self.incoming_disabled.append(tb)   def disable_child(w):   if w != self.ppullcombo and w.get_property('sensitive'):   w.set_sensitive(False) - disabled.append(w) + self.incoming_disabled.append(w)   self.syncbox.foreach(disable_child)     self.bfile = bfile