Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

thgimport: add combo to select the destination

To invalidate with mq correctly, it must call
hglib.invalidaterepo() instead of repo.invalidate().

Changeset e1d1d0df457a

Parent cbe009b2220f

by Yuki KODAMA

Changes to one file · Browse files at e1d1d0df457a Showing diff from parent cbe009b2220f Diff from another changeset...

 
7
8
9
 
10
11
12
 
18
19
20
 
 
 
21
22
23
 
64
65
66
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
69
70
 
85
86
87
 
 
 
 
 
88
89
90
 
169
170
171
172
 
173
174
175
176
 
177
178
179
 
195
196
197
 
 
 
 
198
199
200
 
230
231
232
233
 
 
 
 
 
 
234
235
236
 
7
8
9
10
11
12
13
 
19
20
21
22
23
24
25
26
27
 
68
69
70
 
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
 
103
104
105
106
107
108
109
110
111
112
113
 
192
193
194
 
195
196
197
198
199
200
201
202
203
 
219
220
221
222
223
224
225
226
227
228
 
258
259
260
 
261
262
263
264
265
266
267
268
269
@@ -7,6 +7,7 @@
   import os  import gtk +import gobject    from mercurial import hg, ui   @@ -18,6 +19,9 @@
 MODE_NORMAL = 'normal'  MODE_WORKING = 'working'   +DEST_ID = 0 +DEST_LABEL = 1 +  class ImportDialog(gtk.Dialog):   """ Dialog to import patches """   @@ -64,7 +68,21 @@
    ## info label   self.infolbl = createlabel() - table.add_row(_('Preview:'), self.infolbl, padding=False) + self.infobox = gtk.HBox() + self.infobox.pack_start(self.infolbl, False, False) + table.add_row(_('Preview:'), self.infobox, padding=False) + + ## dest combo + self.dest_model = gtk.ListStore(gobject.TYPE_STRING, # dest id + gobject.TYPE_STRING) # dest label + for row in {'repo': _('Repository'), + 'mq': _('Patch Queue')}.items(): + self.dest_model.append(row) + self.dest_combo = gtk.ComboBox(self.dest_model) + cell = gtk.CellRendererText() + self.dest_combo.pack_start(cell, True) + self.dest_combo.add_attribute(cell, 'text', DEST_LABEL) + self.dest_combo.set_active(0)     ## patch preview   self.cslist = cslist.ChangesetList() @@ -85,6 +103,11 @@
  gtklib.idle_add_single_call(self.after_init)     def after_init(self): + # dest combo + self.dest_combo.show_all() + self.dest_combo.hide() + self.infobox.pack_start(self.dest_combo, False, False, 6) +   # CmdWidget   self.cmd = hgcmd.CmdWidget()   self.cmd.show_all() @@ -169,11 +192,12 @@
  def update_status(self, count):   if count:   info = _('<span weight="bold">%s patches</span> will' - ' be imported') % count + ' be imported to the') % count   else:   info = '<span weight="bold" foreground="#880000">%s</span>' \   % _('Nothing to import')   self.infolbl.set_markup(info) + self.dest_combo.set_property('visible', bool(count))   self.importbtn.set_sensitive(bool(count))     def get_filepaths(self): @@ -195,6 +219,10 @@
  files.append(path)   return files   + def get_dest(self): + iter = self.dest_combo.get_active_iter() + return self.dest_model.get(iter, DEST_ID)[0] +   def preview(self, queue=False):   files = self.get_filepaths()   if files: @@ -230,7 +258,12 @@
  files = [file for file, sel in items if sel]   if not files:   return - cmdline = ['hg', 'import', '--verbose'] + + if 'repo' == self.get_dest(): + cmd = 'import' + else: + cmd = 'qimport' + cmdline = ['hg', cmd, '--verbose']   cmdline.extend(files)     def cmd_done(returncode, useraborted):