Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.4rc1, 0.4rc2, and 0.4rc3

hggtk/clone: remember only ten most-recent src & dest paths

Changeset 2326651b2694

Parent cdbb0252bbd9

by TK Soh

Changes to one file · Browse files at 2326651b2694 Showing diff from parent cdbb0252bbd9 Diff from another changeset...

Change 1 of 3 Show Entire File hggtk/​clone.py Stacked
 
20
21
22
 
 
23
24
25
 
222
223
224
225
 
 
 
 
 
 
 
 
 
 
226
227
228
229
230
231
232
233
234
235
 
 
236
237
238
239
240
241
242
243
244
 
245
246
247
 
249
250
251
252
253
254
255
256
 
 
257
258
259
260
261
262
263
264
265
 
266
267
268
 
20
21
22
23
24
25
26
27
 
224
225
226
 
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
 
 
242
243
 
244
245
246
247
248
249
250
251
 
 
 
252
253
254
255
 
257
258
259
 
 
260
261
 
262
263
264
265
266
267
268
269
 
 
 
270
271
272
273
@@ -20,6 +20,8 @@
 from mercurial.node import *  import shlib   +HistorySize = 10 +  class CloneDialog(gtk.Window):   """ Dialog to add tag to Mercurial repo """   def __init__(self, cwd='', repos=[]): @@ -222,26 +224,32 @@
  rev = histselect.select(self.root)   if rev is not None:   self._rev_input.set_text(rev) - + + def _update_setting_list(self, key, path): + paths = self._settings.get(key, []) + if path in paths: + paths.remove(path) + paths.append(path) + while len(paths) > HistorySize: + del paths[0] + self._settings[key] = paths +   def _add_src_to_recent(self, src):   if os.path.exists(src):   src = os.path.abspath(src)     srclist = [x[0] for x in self._srclist] - if src in srclist: - return     # update drop-down list - srclist.append(src) + if src not in srclist: + srclist.append(src)   srclist.sort()   self._srclist.clear()   for p in srclist:   self._srclist.append([p])     # save path to recent list in history - if not 'src_paths' in self._settings: - self._settings['src_paths'] = [] - self._settings['src_paths'].append(src) + self._update_setting_list('src_paths', src)   self._settings.write()     def _add_dest_to_recent(self, dest): @@ -249,20 +257,17 @@
  dest = os.path.abspath(dest)     destlist = [x[0] for x in self._destlist] - if dest in destlist: - return     # update drop-down list - destlist.append(dest) + if dest not in destlist: + destlist.append(dest)   destlist.sort()   self._destlist.clear()   for p in destlist:   self._destlist.append([p])     # save path to recent list in history - if not 'dest_paths' in self._settings: - self._settings['dest_paths'] = [] - self._settings['dest_paths'].append(dest) + self._update_setting_list('dest_paths', dest)   self._settings.write()     def _btn_clone_clicked(self, toolbutton, data=None):