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

stable bookmark: show revision hash

Changeset 1970e420cc95

Parent 035a7d8c6878

by Steve Borho

Changes to one file · Browse files at 1970e420cc95 Showing diff from parent 035a7d8c6878 Diff from another changeset...

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
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
 # bookmark.py - Bookmark dialog for TortoiseHg  #  # Copyright 2010 Michal De Wildt <michael.dewildt@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.    import os    from PyQt4.QtCore import *  from PyQt4.QtGui import *    from mercurial import error    from tortoisehg.util import hglib, i18n  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, cmdui    keep = i18n.keepgettext()    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):   super(BookmarkDialog, self).__init__(parent)   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)     box = QVBoxLayout()   box.setSpacing(8)   box.setContentsMargins(*(8,)*4)   self.layout().addLayout(box)     ## main layout grid   form = QFormLayout(fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow)   box.addLayout(form)   - form.addRow(_('Revision:'), QLabel(str(rev))) + form.addRow(_('Revision:'), QLabel('%d (%s)' % (rev, repo[rev])))     ### bookmark combo   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.newNameEdit = QLineEdit()   self.newNameEdit.textEdited.connect(self.bookmarkTextChanged)   form.addRow(_('New Name:'), self.newNameEdit)     ## bottom 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)     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)   self.layout().addWidget(self.sep)     ## status line   self.status = qtlib.StatusLabel()   self.status.setContentsMargins(4, 2, 4, 4)   self.layout().addWidget(self.status)     # dialog setting   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.refresh()   self.repo.repositoryChanged.connect(self.refresh)   self.bookmarkCombo.setFocus()   self.bookmarkTextChanged()     def refresh(self):   """ update display on dialog with recent repo data """   # 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.bookmarkCombo.addItem(hglib.tounicode(bookmark))   if cur:   self.bookmarkCombo.setEditText(cur)   else:   self.bookmarkTextChanged()     @pyqtSlot()   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)   self.sep.setShown(True)   self.status.set_status(text, icon)   self.showMessage.emit(text)     def clear_status(self):   self.status.setHidden(True)   self.sep.setHidden(True)     def commandFinished(self, ret):   if ret is 0:   self.bookmarkCombo.clearEditText()   self.newNameEdit.setText('')   self.finishfunc()     def add_bookmark(self):   bookmark = self.bookmarkCombo.currentText()   bookmarklocal = hglib.fromunicode(bookmark)   if bookmarklocal in self.repo._bookmarks:   self.set_status(_('A bookmark named "%s" already exists') %   bookmark, False)   return     def finished():   self.set_status(_("Bookmark '%s' has been added") % bookmark, True)     cmdline = ['bookmark', '--repository', self.repo.root,   '--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.bookmarkCombo.currentText()   bookmarklocal = hglib.fromunicode(bookmark)   if bookmarklocal not in self.repo._bookmarks:   self.set_status(_("Bookmark '%s' does not exist") % bookmark, False)   return     def finished():   self.set_status(_("Bookmark '%s' has been removed") % bookmark, True)     cmdline = ['bookmark', '--repository', self.repo.root,   '--delete', bookmarklocal]   self.cmd.run(cmdline)   self.finishfunc = finished     def rename_bookmark(self):   name = self.bookmarkCombo.currentText()   namelocal = hglib.fromunicode(name)     newname = self.newNameEdit.text()   newnamelocal = hglib.fromunicode(newname)   if namelocal not in self.repo._bookmarks:   self.set_status(_("Bookmark '%s' does not exist") % name, False)   return     if newnamelocal in self.repo._bookmarks:   self.set_status(_('A bookmark named "%s" already exists') %   newname, False)   return     def finished():   self.set_status(_("Bookmark '%s' has been renamed to '%s'") %   (name, newname), True)     cmdline = ['bookmark', '--repository', self.repo.root,   '--rename', namelocal, newnamelocal]   self.cmd.run(cmdline)   self.finishfunc = finished