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: introduce "Add Bundle..." command

This allows to explicitly set the overlay bundle file, using an open
file dialog.

Use case: import from an overlay bundle file someone has sent.

Implemented by reusing parts of the existing "hg incoming into bundle"
code.

Changeset 54e0c2ef8013

Parent ef0b94f0c420

by Adrian Buehlmann

Changes to one file · Browse files at 54e0c2ef8013 Showing diff from parent ef0b94f0c420 Diff from another changeset...

 
188
189
190
 
 
 
191
192
193
 
1074
1075
1076
 
1077
1078
1079
 
1114
1115
1116
1117
 
1118
1119
1120
1121
1122
1123
1124
 
 
1125
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
1151
 
 
 
 
 
 
1152
1153
1154
1155
1156
1157
1158
1159
1160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1161
1162
1163
 
188
189
190
191
192
193
194
195
196
 
1077
1078
1079
1080
1081
1082
1083
 
1118
1119
1120
 
1121
1122
 
 
 
 
 
 
1123
1124
1125
 
 
 
 
 
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
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
@@ -188,6 +188,9 @@
  dict(text=_('Push'), func=self.push_clicked),   dict(text=_('Email...'), func=self.email_clicked),   dict(text='----'), + dict(text=_('Add Bundle...'), name='add-bundle', + sensitive=not bool(self.bfile), + func=self.add_bundle_clicked),   dict(text=_('Accept Bundle'), name='accept',   sensitive=bool(self.bfile),   func=self.apply_clicked, icon=gtk.STOCK_APPLY), @@ -1074,6 +1077,7 @@
  self.toolbar.remove(self.toolbar.get_nth_item(0))   self.cmd_set_sensitive('accept', False)   self.cmd_set_sensitive('reject', False) + self.cmd_set_sensitive('add-bundle', True)   for w in self.incoming_disabled:   w.set_sensitive(True)   @@ -1114,50 +1118,61 @@
  dlg.run()   dlg.hide()   if dlg.return_code() == 0 and os.path.isfile(bfile): - self.pathentry.set_text(bfile) + self.set_bundlefile(bfile)   - # create apply/reject toolbar buttons - apply = gtk.ToolButton(gtk.STOCK_APPLY) - apply.set_tooltip(self.tooltips, - _('Accept incoming previewed changesets')) - apply.set_label(_('Accept')) - apply.show() + def set_bundlefile(self, bfile): + self.pathentry.set_text(bfile)   - reject = gtk.ToolButton(gtk.STOCK_DIALOG_ERROR) - reject.set_tooltip(self.tooltips, - _('Reject incoming previewed changesets')) - reject.set_label(_('Reject')) - reject.show() + # create apply/reject toolbar buttons + apply = gtk.ToolButton(gtk.STOCK_APPLY) + apply.set_tooltip(self.tooltips, + _('Accept incoming previewed changesets')) + apply.set_label(_('Accept')) + apply.show()   - apply.connect('clicked', self.apply_clicked) - reject.connect('clicked', self.reject_clicked) + reject = gtk.ToolButton(gtk.STOCK_DIALOG_ERROR) + reject.set_tooltip(self.tooltips, + _('Reject incoming previewed changesets')) + reject.set_label(_('Reject')) + reject.show()   - self.toolbar.insert(reject, 0) - self.toolbar.insert(apply, 0) - - self.cmd_set_sensitive('accept', True) - self.cmd_set_sensitive('reject', True) + apply.connect('clicked', self.apply_clicked) + reject.connect('clicked', self.reject_clicked)   - self.incoming_disabled = [] - for cmd in ('refresh', 'synchronize', 'mq'): - tb = self.get_toolbutton(cmd) - if tb: - tb.set_sensitive(False) - self.incoming_disabled.append(tb) - def disable_child(w): - if w != self.ppullcombo and w.get_property('sensitive'): - w.set_sensitive(False) - self.incoming_disabled.append(w) - self.syncbox.foreach(disable_child) + self.toolbar.insert(reject, 0) + self.toolbar.insert(apply, 0) + + self.cmd_set_sensitive('accept', True) + self.cmd_set_sensitive('reject', True) + self.cmd_set_sensitive('add-bundle', False)   - self.bfile = bfile - oldtip = len(self.repo) - self.repo = hg.repository(self.ui, path=bfile) - self.graphview.set_repo(self.repo, self.stbar) - self.changeview.repo = self.repo - self.changeview.bfile = bfile - self.npreviews = len(self.repo) - oldtip - self.reload_log() + self.incoming_disabled = [] + for cmd in ('refresh', 'synchronize', 'mq'): + tb = self.get_toolbutton(cmd) + if tb: + tb.set_sensitive(False) + self.incoming_disabled.append(tb) + def disable_child(w): + if w != self.ppullcombo and w.get_property('sensitive'): + w.set_sensitive(False) + self.incoming_disabled.append(w) + self.syncbox.foreach(disable_child) + + self.bfile = bfile + oldtip = len(self.repo) + self.repo = hg.repository(self.ui, path=bfile) + self.graphview.set_repo(self.repo, self.stbar) + self.changeview.repo = self.repo + self.changeview.bfile = bfile + self.npreviews = len(self.repo) - oldtip + self.reload_log() + + def add_bundle_clicked(self, button): + result = gtklib.NativeSaveFileDialogWrapper( + title=_('Open Bundle'), open=True).run() + if result: + self.origurl = self.urlcombo.get_active() + self.set_bundlefile(result)     def pull_clicked(self, toolbutton):   ppullcombo, ppulldata = self.ppullcombo, self.ppulldata