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

Merge with stable

Changeset a8d27ba47d50

Parents ca39273fe63d

Parents 7e16ca8e250e

by Steve Borho

Changes to 5 files · Browse files at a8d27ba47d50 Showing diff from parent ca39273fe63d 7e16ca8e250e Diff from another changeset...

 
480
481
482
 
 
 
 
483
484
485
486
487
488
 
489
490
491
492
493
494
495
 
496
497
498
 
480
481
482
483
484
485
486
487
488
489
490
491
 
492
493
494
495
496
497
498
 
499
500
501
502
@@ -480,19 +480,23 @@
  if self.cmd.core.running():   return False   + user = qtlib.getCurrentUsername(self, self.repo) + if not user: + return False +   if self.wizard().parentbackout:   self.setTitle(_('Backing out and committing...'))   self.setSubTitle(_('Please wait while making backout.'))   message = hglib.fromunicode(self.msgEntry.text())   cmdline = ['backout', '--verbose', '--message', message, '--rev', - str(self.wizard().backoutrev), + str(self.wizard().backoutrev), '--user', user,   '--repository', self.repo.root]   else:   self.setTitle(_('Committing...'))   self.setSubTitle(_('Please wait while committing merged files.'))   message = hglib.fromunicode(self.msgEntry.text())   cmdline = ['commit', '--verbose', '--message', message, - '--repository', self.repo.root] + '--repository', self.repo.root, '--user', user]   commandlines = [cmdline]   pushafter = self.repo.ui.config('tortoisehg', 'cipushafter')   if pushafter:
 
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
 
599
600
601
602
 
603
604
605
 
516
517
518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
519
520
521
 
574
575
576
 
577
578
579
580
@@ -516,31 +516,6 @@
  self.userhist.insert(0, user)   self.userhist = self.userhist[:10]   - def getCurrentUsername(self): - # 1. Override has highest priority - user = self.opts.get('user') - if user: - return user - - # 2. Read from repository - try: - return self.repo.ui.username() - except error.Abort: - pass - - # 3. Get a username from the user - QMessageBox.information(self, _('Please enter a username'), - _('You must identify yourself to Mercurial'), - QMessageBox.Ok) - from tortoisehg.hgqt.settings import SettingsDialog - dlg = SettingsDialog(False, focus='ui.username') - dlg.exec_() - self.repo.invalidateui() - try: - return self.repo.ui.username() - except error.Abort: - return None -   def commit(self):   repo = self.repo   msg = self.getMessage() @@ -599,7 +574,7 @@
  if len(repo.parents()) > 1:   files = []   - user = self.getCurrentUsername() + user = qtlib.getCurrentUsername(self, self.repo, self.opts)   if not user:   return   self.addUsernameToHistory(user)
 
564
565
566
 
 
 
 
567
568
569
570
571
572
 
573
574
575
 
564
565
566
567
568
569
570
571
572
573
574
575
 
576
577
578
579
@@ -564,12 +564,16 @@
  if self.cmd.core.running():   return False   + user = qtlib.getCurrentUsername(self, self.repo) + if not user: + return False +   self.setTitle(_('Committing...'))   self.setSubTitle(_('Please wait while committing merged files.'))     message = hglib.fromunicode(self.msgEntry.text())   cmdline = ['commit', '--verbose', '--message', message, - '--repository', self.repo.root] + '--repository', self.repo.root, '--user', user]   commandlines = [cmdline]   pushafter = self.repo.ui.config('tortoisehg', 'cipushafter')   if pushafter:
 
892
893
894
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
@@ -892,3 +892,30 @@
    def __getattr__(self, name):   return getattr(self._widget, name) + +def getCurrentUsername(widget, repo, opts=None): + if opts: + # 1. Override has highest priority + user = opts.get('user') + if user: + return user + + # 2. Read from repository + try: + return repo.ui.username() + except error.Abort: + pass + + # 3. Get a username from the user + QMessageBox.information(widget, _('Please enter a username'), + _('You must identify yourself to Mercurial'), + QMessageBox.Ok) + from tortoisehg.hgqt.settings import SettingsDialog + dlg = SettingsDialog(False, focus='ui.username') + dlg.exec_() + repo.invalidateui() + try: + return repo.ui.username() + except error.Abort: + return None +
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
 
 
 
 
 
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
 
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
 # tag.py - Tag dialog for TortoiseHg  #  # Copyright 2010 Yuki KODAMA <endflow.net@gmail.com>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.    from tortoisehg.util import hglib  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, cmdui, i18n    from PyQt4.QtCore import *  from PyQt4.QtGui import *    keep = i18n.keepgettext()    class TagDialog(QDialog):     showMessage = pyqtSignal(QString)   output = pyqtSignal(QString, QString)   makeLogVisible = pyqtSignal(bool)     def __init__(self, repo, tag='', rev='tip', parent=None, opts={}):   super(TagDialog, self).__init__(parent)   self.setWindowFlags(self.windowFlags() & \   ~Qt.WindowContextHelpButtonHint)     self.repo = repo   self.setWindowTitle(_('Tag - %s') % repo.displayname)   self.setWindowIcon(qtlib.geticon('hg-tag'))     # base layout box   base = QVBoxLayout()   base.setSpacing(0)   base.setContentsMargins(*(0,)*4)   base.setSizeConstraint(QLayout.SetFixedSize)   self.setLayout(base)     # main layout box   box = QVBoxLayout()   box.setSpacing(8)   box.setContentsMargins(*(8,)*4)   self.layout().addLayout(box)     form = QFormLayout(fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow)   box.addLayout(form)     ctx = repo[rev]   form.addRow(_('Revision:'), QLabel('%d (%s)' % (ctx.rev(), ctx)))   self.rev = ctx.rev()     ### tag combo   self.tagCombo = QComboBox()   self.tagCombo.setEditable(True)   self.tagCombo.setEditText(hglib.tounicode(tag))   self.tagCombo.currentIndexChanged.connect(self.updateStates)   self.tagCombo.editTextChanged.connect(self.updateStates)   form.addRow(_('Tag:'), self.tagCombo)     self.tagRevLabel = QLabel('')   form.addRow(_('Tagged:'), self.tagRevLabel)     ### options   expander = qtlib.ExpanderLabel(_('Options'), False)   expander.expanded.connect(self.show_options)   box.addWidget(expander)     optbox = QVBoxLayout()   optbox.setSpacing(6)   box.addLayout(optbox)     hbox = QHBoxLayout()   hbox.setSpacing(0)   optbox.addLayout(hbox)     self.localCheckBox = QCheckBox(_('Local tag'))   self.localCheckBox.toggled.connect(self.updateStates)   self.replaceCheckBox = QCheckBox(_('Replace existing tag (-f/--force)'))   self.replaceCheckBox.toggled.connect(self.updateStates)   optbox.addWidget(self.localCheckBox)   optbox.addWidget(self.replaceCheckBox)     self.englishCheckBox = QCheckBox(_('Use English commit message'))   engmsg = repo.ui.configbool('tortoisehg', 'engmsg', False)   self.englishCheckBox.setChecked(engmsg)   optbox.addWidget(self.englishCheckBox)     self.customCheckBox = QCheckBox(_('Use custom commit message:'))   self.customCheckBox.toggled.connect(self.customMessageToggle)   self.customTextLineEdit = QLineEdit()   optbox.addWidget(self.customCheckBox)   optbox.addWidget(self.customTextLineEdit)     ## bottom buttons   BB = QDialogButtonBox   bbox = QDialogButtonBox(BB.Close)   bbox.rejected.connect(self.reject)   self.addBtn = bbox.addButton(_('&Add'), BB.ActionRole)   self.removeBtn = bbox.addButton(_('&Remove'), BB.ActionRole)   box.addWidget(bbox)     self.addBtn.clicked.connect(self.onAddTag)   self.removeBtn.clicked.connect(self.onRemoveTag)     ## horizontal separator   self.sep = QFrame()   self.sep.setFrameShadow(QFrame.Sunken)   self.sep.setFrameShape(QFrame.HLine)   base.addWidget(self.sep)     ## status line   self.status = qtlib.StatusLabel()   self.status.setContentsMargins(4, 2, 4, 4)   base.addWidget(self.status)     self.cmd = cmdui.Runner(False, self)   self.cmd.output.connect(self.output)   self.cmd.makeLogVisible.connect(self.makeLogVisible)   self.cmd.commandFinished.connect(self.onCommandFinished)     repo.repositoryChanged.connect(self.refresh)   self.customTextLineEdit.setDisabled(True)   self.replaceCheckBox.setChecked(bool(opts.get('force')))   self.localCheckBox.setChecked(bool(opts.get('local')))   if not opts.get('local') and opts.get('message'):   msg = hglib.tounicode(opts['message'])   self.customCheckBox.setChecked(True)   self.customTextLineEdit.setText(msg)   self.clear_statue()   self.show_options(False)   self.tagCombo.setFocus()   self.refresh()     @pyqtSlot()   def refresh(self):   """ update display on dialog with recent repo data """   cur = self.tagCombo.currentText()     tags = list(self.repo.tags())   tags.sort(reverse=True)   self.tagCombo.clear()   for tag in tags:   if tag in ('tip', 'qbase', 'qtip', 'qparent'):   continue   self.tagCombo.addItem(hglib.tounicode(tag))   if cur:   self.tagCombo.setEditText(cur)   else:   self.tagCombo.clearEditText()   self.updateStates()     @pyqtSlot()   def updateStates(self):   """ update bottom button sensitives based on rev and tag """   tagu = self.tagCombo.currentText()   tag = hglib.fromunicode(tagu)     # check tag existence   if tag:   exists = tag in self.repo.tags()   if exists:   tagtype = self.repo.tagtype(tag)   islocal = 'local' == tagtype   try:   ctx = self.repo[self.repo.tags()[tag]]   trev = ctx.rev()   thash = str(ctx)   except:   trev, thash, local = 0, '????????', ''   self.localCheckBox.setChecked(islocal)   self.localCheckBox.setEnabled(False)   local = islocal and _('local') or ''   self.tagRevLabel.setText('%d (%s) %s' % (trev, thash, local))   samerev = trev == self.rev   else:   islocal = self.localCheckBox.isChecked()   self.localCheckBox.setEnabled(True)   self.tagRevLabel.clear()     force = self.replaceCheckBox.isChecked()   custom = self.customCheckBox.isChecked()   self.addBtn.setEnabled(not exists or (force and not samerev))   if exists and not samerev:   self.addBtn.setText(_('Move'))   else:   self.addBtn.setText(_('Add'))   self.removeBtn.setEnabled(exists)   self.englishCheckBox.setEnabled(not islocal)   self.customCheckBox.setEnabled(not islocal)   self.customTextLineEdit.setEnabled(not islocal and custom)   else:   self.addBtn.setEnabled(False)   self.removeBtn.setEnabled(False)   self.localCheckBox.setEnabled(False)   self.englishCheckBox.setEnabled(False)   self.customCheckBox.setEnabled(False)   self.customTextLineEdit.setEnabled(False)   self.tagRevLabel.clear()     def customMessageToggle(self, checked):   self.customTextLineEdit.setEnabled(checked)   if checked:   self.customTextLineEdit.setFocus()     def show_options(self, visible):   self.localCheckBox.setVisible(visible)   self.replaceCheckBox.setVisible(visible)   self.englishCheckBox.setVisible(visible)   self.customCheckBox.setVisible(visible)   self.customTextLineEdit.setVisible(visible)     def set_status(self, text, icon):   self.status.setShown(True)   self.sep.setShown(True)   self.status.set_status(text, icon)   self.showMessage.emit(text)     def clear_statue(self):   self.status.setHidden(True)   self.sep.setHidden(True)     def onCommandFinished(self, ret):   if ret == 0:   self.finishfunc()     def onAddTag(self):   tagu = self.tagCombo.currentText()   tag = hglib.fromunicode(tagu)   local = self.localCheckBox.isChecked()   force = self.replaceCheckBox.isChecked()   english = self.englishCheckBox.isChecked()   if self.customCheckBox.isChecked():   message = self.customTextLineEdit.text()   else:   message = None     exists = tag in self.repo.tags()   if exists and not force:   self.set_status(_("Tag '%s' already exists") % tagu, False)   return   if not local:   parents = self.repo.parents()   if len(parents) > 1:   self.set_status(_('uncommitted merge'), False)   return   p1 = parents[0]   if not force and p1.node() not in self.repo._branchheads:   self.set_status(_('not at a branch head (use force)'), False)   return   if not message:   ctx = self.repo[self.rev]   if exists:   origctx = self.repo[self.repo.tags()[tag]]   msgset = keep._('Moved tag %s to changeset %s' \   ' (from changeset %s)')   message = (english and msgset['id'] or msgset['str']) \   % (tagu, str(ctx), str(origctx))   else:   msgset = keep._('Added tag %s for changeset %s')   message = (english and msgset['id'] or msgset['str']) \   % (tagu, str(ctx))   message = hglib.fromunicode(message)     def finished():   if exists:   self.set_status(_("Tag '%s' has been moved") % tagu, True)   else:   self.set_status(_("Tag '%s' has been added") % tagu, True)   - cmd = ['tag', '--repository', self.repo.root, '--rev', str(self.rev)] + user = qtlib.getCurrentUsername(self, self.repo) + if not user: + return + cmd = ['tag', '--repository', self.repo.root, '--rev', str(self.rev), + '--user', user]   if local:   cmd.append('--local')   else:   cmd.append('--message=%s' % message)   if force:   cmd.append('--force')   cmd.append(tag)   self.finishfunc = finished   self.cmd.run(cmd)     def onRemoveTag(self):   tagu = self.tagCombo.currentText()   tag = hglib.fromunicode(tagu)   local = self.localCheckBox.isChecked()   force = self.replaceCheckBox.isChecked()   english = self.englishCheckBox.isChecked()   if self.customCheckBox.isChecked():   message = self.customTextLineEdit.text()   else:   message = None     tagtype = self.repo.tagtype(tag)   if local:   if tagtype != 'local':   self.set_status(_("tag '%s' is not a local tag") % tagu)   return   else:   if tagtype != 'global':   self.set_status(_("tag '%s' is not a global tag") % tagu)   return   parents = self.repo.parents()   if len(parents) > 1:   self.set_status(_('uncommitted merge'), False)   return   p1 = parents[0]   if not force and p1.node() not in self.repo._branchheads:   self.set_status(_('not at a branch head (use force)'), False)   return   if not message:   msgset = keep._('Removed tag %s')   message = (english and msgset['id'] or msgset['str']) % tagu   message = hglib.fromunicode(message)     def finished():   self.set_status(_("Tag '%s' has been removed") % tagu, True)     cmd = ['tag', '--repository', self.repo.root, '--remove']   if local:   cmd.append('--local')   else:   cmd.append('--message=%s' % message)   cmd.append(tag)   self.finishfunc = finished   self.cmd.run(cmd)     def reject(self):   # prevent signals from reaching deleted objects   self.repo.repositoryChanged.disconnect(self.refresh)   super(TagDialog, self).reject()    def run(ui, *pats, **opts):   kargs = {}   tag = len(pats) > 0 and pats[0] or None   if tag:   kargs['tag'] = tag   rev = opts.get('rev')   if rev:   kargs['rev'] = rev   from tortoisehg.util import paths   from tortoisehg.hgqt import thgrepo   repo = thgrepo.repository(ui, path=paths.find_root())   return TagDialog(repo, opts=opts, **kargs)