Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

clone: add --patches option for qclone

Changeset d0a9171a9d14

Parent e1ed86384cce

by Johan Samyn

Changes to 2 files · Browse files at d0a9171a9d14 Showing diff from parent e1ed86384cce Diff from another changeset...

 
39
40
41
 
 
42
43
44
 
39
40
41
42
43
44
45
46
@@ -39,6 +39,8 @@
  To use uncompressed transfer (fast over LAN).  :guilabel:`Include patch queue`   To also clone an MQ patch repository along with the main repository. + It is possible to provide a patch queue name that differs from the + default one.  :guilabel:`Use proxy server`   To use the proxy server configured in :menuselection:`TortoiseHg... --> Global Settings --> Proxy`.   This is enabled only if a proxy is configured.
 
7
8
9
10
 
11
12
13
 
101
102
103
104
 
105
106
107
108
109
110
111
112
113
114
115
116
 
 
 
 
 
 
 
 
 
 
 
 
117
118
119
 
121
122
123
124
125
126
127
128
 
 
 
 
129
130
131
 
149
150
151
 
152
153
154
 
191
192
193
 
194
195
196
 
243
244
245
 
 
 
 
246
 
 
247
248
249
 
364
365
366
367
 
368
369
370
 
 
371
372
373
 
393
394
395
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
396
397
398
 
7
8
9
 
10
11
12
13
 
101
102
103
 
104
105
106
107
108
109
 
 
110
111
112
113
 
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
 
130
131
132
 
133
134
135
 
136
137
138
139
140
141
142
 
160
161
162
163
164
165
166
 
203
204
205
206
207
208
209
 
256
257
258
259
260
261
262
263
264
265
266
267
268
 
383
384
385
 
386
387
388
389
390
391
392
393
394
 
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
@@ -7,7 +7,7 @@
 # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.   -import os +import os, string    from PyQt4.QtCore import *  from PyQt4.QtGui import * @@ -101,19 +101,28 @@
  optbox.setSpacing(6)   grid.addLayout(optbox, 2, 1, 1, 2)   - def chktext(chklabel, stretch=None): + def chktext(chklabel, btnlabel=None, btnslot=None, stretch=None):   hbox = QHBoxLayout()   hbox.setSpacing(0)   optbox.addLayout(hbox)   chk = QCheckBox(chklabel)   text = QLineEdit(enabled=False) - chk.toggled.connect( - lambda e: self.toggle_enabled(e, text))   hbox.addWidget(chk)   hbox.addWidget(text)   if stretch is not None:   hbox.addStretch(stretch) - return chk, text + if btnlabel: + btn = QPushButton(btnlabel) + btn.setEnabled(False) + btn.setAutoDefault = False + btn.clicked.connect(btnslot) + hbox.addWidget(btn) + chk.toggled.connect( + lambda e: self.toggle_enabled(e, text, target2=btn)) + return chk, text, btn + else: + chk.toggled.connect(lambda e: self.toggle_enabled(e, text)) + return chk, text     self.rev_chk, self.rev_text = chktext(_('Clone to revision:'),   stretch=40) @@ -121,11 +130,13 @@
  self.noupdate_chk = QCheckBox(_('Do not update the new working directory'))   self.pproto_chk = QCheckBox(_('Use pull protocol to copy metadata'))   self.uncomp_chk = QCheckBox(_('Use uncompressed transfer')) - self.qclone_chk = QCheckBox(_('Include patch queue'))   optbox.addWidget(self.noupdate_chk)   optbox.addWidget(self.pproto_chk)   optbox.addWidget(self.uncomp_chk) - optbox.addWidget(self.qclone_chk) + + self.qclone_chk, self.qclone_txt,self.qclone_btn = \ + chktext(_('Include patch queue'), btnlabel=_('Browse...'), + btnslot=self.onBrowseQclone)     self.proxy_chk = QCheckBox(_('Use proxy server'))   optbox.addWidget(self.proxy_chk) @@ -149,6 +160,7 @@
  self.hgcmd_txt.setReadOnly(True)   grid.addWidget(self.hgcmd_lbl, 3, 0)   grid.addWidget(self.hgcmd_txt, 3, 1) + self.hgcmd_txt.setMinimumWidth(400)     ## command widget   self.cmd = cmdui.Widget(True, True, self) @@ -191,6 +203,7 @@
  self.pproto_chk.toggled.connect(self.composeCommand)   self.uncomp_chk.toggled.connect(self.composeCommand)   self.qclone_chk.toggled.connect(self.composeCommand) + self.qclone_txt.textChanged.connect(self.composeCommand)   self.proxy_chk.toggled.connect(self.composeCommand)   self.insecure_chk.toggled.connect(self.composeCommand)   self.remote_chk.toggled.connect(self.composeCommand) @@ -243,7 +256,13 @@
  rev = hglib.fromunicode(self.rev_text.text().trimmed())   startrev = hglib.fromunicode(self.startrev_text.text().trimmed())   if self.qclone_chk.isChecked(): + qclonedir = hglib.fromunicode(self.qclone_txt.text().trimmed()) + if qclonedir == '': + qclonedir = '.hg\patches' + self.qclone_txt.setText(qclonedir)   cmdline = ['qclone'] + if not qclonedir in ['.hg\patches', '.hg/patches', '']: + cmdline += ['--patches', qclonedir]   else:   cmdline = ['clone']   if self.noupdate_chk.isChecked(): @@ -364,10 +383,12 @@
    ### Signal Handlers ###   - def toggle_enabled(self, checked, target): + def toggle_enabled(self, checked, target, target2=None):   target.setEnabled(checked)   if checked:   target.setFocus() + if target2: + target2.setEnabled(checked)   self.composeCommand()     def detail_toggled(self, checked): @@ -393,6 +414,25 @@
  self.dest_combo.setFocus()   self.composeCommand()   + def onBrowseQclone(self): + FD = QFileDialog + caption = _("Select patch folder") + upath = FD.getExistingDirectory(self, caption, \ + self.qclone_txt.text(), QFileDialog.ShowDirsOnly) + if upath: + path = hglib.fromunicode(upath).replace('/', os.sep) + src = hglib.fromunicode(self.src_combo.currentText()) + if not path.startswith(src): + qtlib.ErrorMsgBox('TortoiseHg QClone', + _('The selected patch folder is not' + ' under the source repository.'), + '<p>src = %s</p><p>path = %s</p>' % (src, path)) + return + path = path.replace(src + os.sep, '') + self.qclone_txt.setText(QDir.toNativeSeparators(hglib.tounicode(path))) + self.qclone_txt.setFocus() + self.composeCommand() +   def command_started(self):   self.cmd.setShown(True)   self.clone_btn.setHidden(True)