Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.3, 2.0.4, and 2.0.5

stable archive: make it possible to include subrepos in archives (fixes #366)

Changeset 54d64e550b41

Parent 394b28f582eb

by Johan Samyn

Changes to one file · Browse files at 54d64e550b41 Showing diff from parent 394b28f582eb Diff from another changeset...

 
44
45
46
 
47
48
49
 
50
51
52
 
55
56
57
58
59
60
 
 
 
61
62
63
 
70
71
72
73
74
75
76
77
78
79
 
 
 
 
 
 
 
80
81
82
 
84
85
86
87
88
89
 
 
 
90
91
92
 
127
128
129
 
130
131
132
 
156
157
158
 
159
160
161
 
170
171
172
 
173
174
175
 
200
201
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
204
205
 
266
267
268
269
270
271
272
273
 
274
275
 
 
276
277
278
 
44
45
46
47
48
49
50
51
52
53
54
 
57
58
59
 
 
 
60
61
62
63
64
65
 
72
73
74
 
 
 
 
 
 
 
75
76
77
78
79
80
81
82
83
84
 
86
87
88
 
 
 
89
90
91
92
93
94
 
129
130
131
132
133
134
135
 
159
160
161
162
163
164
165
 
174
175
176
177
178
179
180
 
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
 
289
290
291
 
 
 
 
 
292
293
294
295
296
297
298
299
@@ -44,9 +44,11 @@
  self.rev_combo.setSizeAdjustPolicy(QComboBox.AdjustToContents)   self.files_in_rev_chk = QCheckBox(   _('Only files modified/created in this revision')) + self.subrepos_chk = QCheckBox(_('Recurse into subrepositories'))   self.grid.addWidget(self.rev_lbl, 0, 0)   self.grid.addWidget(self.rev_combo, 0, 1)   self.grid.addWidget(self.files_in_rev_chk, 1, 1) + self.grid.addWidget(self.subrepos_chk, 2, 1)     # selecting a destination   self.dest_lbl = QLabel(_('Destination path:')) @@ -55,9 +57,9 @@
  self.dest_edit.setMinimumWidth(300)   self.dest_btn = QPushButton(_('Browse...'))   self.dest_btn.setAutoDefault(False) - self.grid.addWidget(self.dest_lbl, 2, 0) - self.grid.addWidget(self.dest_edit, 2, 1) - self.grid.addWidget(self.dest_btn, 2, 2) + self.grid.addWidget(self.dest_lbl, 3, 0) + self.grid.addWidget(self.dest_edit, 3, 1) + self.grid.addWidget(self.dest_btn, 3, 2)     # archive type selection   self.types_lbl = QLabel(_('Archive types:')) @@ -70,13 +72,13 @@
  self.tgzradio = radio(_('Tar archive compressed using gzip'))   self.uzipradio = radio(_('Uncompressed zip archive'))   self.zipradio = radio(_('Zip archive compressed using deflate')) - self.grid.addWidget(self.types_lbl, 3, 0) - self.grid.addWidget(self.filesradio, 3, 1) - self.grid.addWidget(self.tarradio, 4, 1) - self.grid.addWidget(self.tbz2radio, 5, 1) - self.grid.addWidget(self.tgzradio, 6, 1) - self.grid.addWidget(self.uzipradio, 7, 1) - self.grid.addWidget(self.zipradio, 8, 1) + self.grid.addWidget(self.types_lbl, 4, 0) + self.grid.addWidget(self.filesradio, 4, 1) + self.grid.addWidget(self.tarradio, 5, 1) + self.grid.addWidget(self.tbz2radio, 6, 1) + self.grid.addWidget(self.tgzradio, 7, 1) + self.grid.addWidget(self.uzipradio, 8, 1) + self.grid.addWidget(self.zipradio, 9, 1)     # some extras   self.hgcmd_lbl = QLabel(_('Hg command:')) @@ -84,9 +86,9 @@
  self.hgcmd_txt = QLineEdit()   self.hgcmd_txt.setReadOnly(True)   self.keep_open_chk = QCheckBox(_('Always show output')) - self.grid.addWidget(self.hgcmd_lbl, 9, 0) - self.grid.addWidget(self.hgcmd_txt, 9, 1) - self.grid.addWidget(self.keep_open_chk, 10, 1) + self.grid.addWidget(self.hgcmd_lbl, 10, 0) + self.grid.addWidget(self.hgcmd_txt, 10, 1) + self.grid.addWidget(self.keep_open_chk, 11, 1)     # command widget   self.cmd = cmdui.Widget(True, True, self) @@ -127,6 +129,7 @@
  self.rev_combo_changed)   self.dest_btn.clicked.connect(self.browse_clicked)   self.files_in_rev_chk.stateChanged.connect(self.dest_edited) + self.subrepos_chk.toggled.connect(self.onSubreposToggled)   self.filesradio.toggled.connect(self.update_path)   self.tarradio.toggled.connect(self.update_path)   self.tbz2radio.toggled.connect(self.update_path) @@ -156,6 +159,7 @@
  if self.rev_combo.findText(text, Qt.MatchFlags(Qt.MatchExactly)) == -1:   self.rev_combo.insertItems(0, [text])   self.rev_combo.setCurrentIndex(0) + self.subrepos_chk.setChecked(self.get_subrepos_present())   self.dest_edit.setText(self.repo.root)   self.filesradio.setChecked(True)   self.update_path() @@ -170,6 +174,7 @@
  self._readsettings()     def rev_combo_changed(self, index): + self.subrepos_chk.setChecked(self.get_subrepos_present())   self.update_path()     def dest_edited(self): @@ -200,6 +205,24 @@
  self.dest_edit.setText(response)   self.update_path()   + def onSubreposToggled(self): + path = hglib.fromunicode(self.dest_edit.text()) + type = self.get_selected_archive_type()['type'] + self.compose_command(path, type) + + def get_subrepos_present(self): + rev = self.get_selected_rev() + ctx = self.repo[rev] + return '.hgsubstate' in ctx.files() or '.hgsubstate' in ctx.manifest() + + def get_selected_rev(self): + rev = self.rev_combo.currentText() + if rev == WD_PARENT: + rev = '.' + else: + rev = hglib.fromunicode(rev) + return rev +   def get_selected_archive_type(self):   """Return a dictionary describing the selected archive type"""   if self.tarradio.isChecked(): @@ -266,13 +289,11 @@
    def compose_command(self, dest, type):   cmdline = ['archive', '--repository', self.repo.root] - rev = self.rev_combo.currentText() - if rev == WD_PARENT: - rev = '.' - else: - rev = hglib.fromunicode(rev) + rev = self.get_selected_rev()   cmdline.append('-r')   cmdline.append(rev) + if self.subrepos_chk.isChecked(): + cmdline.append('-S')   cmdline.append('-t')   cmdline.append(type)   if self.files_in_rev_chk.isChecked():