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 223a7d029a97

Parents e8ec5fd78cf5

Parents f13c17c58639

by Adrian Buehlmann

Changes to 23 files · Browse files at 223a7d029a97 Showing diff from parent e8ec5fd78cf5 f13c17c58639 Diff from another changeset...

Change 1 of 1 Show Entire File .hgignore Stacked
 
40
41
42
 
 
40
41
42
43
@@ -40,3 +40,4 @@
 *.wixobj  tortoisehg/hgqt/*_rc.py  tortoisehg/hgqt/*_ui.py +thgw
Change 1 of 1 Show Entire File CONTRIBUTING.txt Stacked
 
14
15
16
17
 
 
18
19
20
 
14
15
16
 
17
18
19
20
21
@@ -14,7 +14,8 @@
 application is still reasonably usable with the base library versions listed  below.   -PyQt: 4.6 +PyQt: 4.7 +Qt: 4.6    === Python version ===  
 
19
20
21
 
 
 
 
 
 
 
 
 
 
 
22
23
24
25
26
27
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
35
36
37
@@ -19,9 +19,19 @@
 beyondcompare2.diffargs=/lro /title1='$plabel1' /title2='$clabel' $parent $child  beyondcompare2.dirdiff=True   +; The Araxis Merge tool is configured to work with newer versions of Araxis Merge +; if you are using Araxis Merge 2008 or later, create a [merge-tools] section +; in your mercurial.ini file, and add one of the two following "araxis.executable" +; lines, depending on whether you have installed a 32 or a 64 bit version +; of Araxis Merge and whether you are on a 32 or 64 bit version of windows +; +;araxis.executable=${ProgramFiles}/Araxis/Araxis Merge/ConsoleCompare.exe +;araxis.executable=${ProgramFiles(x86)}/Araxis/Araxis Merge/ConsoleCompare.exe +; +; Please remember to remove the leading ";" to uncomment the line +;  araxis.regkey=SOFTWARE\Classes\TypeLib\{46799e0a-7bd1-4330-911c-9660bb964ea2}\7.0\HELPDIR  araxis.regappend=\ConsoleCompare.exe -;araxis.executable=${ProgramFiles}/Araxis/Araxis Merge/ConsoleCompare.exe  araxis.priority=-2  araxis.args=/3 /a2 /wait /merge /title1:"Parent 1" /title2:"Merge Result: "$output /title3:"Parent 2" $local $base $other $output  araxis.premerge=False
 
62
63
64
65
 
66
67
68
 
92
93
94
95
 
96
97
98
 
62
63
64
 
65
66
67
68
 
92
93
94
 
95
96
97
98
@@ -62,7 +62,7 @@
     Patch Panes -=========== +-----------    The right and the left patch panes are identical save for the working  copy changes are only available on the left. Selectable chunks are only @@ -92,7 +92,7 @@
  working copy files.    Trashcan -======== +--------    The shelve tool is very conservative with your source and patch files.  Before it modifies any file it makes a backup under
 
11
12
13
14
15
16
 
17
18
19
20
 
21
22
23
 
24
25
26
 
101
102
103
 
104
105
106
 
120
121
122
123
124
125
 
 
 
 
 
 
126
 
127
128
129
130
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
133
134
 
137
138
139
140
141
 
 
142
143
144
 
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
 
11
12
13
 
 
 
14
15
16
17
 
18
19
20
21
22
23
24
25
 
100
101
102
103
104
105
106
 
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
 
166
167
168
 
 
169
170
171
172
173
 
179
180
181
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
183
@@ -11,16 +11,15 @@
 TortoiseHg About dialog - PyQt4 version  """   -import os, sys, urllib2 - -from mercurial import ui, url +import sys    from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib -from tortoisehg.util import version, hglib, shlib, paths +from tortoisehg.util import version, hglib, paths    from PyQt4.QtCore import *  from PyQt4.QtGui import * +from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest    class AboutDialog(QDialog):   """Dialog for showing info about TortoiseHg""" @@ -101,6 +100,7 @@
    # Spawn it later, so that the dialog gets visible quickly.   QTimer.singleShot(0, self.getUpdateInfo) + self._newverreply = None     def getVersionInfo(self):   def make_version(tuple): @@ -120,15 +120,44 @@
    @pyqtSlot()   def getUpdateInfo(self): - self.uthread = AboutUpdateThread() - self.uthread.finished.connect(self.uFinished) - self.uthread.start() + verurl = 'http://tortoisehg.bitbucket.org/curversion.txt' + # If we use QNetworkAcessManager elsewhere, it should be shared + # through the application. + self._netmanager = QNetworkAccessManager(self) + self._newverreply = self._netmanager.get(QNetworkRequest(QUrl(verurl))) + self._newverreply.finished.connect(self.uFinished)   + @pyqtSlot()   def uFinished(self): - self.uthread.wait() - urldata = self.uthread.urldata - self.uthread = None - if urldata: + newver = (0,0,0) + try: + f = self._newverreply.readAll().data().splitlines() + self._newverreply.close() + self._newverreply = None + newver = tuple([int(p) for p in f[0].split('.')]) + upgradeurl = f[1] # generic download URL + platform = sys.platform + if platform == 'win32': + from win32process import IsWow64Process as IsX64 + platform = IsX64() and 'x64' or 'x86' + # linux2 for Linux, darwin for OSX + for line in f[2:]: + p, _url = line.split(':', 1) + if platform == p: + upgradeurl = _url.strip() + break + except (IndexError, ImportError): + pass + try: + thgv = version.version() + if '+' in thgv: + thgv = thgv[:thgv.index('+')] + curver = tuple([int(p) for p in thgv.split('.')]) + except ValueError: + curver = (0,0,0) + if newver > curver: + url_lbl = _('A new version of TortoiseHg is ready for download!') + urldata = ('<a href=%s>%s</a>' % (upgradeurl, url_lbl))   self.download_url_lbl.setText(urldata)     def showLicense(self): @@ -137,8 +166,8 @@
  ld.show()     def closeEvent(self, event): - if self.uthread: - self.uthread.wait() + if self._newverreply: + self._newverreply.abort()   self._writesettings()   super(AboutDialog, self).closeEvent(event)   @@ -150,45 +179,5 @@
  s = QSettings()   s.setValue('about/geom', self.saveGeometry())   - -class AboutUpdateThread(QThread): - 'Background thread for getting update info' - def __init__(self): - super(AboutUpdateThread, self).__init__() - - urldata = '' - - def run(self): - verurl = 'http://tortoisehg.bitbucket.org/curversion.txt' - newver = (0,0,0) - opener = url.opener(ui.ui()) - try: - f = opener.open(verurl).read().splitlines() - newver = tuple([int(p) for p in f[0].split('.')]) - upgradeurl = f[1] # generic download URL - platform = sys.platform - if platform == 'win32': - from win32process import IsWow64Process as IsX64 - platform = IsX64() and 'x64' or 'x86' - # linux2 for Linux, darwin for OSX - for line in f[2:]: - p, _url = line.split(':') - if platform == p: - upgradeurl = _url.strip() - break - except: - pass - try: - thgv = version.version() - if '+' in thgv: - thgv = thgv[:thgv.index('+')] - curver = tuple([int(p) for p in thgv.split('.')]) - except Exception, e: - curver = (0,0,0) - if newver > curver: - url_lbl = _('A new version of TortoiseHg is ready for download!') - self.urldata = ('<a href=%s>%s</a>' % (upgradeurl, url_lbl)) - -  def run(ui, *pats, **opts):   return AboutDialog()
 
21
22
23
24
25
26
27
 
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
 
185
186
187
 
 
188
189
190
191
192
193
 
194
195
196
 
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
 
228
229
230
231
 
232
233
234
 
235
236
 
237
238
239
 
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
 
21
22
23
 
24
25
26
 
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
 
149
150
151
152
153
154
 
 
155
156
 
157
158
159
160
 
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
 
201
202
203
 
204
205
206
 
207
208
 
209
210
211
212
 
216
217
218
 
 
 
219
220
 
221
222
223
224
225
 
 
 
 
@@ -21,7 +21,6 @@
 class BookmarkDialog(QDialog):   showMessage = pyqtSignal(QString)   output = pyqtSignal(QString, QString) - progress = pyqtSignal(QString, object, QString, QString, object)   makeLogVisible = pyqtSignal(bool)     def __init__(self, repo, rev, parent): @@ -29,149 +28,114 @@
  self.setWindowFlags(self.windowFlags() & \   ~Qt.WindowContextHelpButtonHint)   self.repo = repo + self.rev = rev + self.node = repo[rev].node()     # 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(6) - box.setContentsMargins(*(6,)*4) - base.addLayout(box) + box.setSpacing(8) + box.setContentsMargins(*(8,)*4) + self.layout().addLayout(box)     ## main layout grid - grid = QGridLayout() - grid.setSpacing(6) - box.addLayout(grid) + form = QFormLayout(fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow) + box.addLayout(form) + + form.addRow(_('Revision:'), QLabel('%d (%s)' % (rev, repo[rev])))     ### bookmark combo - self.bookmark_combo = QComboBox() - self.bookmark_combo.setEditable(True) - self.bookmark_combo.setMinimumWidth(180) - self.bookmark_combo.setEditText('') - grid.addWidget(QLabel(_('Bookmark:')), 0, 0) - grid.addWidget(self.bookmark_combo, 0, 1) + self.bookmarkCombo = QComboBox() + self.bookmarkCombo.setEditable(True) + self.bookmarkCombo.currentIndexChanged.connect(self.bookmarkTextChanged) + self.bookmarkCombo.editTextChanged.connect(self.bookmarkTextChanged) + form.addRow(_('Bookmark:'), self.bookmarkCombo)     ### Rename input - self.new_name_text = QLineEdit() - self.new_name_text.setMaximumWidth(100) - self.new_name_text.textEdited.connect(self.new_bookmark_changed) - self.new_name_label = QLabel(_('New name:')) - grid.addWidget(self.new_name_label, 1, 0) - grid.addWidget(self.new_name_text, 1, 1) - self.enable_new_name(False) - - ### revision input - self.initial_rev = str(rev) - self.rev_text = QLineEdit() - self.rev_text.setMaximumWidth(100) - self.rev_text.setText(rev) - self.rev_text.setReadOnly(True) - #self.rev_text.textEdited.connect(self.update_sensitives) - grid.addWidget(QLabel(_('Revision:')), 2, 0) - grid.addWidget(self.rev_text, 2, 1) + self.newNameEdit = QLineEdit() + self.newNameEdit.textEdited.connect(self.bookmarkTextChanged) + form.addRow(_('New Name:'), self.newNameEdit)     ## bottom buttons - buttons = QDialogButtonBox() - self.close_btn = buttons.addButton(QDialogButtonBox.Close) - self.close_btn.clicked.connect(self.reject) - self.add_btn = buttons.addButton(_('&Add'), - QDialogButtonBox.ActionRole) - self.add_btn.clicked.connect(self.add_bookmark) - self.rename_btn = buttons.addButton(_('&Rename'), - QDialogButtonBox.ActionRole) - self.rename_btn.clicked.connect(self.rename_bookmark) - self.remove_btn = buttons.addButton(_('&Remove'), - QDialogButtonBox.ActionRole) - self.remove_btn.clicked.connect(self.remove_bookmark) - box.addWidget(buttons) + BB = QDialogButtonBox + bbox = QDialogButtonBox() + self.addBtn = bbox.addButton(_('&Add'), BB.ActionRole) + self.renameBtn = bbox.addButton(_('Re&name'), BB.ActionRole) + self.removeBtn = bbox.addButton(_('&Remove'), BB.ActionRole) + self.moveBtn = bbox.addButton(_('&Move'), BB.ActionRole) + bbox.addButton(BB.Close) + bbox.rejected.connect(self.reject) + box.addWidget(bbox)   - # add signals - self.bookmark_combo.currentIndexChanged.connect(self.toggle_new_bookmark) - self.bookmark_combo.editTextChanged.connect(self.update_sensitives) + self.addBtn.clicked.connect(self.add_bookmark) + self.renameBtn.clicked.connect(self.rename_bookmark) + self.removeBtn.clicked.connect(self.remove_bookmark) + self.moveBtn.clicked.connect(self.move_bookmark)     ## horizontal separator   self.sep = QFrame()   self.sep.setFrameShadow(QFrame.Sunken)   self.sep.setFrameShape(QFrame.HLine) - base.addWidget(self.sep) + self.layout().addWidget(self.sep)     ## status line   self.status = qtlib.StatusLabel()   self.status.setContentsMargins(4, 2, 4, 4) - base.addWidget(self.status) + self.layout().addWidget(self.status)     # dialog setting - self.setLayout(base) - self.layout().setSizeConstraint(QLayout.SetFixedSize)   self.setWindowTitle(_('Bookmark - %s') % self.repo.displayname)   self.setWindowIcon(qtlib.geticon('hg-bookmarks'))     self.cmd = cmdui.Runner(False, self)   self.cmd.output.connect(self.output)   self.cmd.makeLogVisible.connect(self.makeLogVisible) - self.cmd.progress.connect(self.progress)   self.cmd.commandFinished.connect(self.commandFinished)     # prepare to show   self.clear_status() - self.update_bookmark_combo(clear=False) - self.update_sensitives() - self.rename_btn.setVisible(False) - self.rename_btn.setEnabled(False) - self.enable_new_name(False) - self.bookmark_combo.setFocus() + self.refresh() + self.repo.repositoryChanged.connect(self.refresh) + self.bookmarkCombo.setFocus() + self.bookmarkTextChanged()   - ### Private Methods ### - def enable_new_name(self, enabled): - self.new_name_text.setEnabled(enabled) - self.new_name_label.setEnabled(enabled) - - def update_bookmark_combo(self, clear=True): + def refresh(self):   """ update display on dialog with recent repo data """ - bookmark_name = self.bookmark_combo.currentText() - self.bookmark_combo.clear() -   # add bookmarks to drop-down list   marks = self.repo._bookmarks.keys()[:]   marks.sort()   marks.reverse() + cur = self.bookmarkCombo.currentText() + self.bookmarkCombo.clear()   for bookmark in marks: - self.bookmark_combo.addItem(hglib.tounicode(bookmark)) - self.bookmark_combo.clearEditText() - - # restore tag name - if not clear and bookmark_name: - self.bookmark_combo.setEditText(bookmark_name) - - def toggle_new_bookmark(self): - bookmark = self.bookmark_combo.currentText() - bookmarklocal = hglib.fromunicode(bookmark) - is_new = bookmarklocal not in self.repo._bookmarks - self.add_btn.setVisible(is_new) - self.add_btn.setDisabled(not is_new) - self.remove_btn.setVisible(not is_new) - self.rename_btn.setVisible(not is_new) - self.enable_new_name(not is_new) + self.bookmarkCombo.addItem(hglib.tounicode(bookmark)) + if cur: + self.bookmarkCombo.setEditText(cur) + else: + self.bookmarkTextChanged()     @pyqtSlot() - def update_sensitives(self): - """ update bottom button sensitives based on rev and bookmark """ - self.toggle_new_bookmark() - revstr = self.rev_text.text() - if not revstr or not self.bookmark_combo.currentText(): - self.add_btn.setDisabled(True) - return - - try: - # check if valid revision, tag, or branch - self.repo[hglib.fromunicode(revstr)] - except (error.LookupError, error.RepoError): - self.add_btn.setDisabled(True) - self.remove_btn.setDisabled(True) - self.rename_btn.setDisabled(True) + def bookmarkTextChanged(self): + bookmark = self.bookmarkCombo.currentText() + bookmarklocal = hglib.fromunicode(bookmark) + if bookmarklocal in self.repo._bookmarks: + curnode = self.repo._bookmarks[bookmarklocal] + self.addBtn.setEnabled(False) + self.newNameEdit.setEnabled(True) + self.removeBtn.setEnabled(True) + self.renameBtn.setEnabled(bool(self.newNameEdit.text())) + self.moveBtn.setEnabled(self.node != curnode) + else: + self.addBtn.setEnabled(bool(bookmark)) + self.removeBtn.setEnabled(False) + self.moveBtn.setEnabled(False) + self.renameBtn.setEnabled(False) + self.newNameEdit.setEnabled(False)     def set_status(self, text, icon=None):   self.status.setShown(True) @@ -185,12 +149,12 @@
    def commandFinished(self, ret):   if ret is 0: + self.bookmarkCombo.clearEditText() + self.newNameEdit.setText('')   self.finishfunc() - self.repo.incrementBusyCount() - self.repo.decrementBusyCount()     def add_bookmark(self): - bookmark = self.bookmark_combo.currentText() + bookmark = self.bookmarkCombo.currentText()   bookmarklocal = hglib.fromunicode(bookmark)   if bookmarklocal in self.repo._bookmarks:   self.set_status(_('A bookmark named "%s" already exists') % @@ -198,29 +162,38 @@
  return     def finished(): - self.bookmark_combo.addItem(bookmark)   self.set_status(_("Bookmark '%s' has been added") % bookmark, True) - self.toggle_new_bookmark() - self.bookmark_combo.clearEditText()     cmdline = ['bookmark', '--repository', self.repo.root, - '--rev', self.initial_rev, bookmarklocal] + '--rev', str(self.rev), bookmarklocal]   self.cmd.run(cmdline)   self.finishfunc = finished   + def move_bookmark(self): + bookmark = self.bookmarkCombo.currentText() + bookmarklocal = hglib.fromunicode(bookmark) + if bookmarklocal not in self.repo._bookmarks: + self.set_status(_('Bookmark named "%s" does not exist') % + bookmark, False) + return + + def finished(): + self.set_status(_("Bookmark '%s' has been moved") % bookmark, True) + + cmdline = ['bookmark', '--repository', self.repo.root, + '--rev', str(self.rev), '--force', bookmarklocal] + self.cmd.run(cmdline) + self.finishfunc = finished     def remove_bookmark(self): - bookmark = self.bookmark_combo.currentText() + bookmark = self.bookmarkCombo.currentText()   bookmarklocal = hglib.fromunicode(bookmark) - if not bookmarklocal in self.repo._bookmarks: + if bookmarklocal not in self.repo._bookmarks:   self.set_status(_("Bookmark '%s' does not exist") % bookmark, False)   return     def finished(): - self.bookmark_combo.removeItem(self.bookmark_combo.currentIndex()) - self.new_name_text.setText("")   self.set_status(_("Bookmark '%s' has been removed") % bookmark, True) - self.update_sensitives()     cmdline = ['bookmark', '--repository', self.repo.root,   '--delete', bookmarklocal] @@ -228,12 +201,12 @@
  self.finishfunc = finished     def rename_bookmark(self): - name = self.bookmark_combo.currentText() + name = self.bookmarkCombo.currentText()   namelocal = hglib.fromunicode(name)   - newname = self.new_name_text.text() + newname = self.newNameEdit.text()   newnamelocal = hglib.fromunicode(newname) - if not namelocal in self.repo._bookmarks: + if namelocal not in self.repo._bookmarks:   self.set_status(_("Bookmark '%s' does not exist") % name, False)   return   @@ -243,18 +216,10 @@
  return     def finished(): - self.bookmark_combo.removeItem(self.bookmark_combo.currentIndex()) - self.bookmark_combo.addItem(newname) - self.new_name_text.setText("")   self.set_status(_("Bookmark '%s' has been renamed to '%s'") %   (name, newname), True) - self.update_sensitives()     cmdline = ['bookmark', '--repository', self.repo.root,   '--rename', namelocal, newnamelocal]   self.cmd.run(cmdline)   self.finishfunc = finished - - @pyqtSlot(QString) - def new_bookmark_changed(self, value): - self.rename_btn.setDisabled(not value)
 
29
30
31
32
33
 
 
 
 
 
 
 
34
35
36
 
29
30
31
 
 
32
33
34
35
36
37
38
39
40
41
@@ -29,8 +29,13 @@
  lbl = QLabel('<b>'+_('Select branch of merge commit')+'</b>')   layout.addWidget(lbl)   branchCombo = QComboBox() - for p in wctx.parents(): - branchCombo.addItem(hglib.tounicode(p.branch())) + # If both parents belong to the same branch, do not duplicate the + # branch name in the branch select combo + branchlist = [p.branch() for p in wctx.parents()] + if branchlist[0] == branchlist[1]: + branchlist = [branchlist[0]] + for b in branchlist: + branchCombo.addItem(hglib.tounicode(b))   layout.addWidget(branchCombo)   else:   text = '<b>'+_('Changes take effect on next commit')+'</b>'
 
325
326
327
328
 
329
330
331
 
333
334
335
336
 
337
338
339
 
325
326
327
 
328
329
330
331
 
333
334
335
 
336
337
338
339
@@ -325,7 +325,7 @@
  caption = _("Select source repository")   path = FD.getExistingDirectory(self, caption)   if path: - self.src_combo.setEditText(path) + self.src_combo.setEditText(QDir.toNativeSeparators(path))   self.src_combo.setFocus()     def browse_dest(self): @@ -333,7 +333,7 @@
  caption = _("Select destination repository")   path = FD.getExistingDirectory(self, caption)   if path: - self.dest_combo.setEditText(path) + self.dest_combo.setEditText(QDir.toNativeSeparators(path))   self.dest_combo.setFocus()     def command_started(self):
 
207
208
209
210
 
211
212
213
 
218
219
220
221
 
222
223
224
 
377
378
379
380
 
381
382
383
 
384
385
386
 
207
208
209
 
210
211
212
213
 
218
219
220
 
221
222
223
224
 
377
378
379
 
380
381
382
 
383
384
385
386
@@ -207,7 +207,7 @@
  hbox.addWidget(tbar)     self.recentMessagesButton = QToolButton( - text=_('Copy message'), + text=_('Copy message'),   popupMode=QToolButton.InstantPopup,   statusTip=_('Copy one of the recent commit messages'))   tbar.addWidget(self.recentMessagesButton) @@ -218,7 +218,7 @@
  self.branchop = None     tbar.addAction(_('Options')).triggered.connect(self.details) - +   hbox.addStretch(1)     vbox.addLayout(hbox, 0) @@ -377,10 +377,10 @@
  m = QMenu()   for s in self.msghistory:   title = s.split('\n', 1)[0][:70] - def overwriteMsg(newMsg): return lambda: self.msgSelected(newMsg) + def overwriteMsg(newMsg): return lambda: self.msgSelected(newMsg)   m.addAction(title).triggered.connect(overwriteMsg(s))   self.recentMessagesButton.setMenu(m) - +   def getMessage(self):   text = self.msgte.text()   try:
 
297
298
299
300
301
302
 
303
304
305
 
297
298
299
 
 
 
300
301
302
303
@@ -297,9 +297,7 @@
  base, _ = visdiff.snapshot(ctx._repo, paths, ctx)   urls = []   for path in paths: - u = QUrl() - u.setPath('file://' + os.path.join(base, path)) - urls.append(u) + urls.append(QUrl.fromLocalFile(os.path.join(base, path)))   if urls:   d = QDrag(self)   m = QMimeData()
 
528
529
530
531
532
533
 
534
535
536
 
528
529
530
 
 
 
531
532
533
534
@@ -528,9 +528,7 @@
  else:   base = self.repo.root   for p in paths: - u = QUrl() - u.setPath('file://' + os.path.join(base, path)) - urls.append(u) + urls.append(QUrl.fromLocalFile(os.path.join(base, path)))   if urls:   d = QDrag(self)   m = QMimeData()
 
171
172
173
174
175
176
 
 
 
 
177
178
179
180
181
 
 
 
 
 
 
182
183
184
185
 
 
 
 
 
186
187
188
 
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
@@ -171,18 +171,27 @@
  self.revsetcombo.lineEdit().setText(query)     def loadSettings(self, s): - self.entrydlg.restoreGeometry(s.value('revset/geom').toByteArray()) - self.revsethist = list(s.value('revset-queries').toStringList()) - self.filtercb.setChecked(s.value('revset-filter', True).toBool()) + repoid = str(self._repo[0]) + self.entrydlg.restoreGeometry(s.value('revset/' + repoid + '/geom').toByteArray()) + self.revsethist = list(s.value('revset/' + repoid + '/queries').toStringList()) + self.filtercb.setChecked(s.value('revset/' + repoid + '/filter', True).toBool())   full = self.revsethist + list(_permanent_queries)   self.revsetcombo.clear()   self.revsetcombo.addItems(full)   self.revsetcombo.setCurrentIndex(-1)   + # Show the filter bar if necessary + if s.value('revset/' + repoid + '/showrepofilterbar').toBool(): + self.show() + else: + self.hide() +   def saveSettings(self, s): - s.setValue('revset/geom', self.entrydlg.saveGeometry()) - s.setValue('revset-queries', self.revsethist) - s.setValue('revset-filter', self.filtercb.isChecked()) + repoid = str(self._repo[0]) + s.setValue('revset/' + repoid + '/geom', self.entrydlg.saveGeometry()) + s.setValue('revset/' + repoid + '/queries', self.revsethist) + s.setValue('revset/' + repoid + '/filter', self.filtercb.isChecked()) + s.setValue('revset/' + repoid + '/showrepofilterbar', not self.isHidden())     def _initbranchfilter(self):   self._branchLabel = QToolButton(
 
122
123
124
125
 
126
127
128
 
122
123
124
 
125
126
127
128
@@ -122,7 +122,7 @@
  for name, desc, icon, tip, key, cb in self._action_defs():   act = self._actions[name]   if icon: - act.setIcon(qtlib.geticon(icon)) + act.setIcon(qtlib.getmenuicon(icon))   if tip:   act.setStatusTip(tip)   if key:
 
1193
1194
1195
1196
1197
 
 
1198
1199
1200
1201
1202
 
1203
1204
1205
1206
1207
1208
1209
 
1193
1194
1195
 
1196
1197
1198
1199
1200
1201
1202
 
1203
1204
1205
1206
 
1207
1208
1209
@@ -1193,17 +1193,17 @@
    def tagToRevision(self):   dlg = tag.TagDialog(self.repo, rev=str(self.rev), parent=self) - dlg.localTagChanged.connect(self.refresh)   dlg.showMessage.connect(self.showMessage) + dlg.output.connect(self.output) + dlg.makeLogVisible.connect(self.makeLogVisible)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_()     def bookmarkRevision(self): - dlg = bookmark.BookmarkDialog(self.repo, str(self.rev), self) + dlg = bookmark.BookmarkDialog(self.repo, self.rev, self)   dlg.showMessage.connect(self.showMessage)   dlg.output.connect(self.output)   dlg.makeLogVisible.connect(self.makeLogVisible) - dlg.progress.connect(self.progress)   dlg.finished.connect(dlg.deleteLater)   dlg.exec_()  
 
331
332
333
334
335
336
 
337
338
339
 
331
332
333
 
 
 
334
335
336
337
@@ -331,9 +331,7 @@
  urls = []   for index in self.selectionModel().selectedRows():   root, path = self.model().getPathForIndex(index) - u = QUrl() - u.setPath('file://' + os.path.join(root, path)) - urls.append(u) + urls.append(QUrl.fromLocalFile(os.path.join(root, path)))   if urls:   d = QDrag(self)   m = QMimeData()
 
118
119
120
121
 
 
 
122
123
124
 
242
243
244
245
 
246
247
248
 
290
291
292
293
 
294
295
296
 
118
119
120
 
121
122
123
124
125
126
 
244
245
246
 
247
248
249
250
 
292
293
294
 
295
296
297
298
@@ -118,7 +118,9 @@
  QDialog.__init__(self, parent)     self.repo = repo - self.setWindowTitle(_('Revision Set Query')) + # Since the revset dialot belongs to a repository, we display + # the repository name in the dialog title + self.setWindowTitle(_('Revision Set Query') + ' - ' + repo.displayname)   self.setWindowFlags(Qt.Window)     layout = QVBoxLayout() @@ -242,7 +244,7 @@
  bopen = sel.indexOf('(')   bclose = sel.lastIndexOf(')')   if bopen < bclose: - self.entry.setSelection(lineFrom, start+bopen+1, + self.entry.setSelection(lineFrom, start+bopen+1,   lineFrom, start+bclose)   self.entry.setFocus()   return @@ -290,7 +292,7 @@
  end = end+1   bopen = itext.indexOf('(')   newtext = text[:start] + itext[:bopen+1] + text[start:end] + \ - ')' + text[end:] + ')' + text[end:]   self.entry.setText(newtext)   self.entry.setSelection(line, start, line, end+bopen+2)   self.entry.endUndoAction()
 
265
266
267
268
269
270
271
 
273
274
275
 
276
277
278
 
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
 
 
 
305
306
307
 
464
465
466
 
 
 
 
 
 
 
 
 
 
 
 
467
468
469
 
265
266
267
 
268
269
270
 
272
273
274
275
276
277
278
 
289
290
291
 
 
 
 
 
 
 
 
 
 
 
 
 
292
293
294
295
296
297
 
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
@@ -265,7 +265,6 @@
  path, bundle = s   cmdoptions['bundle'] = os.path.abspath(bundle)   path = ui.expandpath(path) - cmdoptions['repository'] = path   os.chdir(path)   if options['fork']:   cmdoptions['fork'] = True @@ -273,6 +272,7 @@
  cmdoptions['nofork'] = True   path = paths.find_root(os.getcwd())   if path: + cmdoptions['repository'] = path   try:   lui = ui.copy()   lui.readconfig(os.path.join(path, ".hg", "hgrc")) @@ -289,19 +289,9 @@
  if options['quiet']:   ui.quiet = True   - if cmd not in nonrepo_commands.split(): - if not path: - raise error.RepoError(_("There is no Mercurial repository here" - " (.hg not found)")) - try: - # Ensure we can open the repository before opening any dialog - # windows. Since thgrepo instances are cached, this is not wasted. - from tortoisehg.hgqt import thgrepo - repo = thgrepo.repository(lui, path) - except error.RepoError, e: - qtlib.WarningMsgBox(_('Repository Error'), - hglib.tounicode(str(e))) - raise + if cmd not in nonrepo_commands.split() and not path: + error.RepoError(_("There is no Mercurial repository here" + " (.hg not found)"))     cmdoptions['mainapp'] = True   d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) @@ -464,6 +454,18 @@
  qtlib.configstyles(ui)   qtlib.initfontcache(ui)   self._mainapp.setWindowIcon(qtlib.geticon('thg-logo')) + + if 'repository' in opts: + try: + # Ensure we can open the repository before opening any + # dialog windows. Since thgrepo instances are cached, this + # is not wasted. + from tortoisehg.hgqt import thgrepo + repo = thgrepo.repository(ui, opts['repository']) + except error.RepoError, e: + qtlib.WarningMsgBox(_('Repository Error'), + hglib.tounicode(str(e))) + return   dlg = dlgfunc(ui, *args, **opts)   if dlg:   dlg.show()
 
421
422
423
424
425
426
 
427
428
429
430
431
432
 
 
 
 
 
433
434
435
 
421
422
423
 
 
 
424
425
 
 
 
 
 
426
427
428
429
430
431
432
433
@@ -421,15 +421,13 @@
  urls = []   for index in self.selectedRows():   path = self.model().getRow(index)[COL_PATH] - u = QUrl() - u.setPath('file://' + os.path.join(self.repo.root, path)) - urls.append(u) + urls.append(QUrl.fromLocalFile(self.repo.wjoin(path)))   if urls: - d = QDrag(self) - m = QMimeData() - m.setUrls(urls) - d.setMimeData(m) - d.start(Qt.CopyAction) + drag = QDrag(self) + data = QMimeData() + data.setUrls(urls) + drag.setMimeData(data) + drag.start(Qt.CopyAction)     def mousePressEvent(self, event):   self.pressPos = event.pos()
 
19
20
21
22
23
 
24
25
26
 
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
368
369
 
19
20
21
 
 
22
23
24
25
 
343
344
345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
@@ -19,8 +19,7 @@
   from tortoisehg.util import hglib, wconfig  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib, cmdui, thgrepo, rebase, resolve, \ - reporegistry, repotreemodel +from tortoisehg.hgqt import qtlib, cmdui, thgrepo, rebase, resolve    _schemes = ['local', 'ssh', 'http', 'https']   @@ -344,26 +343,23 @@
  known = set(self.paths.values())   known.add(self.repo.root)   related = {} - repoid = self.repo[0].node() - f = QFile(reporegistry.settingsfilename()) - f.open(QIODevice.ReadOnly) - try: - for e in repotreemodel.iterRepoItemFromXml(f): - if e.basenode() != repoid: - continue - try: - repo = thgrepo.repository(path=e.rootpath()) - except error.RepoError: - continue - if repo.root not in known: - related[repo.root] = repo.shortname - known.add(repo.root) - for alias, path in repo.ui.configitems('paths'): - if path not in known: - related[path] = alias - known.add(path) - finally: - f.close() + for root, shortname in thgrepo.relatedRepositories(self.repo[0].node()): + if root not in known: + related[root] = shortname + known.add(root) + if root in thgrepo._repocache: + # repositories already opened keep their ui instances in sync + repo = thgrepo._repocache[root] + ui = repo.ui + else: + # directly read the repository's configuration file + tempui = self.repo.ui.copy() + tempui.readconfig(os.path.join(root, '.hg', 'hgrc')) + ui = tempui + for alias, path in ui.configitems('paths'): + if path not in known: + related[path] = alias + known.add(path)   pairs = [(alias, path) for path, alias in related.items()]   tm = PathsModel(pairs, self)   self.reltv.setModel(tm)
 
7
8
9
10
11
12
13
14
15
16
17
 
18
19
 
 
20
21
22
23
24
25
26
 
 
 
27
28
29
 
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
 
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
 
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
 
7
8
9
 
 
 
10
11
12
13
 
14
15
 
16
17
18
19
20
21
22
 
 
23
24
25
26
27
28
 
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
 
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
 
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
@@ -7,23 +7,22 @@
   import os   -from PyQt4.QtCore import * -from PyQt4.QtGui import * -  from mercurial import error, util    from tortoisehg.util import hglib, i18n  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib +from tortoisehg.hgqt import qtlib, cmdui   -# TODO: Use cmdui.Runner, emit output statements for dock log widget +from PyQt4.QtCore import * +from PyQt4.QtGui import *    keep = i18n.keepgettext()    class TagDialog(QDialog):   - localTagChanged = pyqtSignal() - showMessage = pyqtSignal(unicode) + 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) @@ -31,92 +30,81 @@
  ~Qt.WindowContextHelpButtonHint)     self.repo = repo - - if not tag and rev and rev != 'tip': - for t in repo.nodetags(repo[rev].node()): - if t != 'tip' and t not in repo._bookmarks: - tag = t - break - else: - tag = '' + 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(6) - box.setContentsMargins(*(6,)*4) - base.addLayout(box) + box.setSpacing(8) + box.setContentsMargins(*(8,)*4) + self.layout().addLayout(box)   - ## main layout grid - grid = QGridLayout() - grid.setSpacing(6) - box.addLayout(grid) + 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.tag_combo = QComboBox() - self.tag_combo.setEditable(True) - self.tag_combo.setMinimumWidth(180) - self.tag_combo.setEditText(tag) - self.tag_combo.editTextChanged.connect(self.tag_changed) - grid.addWidget(QLabel(_('Tag:')), 0, 0) - grid.addWidget(self.tag_combo, 0, 1) + 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)   - ### revision input - self.initial_rev = rev - self.rev_text = QLineEdit() - self.rev_text.setMaximumWidth(100) - self.rev_text.setText(rev) - self.rev_text.textEdited.connect(self.update_sensitives) - grid.addWidget(QLabel(_('Revision:')), 1, 0) - grid.addWidget(self.rev_text, 1, 1) + self.tagRevLabel = QLabel('') + form.addRow(_('Tagged:'), self.tagRevLabel)     ### options   expander = qtlib.ExpanderLabel(_('Options'), False)   expander.expanded.connect(self.show_options) - grid.addWidget(expander, 2, 0, 1, 2, Qt.AlignLeft | Qt.AlignTop) + box.addWidget(expander)     optbox = QVBoxLayout()   optbox.setSpacing(6) - grid.addLayout(optbox, 3, 0, 1, 2) + box.addLayout(optbox)     hbox = QHBoxLayout()   hbox.setSpacing(0)   optbox.addLayout(hbox)   - self.local_chk = QCheckBox(_('Local tag')) - self.local_chk.toggled.connect(self.local_toggled) - self.replace_chk = QCheckBox(_('Replace existing tag (-f/--force)')) - self.replace_chk.toggled.connect(self.update_sensitives) - optbox.addWidget(self.local_chk) - optbox.addWidget(self.replace_chk) + 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.eng_chk = QCheckBox(_('Use English commit message')) + self.englishCheckBox = QCheckBox(_('Use English commit message'))   engmsg = repo.ui.configbool('tortoisehg', 'engmsg', False) - self.eng_chk.setChecked(engmsg) - optbox.addWidget(self.eng_chk) + self.englishCheckBox.setChecked(engmsg) + optbox.addWidget(self.englishCheckBox)   - self.custom_chk = QCheckBox(_('Use custom commit message:')) - self.custom_chk.toggled.connect( - lambda e: self.toggle_enabled(e, self.custom_text)) - self.custom_text = QLineEdit() - optbox.addWidget(self.custom_chk) - optbox.addWidget(self.custom_text) + 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 - buttons = QDialogButtonBox() - self.close_btn = buttons.addButton(QDialogButtonBox.Close) - self.close_btn.clicked.connect(self.reject) - self.add_btn = buttons.addButton(_('&Add'), - QDialogButtonBox.ActionRole) - self.add_btn.clicked.connect(self.add_tag) - self.remove_btn = buttons.addButton(_('&Remove'), - QDialogButtonBox.ActionRole) - self.remove_btn.clicked.connect(self.remove_tag) - box.addWidget(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() @@ -129,100 +117,103 @@
  self.status.setContentsMargins(4, 2, 4, 4)   base.addWidget(self.status)   - # dialog setting - self.setLayout(base) - self.layout().setSizeConstraint(QLayout.SetFixedSize) - self.setWindowTitle(_('Tag - %s') % repo.displayname) - self.setWindowIcon(qtlib.geticon('hg-tag')) + self.cmd = cmdui.Runner(False, self) + self.cmd.output.connect(self.output) + self.cmd.makeLogVisible.connect(self.makeLogVisible) + self.cmd.commandFinished.connect(self.onCommandFinished)   - # prepare to show - self.custom_text.setDisabled(True) + 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.update_tagcombo(clear=False)   self.show_options(False) - self.tag_combo.setFocus() - - self.replace_chk.setChecked(bool(opts.get('force'))) - self.local_chk.setChecked(bool(opts.get('local'))) - if not opts.get('local') and opts.get('message'): - self.custom_chk.setChecked(True) - self.custom_text.setText(opts.get('message', '')) - - self.update_sensitives(affectlocal=True) - - ### Private Methods ### - - def update_tagcombo(self, clear=True): - """ update display on dialog with recent repo data """ - tag_name = self.tag_combo.currentText() - self.tag_combo.clear() - - # add tags to drop-down list - tags = list(self.repo.tags()) - tags.sort() - tags.reverse() - for tag in tags: - if tag == 'tip': - continue - self.tag_combo.addItem(hglib.tounicode(tag)) - self.tag_combo.clearEditText() - - # restore tag name - if not clear and tag_name: - self.tag_combo.setEditText(tag_name) + self.tagCombo.setFocus() + self.refresh()     @pyqtSlot() - def update_sensitives(self, affectlocal=False): + 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 """ - tag = self.tag_combo.currentText() - rev = self.rev_text.text() - if not rev or not tag: - self.add_btn.setDisabled(True) - self.remove_btn.setDisabled(True) - return - - # check if valid revision - try: - self.repo[hglib.fromunicode(rev)] - except (error.LookupError, error.RepoLookupError, error.RepoError): - self.add_btn.setDisabled(True) - self.remove_btn.setDisabled(True) - return + tagu = self.tagCombo.currentText() + tag = hglib.fromunicode(tagu)     # check tag existence - force = self.replace_chk.isChecked() - is_exist = hglib.fromunicode(tag) in self.repo.tags() - self.add_btn.setEnabled(not is_exist or force) - self.remove_btn.setEnabled(is_exist) + 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()   - # check if local - is_local = self.repo.tagtype(hglib.fromunicode(tag)) - if affectlocal and is_local is not None: - self.local_chk.setChecked(is_local == 'local') - self.update_revision() + 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 update_revision(self): - """ update revision entry based on tag """ - tagmap = self.repo.tags() - tag = self.tag_combo.currentText() - replace = self.replace_chk.isChecked() - if not tag or hglib.fromunicode(tag) not in tagmap or replace: - if self.initial_rev: - self.rev_text.setText(self.initial_rev) - return - - node = tagmap[hglib.fromunicode(tag)] - ctx = self.repo[node] - self.rev_text.setText(unicode(ctx.rev())) + def customMessageToggle(self, checked): + self.customTextLineEdit.setEnabled(checked) + if checked: + self.customTextLineEdit.setFocus()     def show_options(self, visible): - self.local_chk.setVisible(visible) - self.replace_chk.setVisible(visible) - self.eng_chk.setVisible(visible) - self.custom_chk.setVisible(visible) - self.custom_text.setVisible(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=None): + def set_status(self, text, icon):   self.status.setShown(True)   self.sep.setShown(True)   self.status.set_status(text, icon) @@ -232,112 +223,104 @@
  self.status.setHidden(True)   self.sep.setHidden(True)   - def add_tag(self): - local = self.local_chk.isChecked() - name = self.tag_combo.currentText() - namelocal = hglib.fromunicode(name) - rev = hglib.fromunicode(self.rev_text.text()) - force = self.replace_chk.isChecked() - english = self.eng_chk.isChecked() - message = self.custom_text.text() + def onCommandFinished(self, ret): + if ret == 0: + self.finishfunc()   - try: - # tagging - if namelocal in self.repo.tags() and not force: - raise util.Abort(keep._("Tag '%s' already exist") % namelocal) - if not local: - parents = self.repo.parents() - if len(parents) > 1: - raise util.Abort(keep._('uncommitted merge')) - bheads = self.repo.branchheads() - p1 = parents[0].node() - if not force and bheads and p1 not in bheads: - raise util.Abort(keep._('not at a branch head (use force)')) - ctx = self.repo[rev] - node = ctx.node() + 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]   msgset = keep._('Added tag %s for changeset %s')   message = (english and msgset['id'] or msgset['str']) \ - % (namelocal, str(ctx)) + % (tag, str(ctx))   if not isinstance(message, str):   message = hglib.fromunicode(message)   - self.repo.incrementBusyCount() - self.repo.tag(namelocal, node, message, local, None, None) - self.repo.decrementBusyCount() - if local: - self.localTagChanged.emit() + 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)   - # update UI - self.set_status(_("Tag '%s' has been added") % name, True) - self.update_tagcombo() - self.close_btn.setFocus() - except util.Abort, e: - self.set_status(_('Abort: ') + hglib.tounicode(str(e)), False) - except Exception, e: - self.set_status(_('Error: ') + hglib.tounicode(str(e)), False) + cmd = ['tag', '--repository', self.repo.root, '--rev', str(self.rev)] + 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 remove_tag(self): - local = self.local_chk.isChecked() - name = self.tag_combo.currentText() - namelocal = hglib.fromunicode(name) - english = self.eng_chk.isChecked() - message = hglib.fromunicode(self.custom_text.text()) + 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   - try: - # tagging - tagtype = self.repo.tagtype(namelocal) - if local: - if tagtype != 'local': - raise util.Abort(keep._('tag \'%s\' is not a local tag') % - namelocal) - else: - if tagtype != 'global': - raise util.Abort(keep._('tag \'%s\' is not a global tag') % - namelocal) - parents = self.repo.parents() - if len(parents) > 1: - raise util.Abort(keep._('uncommitted merge')) - bheads = self.repo.branchheads() - p1 = parents[0].node() - if not force and bheads and p1 not in bheads: - raise util.Abort(keep._('not at a branch head (use force)')) + 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']) % namelocal + message = (english and msgset['id'] or msgset['str']) % tag + if not isinstance(message, str): + message = hglib.fromunicode(message)   - self.repo.incrementBusyCount() - node = self.repo[-1].node() - self.repo.tag(namelocal, node, message, local, None, None) - self.repo.decrementBusyCount() - if local: - self.localTagChanged.emit() + def finished(): + self.set_status(_("Tag '%s' has been removed") % tagu, True)   - # update UI - self.set_status(_("Tag '%s' has been removed") % name, True) - self.update_tagcombo() - self.close_btn.setFocus() - except util.Abort, e: - self.set_status(_('Abort: ') + hglib.tounicode(str(e)), False) - except Exception, e: - self.set_status(_('Error: ') + hglib.tounicode(str(e)), False) - - ### Signal Handlers ### - - def local_toggled(self, checked): - self.eng_chk.setEnabled(not checked) - self.custom_chk.setEnabled(not checked) - custom = self.custom_chk.isChecked() - self.custom_text.setEnabled(not checked and custom) - - def tag_changed(self, combo): - self.update_revision() - self.update_sensitives(True) - - def toggle_enabled(self, checked, target): - target.setEnabled(checked) - if checked: - target.setFocus() + 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 run(ui, *pats, **opts):   kargs = {}
 
131
132
133
 
134
135
136
 
596
597
598
 
 
 
 
 
 
 
 
 
 
 
 
 
131
132
133
134
135
136
137
 
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
@@ -131,6 +131,7 @@
  def _getrepomtime(self):   'Return the last modification time for the repo'   watchedfiles = [self.repo.sjoin('00changelog.i')] + watchedfiles.append(self.repo.join('localtags'))   watchedfiles.append(self.repo.join('bookmarks'))   watchedfiles.append(self.repo.join('bookmarks.current'))   if hasattr(self.repo, 'mq'): @@ -596,3 +597,15 @@
  yield root, file, status   except (EnvironmentError, error.Abort, error.RepoError):   pass + +def relatedRepositories(repoid): + 'Yields root paths for local related repositories' + from tortoisehg.hgqt import reporegistry, repotreemodel + f = QFile(reporegistry.settingsfilename()) + f.open(QIODevice.ReadOnly) + try: + for e in repotreemodel.iterRepoItemFromXml(f): + if e.basenode() == repoid: + yield e.rootpath(), e.shortname() + finally: + f.close()
 
19
20
21
 
22
23
24
25
26
 
27
28
29
 
19
20
21
22
23
24
25
26
27
28
29
30
31
@@ -19,11 +19,13 @@
  <File Name="PyQt4.Qsci.pyd" />   <File Name="PyQt4.QtCore.pyd" />   <File Name="PyQt4.QtGui.pyd" /> + <File Name="PyQt4.QtNetwork.pyd" />   <File Name="python26.dll" />   <File Name="pythoncom26.dll" />   <File Name="pywintypes26.dll" />   <File Name="QtCore4.dll" />   <File Name="QtGui4.dll" /> + <File Name="QtNetwork4.dll" />   <File Name="QtSvg4.dll" />   <File Name="QtXml4.dll" />   <File Name="qscintilla2.dll" />
 
33
34
35
36
 
37
38
39
 
33
34
35
 
36
37
38
39
@@ -33,7 +33,7 @@
  <?define templates.static.guid = {ECF8D1EF-910D-4586-9508-86A6236B4FD5} ?>     <!-- dist.wxs --> - <?define dist.guid = {A9CAD8C1-4966-45E6-8311-DE9FE555D6D1} ?> + <?define dist.guid = {82AD6653-B84F-4f73-B4AC-755D6CAA8F55} ?>   <?define imageformats.guid = {056DFB00-3EB1-4ACA-A43B-55CD5004DED1} ?>     <!-- cmenu-i18n.wxs -->