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

archive: append file extension automatically

Changeset 7044fed755b8

Parent fdb471e12967

by Yuki KODAMA

Changes to one file · Browse files at 7044fed755b8 Showing diff from parent fdb471e12967 Diff from another changeset...

 
95
96
97
 
98
99
100
 
101
102
103
 
147
148
149
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
151
152
 
95
96
97
98
99
100
101
102
103
104
105
 
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@@ -95,9 +95,11 @@
    ## archive types   self.filesradio = gtk.RadioButton(None, _('Directory of files')) + self.filesradio.connect('toggled', self.type_changed)   table.add_row(_('Archive types:'), self.filesradio)   def add_type(label):   radio = gtk.RadioButton(self.filesradio, label) + radio.connect('toggled', self.type_changed)   table.add_row(None, radio)   return radio   self.tarradio = add_type(_('Uncompressed tar archive')) @@ -147,6 +149,21 @@
    self.run() # doesn't close dialog   + def type_changed(self, radio): + if not radio.get_active(): + return + def remove_exts(path): + for ext in ('.tar', '.tar.bz2', '.tar.gz', '.zip'): + if path.endswith(ext): + return path.replace(ext, '') + return path + select = self.get_selected_archive_type() + path = self.destentry.get_text() + newpath = remove_exts(path) + if select['type'] != 'files': + newpath += select['ext'] + self.destentry.set_text(newpath) +   def get_default_path(self):   """Return the default destination path"""   return hglib.toutf(os.getcwd())