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

thgstrip: support strip options

Changeset 5354986bf2aa

Parent f012073c2d46

by Yuki KODAMA

Changes to one file · Browse files at 5354986bf2aa Showing diff from parent f012073c2d46 Diff from another changeset...

 
114
115
116
 
 
 
 
 
 
 
 
 
117
118
119
 
123
124
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
127
128
 
266
267
268
 
 
 
 
 
 
269
270
271
 
302
303
304
305
306
307
308
309
310
311
312
313
314
315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
317
318
 
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
 
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
 
292
293
294
295
296
297
298
299
300
301
302
303
 
334
335
336
 
 
 
 
 
 
 
 
 
 
 
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
@@ -114,6 +114,15 @@
  rview.add_with_viewport(self.resultbox)   rview.child.set_shadow_type(gtk.SHADOW_NONE)   + ## options + self.expander = gtk.Expander(_('Options:')) + self.expander.connect('notify::expanded', self.options_expanded) + + ### force option (fixed) + self.forceopt = gtk.CheckButton(_('Discard local changes, no backup' + ' (-f/--force)')) + table.add_row(self.expander, self.forceopt) +   # prepare to show   self.preview()   self.stripbtn.grab_focus() @@ -123,6 +132,23 @@
  # add 'Show all' button   self.pstatbox.pack_start(self.allbtn, False, False, 4)   + # backup types (foldable) + self.butable = gtklib.LayoutTable() + self.vbox.pack_start(self.butable, True, True) + def add_type(desc): + group = hasattr(self, 'buopt_all') and self.buopt_all or None + radio = gtk.RadioButton(group, desc) + self.butable.add_row(None, radio, ypad=0) + return radio + self.buopt_all = add_type(_('Backup all (default)')) + self.buopt_part = add_type(_('Backup unrelated changesets' + ' (-b/--backup)')) + self.buopt_none = add_type(_('No backup (-n/--nobackup)')) + + # layout group + layout = gtklib.LayoutGroup() + layout.add(self.table, self.butable, force=True) +   # CmdWidget   self.cmd = hgcmd.CmdWidget()   self.cmd.show_all() @@ -266,6 +292,12 @@
    self.run() # don't close dialog   + def options_expanded(self, expander, *args): + if expander.get_expanded(): + self.butable.show_all() + else: + self.butable.hide() +   def get_rev(self):   """ Return integer revision number or None """   revstr = self.revcombo.get_active_text() @@ -302,17 +334,28 @@
  return not (wc.modified() or wc.added() or wc.removed())   revstr = self.revcombo.get_active_text()   cmdline = ['hg', 'strip', '--verbose', revstr] - # check uncommitted changes - if not isclean(): - ret = gdialog.CustomPrompt(_('Confirm Strip'), - _('Detected uncommitted local changes.\nDo' - ' you want to discard them and continue?'), - self, (_('&Yes (--force)'), _('&No')), - default=1, esc=1).run() - if ret == 0: - cmdline.append('--force') - else: - return + + # local changes + if self.forceopt.get_active(): + cmdline.append('--force') + else: + if not isclean(): + ret = gdialog.CustomPrompt(_('Confirm Strip'), + _('Detected uncommitted local changes.\nDo' + ' you want to discard them and continue?'), + self, (_('&Yes (--force)'), _('&No')), + default=1, esc=1).run() + if ret == 0: + cmdline.append('--force') + else: + return + + # backup options + if self.buopt_part.get_active(): + cmdline.append('--backup') + elif self.buopt_none.get_active(): + cmdline.append('--nobackup') +   def cmd_done(returncode, useraborted):   self.switch_to(MODE_NORMAL, cmd=False)   if returncode == 0: