Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

thgconfig: check existing aliases before closing PathEditDialog

Changeset 7e4b2e9f7f0e

Parent dac5a99cfb20

by Yuki KODAMA

Changes to one file · Browse files at 7e4b2e9f7f0e Showing diff from parent dac5a99cfb20 Diff from another changeset...

 
217
218
219
220
 
221
222
223
 
226
227
228
 
229
230
231
 
337
338
339
 
 
 
 
 
 
340
341
 
342
343
344
 
581
582
583
584
 
 
585
586
 
 
 
 
 
 
587
588
589
 
633
634
635
636
 
637
638
639
 
217
218
219
 
220
221
222
223
 
226
227
228
229
230
231
232
 
338
339
340
341
342
343
344
345
346
347
 
348
349
350
351
 
588
589
590
 
591
592
593
594
595
596
597
598
599
600
601
602
603
 
647
648
649
 
650
651
652
653
@@ -217,7 +217,7 @@
 class PathEditDialog(gtk.Dialog):   _protocols = ['ssh', 'http', 'https', 'local']   - def __init__(self, path, alias): + def __init__(self, path, alias, list):   gtk.Dialog.__init__(self, parent=None, flags=gtk.DIALOG_MODAL,   buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,   gtk.STOCK_OK, gtk.RESPONSE_OK)) @@ -226,6 +226,7 @@
  self.connect('key-press-event', self.key_press)   self.set_title(_('Edit remote repository path'))   self.newpath, self.newalias = None, None + self.list = list     self.entries = {}   # Tuple: (internal name, translated name) @@ -337,8 +338,14 @@
  if response_id != gtk.RESPONSE_OK:   self.destroy()   return + newalias = self.entries['Alias'][0].get_text() + if newalias in self.list: + ret = gdialog.Confirm(_('Confirm Overwrite'), [], self, + _("Overwirte existing '%s' path?") % newalias).run() + if ret != gtk.RESPONSE_YES: + return   self.newpath = self.buildurl() - self.newalias = self.entries['Alias'][0].get_text() + self.newalias = newalias   self.destroy()     def key_press(self, widget, event): @@ -581,9 +588,16 @@
  if not selection.count_selected_rows():   return   model, path = selection.get_selected() - dialog = PathEditDialog(model[path][2], model[path][0]) + dialog = PathEditDialog(model[path][2], model[path][0], + [p[0] for p in self.pathdata if p[0] != model[path][0]])   dialog.run()   if dialog.newpath: + if model[path][0] != dialog.newalias: + # remove existing path + rows = [row for row in model if row[0] == dialog.newalias] + if len(rows) > 0: + del model[rows[0].iter] + # update path info   model[path][0] = dialog.newalias   model[path][1] = url.hidepassword(dialog.newpath)   model[path][2] = dialog.newpath @@ -633,7 +647,7 @@
  rows = [row for row in model if row[0] == 'default']   if len(rows) > 0:   ret = gdialog.Confirm(_('Confirm Overwrite'), [], self, - _("Overwirte existing 'default' path?")).run() + _("Overwirte existing '%s' path?") % 'default').run()   if ret != gtk.RESPONSE_YES:   return   # remove old default path