Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

hgqt: replace hglib.get_reponame() with thgrepo.displayname

Changeset 00148f902968

Parent 3b71230d68f2

by Steve Borho

Changes to 14 files · Browse files at 00148f902968 Showing diff from parent 3b71230d68f2 Diff from another changeset...

 
157
158
159
160
161
 
162
163
164
 
157
158
159
 
 
160
161
162
163
@@ -157,8 +157,7 @@
  self.update_path()     # dialog setting - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_('Archive - %s') % hglib.tounicode(reponame)) + self.setWindowTitle(_('Archive - %s') % self.repo.displayname)   self.setWindowIcon(qtlib.geticon('archive'))   self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)   self.setLayout(self.vbox)
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
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
 # backout.py - Backout 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 PyQt4.QtCore import *  from PyQt4.QtGui import *    from mercurial import hg, ui    from tortoisehg.util import hglib, paths  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt import qtlib, csinfo, i18n, cmdui    keep = i18n.keepgettext()    class BackoutDialog(QDialog):     def __init__(self, repo=None, rev='tip', parent=None, opts={}):   super(BackoutDialog, self).__init__(parent)   self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)     self.ui = ui.ui()   if repo:   self.repo = repo   else:   root = paths.find_root()   if root:   self.repo = hg.repository(self.ui, path=root)   else:   raise 'not repository'     # main layout box   box = QVBoxLayout()   box.setSpacing(8)   box.setContentsMargins(*(6,)*4)     ## target revision   target_sep = qtlib.LabeledSeparator(_('Target changeset'))   box.addWidget(target_sep)     style = csinfo.panelstyle(selectable=True)   self.target_info = csinfo.create(self.repo, rev, style, withupdate=True)   box.addWidget(self.target_info)     ## backout message   msg_sep = qtlib.LabeledSeparator(_('Backout commit message'))   box.addWidget(msg_sep)     revhex = self.target_info.get_data('revid')   self.msgset = keep._('Backed out changeset: ')   self.msgset['id'] += revhex   self.msgset['str'] += revhex     self.msg_text = QTextEdit()   self.msg_text.setText(self.msgset['str'])   box.addWidget(self.msg_text, 1)     ## options   opt_sep = qtlib.LabeledSeparator(_('Options'))   box.addWidget(opt_sep)     obox = QVBoxLayout()   obox.setSpacing(3)   box.addLayout(obox)     self.eng_chk = QCheckBox(_('Use English backout message'))   self.eng_chk.toggled.connect(self.eng_toggled)   engmsg = self.repo.ui.configbool('tortoisehg', 'engmsg', False)   self.eng_chk.setChecked(engmsg)     obox.addWidget(self.eng_chk)   self.merge_chk = QCheckBox(_('Merge with old dirstate parent '   'after backout'))   obox.addWidget(self.merge_chk)     ## command widget   self.cmd = cmdui.Widget()   self.cmd.commandStarted.connect(self.command_started)   self.cmd.commandFinished.connect(self.command_finished)   self.cmd.commandCanceling.connect(self.command_canceling)   box.addWidget(self.cmd, 2)     ## bottom buttons   buttons = QDialogButtonBox()   self.cancel_btn = buttons.addButton(QDialogButtonBox.Cancel)   self.cancel_btn.clicked.connect(self.cancel_clicked)   self.close_btn = buttons.addButton(QDialogButtonBox.Close)   self.close_btn.clicked.connect(self.reject)   self.backout_btn = buttons.addButton(_('&Backout'),   QDialogButtonBox.ActionRole)   self.backout_btn.clicked.connect(self.backout)   self.detail_btn = buttons.addButton(_('Detail'),   QDialogButtonBox.ResetRole)   self.detail_btn.setAutoDefault(False)   self.detail_btn.setCheckable(True)   self.detail_btn.toggled.connect(self.detail_toggled)   box.addWidget(buttons)     # dialog setting   self.setLayout(box)   self.setMinimumWidth(480)   self.setMaximumHeight(800)   self.resize(0, 340) - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_("Backout '%s' - %s") \ - % (revhex, hglib.tounicode(reponame))) + self.setWindowTitle(_("Backout '%s' - %s") % (revhex, + self.repo.displayname))     self.merge_chk.setChecked(bool(opts.get('merge')))     # prepare to show   self.cmd.setHidden(True)   self.cancel_btn.setHidden(True)   self.detail_btn.setHidden(True)   self.msg_text.setFocus()   cursor = self.msg_text.textCursor()   cursor.movePosition(QTextCursor.EndOfBlock)   self.msg_text.setTextCursor(cursor)     ### Private Methods ###     def eng_toggled(self, checked):   msg = self.msg_text.toPlainText()   origmsg = (checked and self.msgset['str'] or self.msgset['id'])   if msg != origmsg:   if not qtlib.QuestionMsgBox(_('Confirm Discard Message'),   _('Discard current backout message?'), parent=self):   self.eng_chk.blockSignals(True)   self.eng_chk.setChecked(not checked)   self.eng_chk.blockSignals(False)   return   newmsg = (checked and self.msgset['id'] or self.msgset['str'])   self.msg_text.setText(newmsg)     def backout(self):   # prepare command line   msg = self.msg_text.toPlainText()   revhex = self.target_info.get_data('revid')   cmdline = ['backout', '--rev', revhex, '--repository', self.repo.root]   if self.merge_chk.isChecked():   cmdline += ['--merge']   cmdline += ['--message', hglib.fromunicode(msg)]     # start backing out   self.repo.incrementBusyCount()   self.cmd.run(cmdline)     ### Signal Handlers ###     def cancel_clicked(self):   self.cmd.cancel()     def detail_toggled(self, checked):   self.cmd.show_output(checked)     def command_started(self):   self.cmd.setShown(True)   self.close_btn.setHidden(True)   self.cancel_btn.setShown(True)   self.detail_btn.setShown(True)     def command_finished(self, wrapper):   self.repo.decrementBusyCount()   if wrapper.data is not 0 or self.cmd.is_show_output():   self.detail_btn.setChecked(True)   self.close_btn.setShown(True)   self.close_btn.setAutoDefault(True)   self.close_btn.setFocus()   self.cancel_btn.setHidden(True)   else:   self.accept()     def command_canceling(self):   self.cancel_btn.setDisabled(True)    def run(ui, *pats, **opts):   kargs = {'opts': opts}   if opts.get('rev'):   kargs['rev'] = opts.get('rev')   elif len(pats) == 1:   kargs['rev'] = pats[0]   return BackoutDialog(**kargs)
 
761
762
763
764
765
 
766
767
768
 
917
918
919
920
921
 
922
923
924
 
761
762
763
 
 
764
765
766
767
 
916
917
918
 
 
919
920
921
922
@@ -761,8 +761,7 @@
  self.bb = bb   layout.addWidget(bb)   - name = hglib.get_reponame(self.repo) - self.setWindowTitle('%s - commit details' % name) + self.setWindowTitle('%s - commit details' % self.repo.displayname)     def newPatch(self):   name = hglib.fromunicode(self.patchle.text()) @@ -917,8 +916,7 @@
  commit.commitComplete.connect(self.postcommit)   commit.commitButtonName.connect(self.setButtonName)   - name = hglib.get_reponame(commit.repo) - self.setWindowTitle('%s - commit' % name) + self.setWindowTitle('%s - commit' % commit.repo.displayname)   self.commit = commit   self.commit.reload()  
 
34
35
36
37
38
 
39
40
41
 
34
35
36
 
 
37
38
39
40
@@ -34,8 +34,7 @@
  self.pats = pats   self.thread = None   - reponame = hglib.get_reponame(repo) - self.setWindowTitle(_('Detect Copies/Renames in %s') % reponame) + self.setWindowTitle(_('Detect Copies/Renames in %s') % repo.displayname)   self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)     layout = QVBoxLayout()
 
36
37
38
39
 
40
41
42
 
36
37
38
 
39
40
41
42
@@ -36,7 +36,7 @@
    self.repo = repo   self.pats = pats - self.setWindowTitle(_('Ignore filter - %s') % hglib.get_reponame(repo)) + self.setWindowTitle(_('Ignore filter - %s') % repo.displayname)     vbox = QVBoxLayout()   self.setLayout(vbox)
 
39
40
41
42
43
 
44
45
46
 
39
40
41
 
 
42
43
44
45
@@ -39,8 +39,7 @@
  self.other = str(other)   self.local = str(self.repo.parents()[0].rev())   - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_('Merge - %s') % hglib.tounicode(reponame)) + self.setWindowTitle(_('Merge - %s') % self.repo.displayname)   self.setWindowIcon(qtlib.geticon('merge'))   self.setMinimumSize(600, 512)   self.setOption(QWizard.DisabledBackButtonOnLastPage, True)
 
15
16
17
18
 
19
20
21
 
35
36
37
38
 
39
40
41
 
42
43
44
 
15
16
17
 
18
19
20
21
 
35
36
37
 
38
39
40
 
41
42
43
44
@@ -15,7 +15,7 @@
 from tortoisehg.hgqt.i18n import _  from tortoisehg.util import hglib, shlib, paths   -from tortoisehg.hgqt import qtlib, status, cmdui +from tortoisehg.hgqt import qtlib, status, cmdui, thgrepo    LABELS = { 'add': (_('Checkmark files to add'), _('Add')),   'forget': (_('Checkmark files to forget'), _('Forget')), @@ -35,10 +35,10 @@
  command = 'remove'   self.command = command   - repo = hg.repository(ui.ui(), path=paths.find_root()) + repo = thgrepo.repository(path=paths.find_root())   assert repo   os.chdir(repo.root) - self.setWindowTitle('%s - hg %s' % (hglib.get_reponame(repo), command)) + self.setWindowTitle('%s - hg %s' % repo.displayname, command))     layout = QVBoxLayout()   self.setLayout(layout)
 
152
153
154
155
 
156
157
158
 
152
153
154
 
155
156
157
158
@@ -152,7 +152,7 @@
    def setRenameCopy(self):   if self.windowTitle() == '': - self.reponame = hglib.tounicode(hglib.get_reponame(self.repo)) + self.reponame = self.repo.displayname   if self.copy_chk.isChecked():   wt = (_('Copy - %s') % self.reponame)   self.rename_btn.setText(_('Copy'))
 
198
199
200
201
202
 
203
204
205
 
206
207
208
 
198
199
200
 
 
201
202
 
 
203
204
205
206
@@ -198,11 +198,9 @@
    def getTitle(self):   if self.pats: - return hglib.tounicode(_('%s - status (selection filtered)') % - hglib.get_reponame(self.repo)) + return _('%s - status (selection filtered)') % self.repo.displayname   else: - return hglib.tounicode(_('%s - status') % - hglib.get_reponame(self.repo)) + return _('%s - status') % self.repo.displayname     def restoreState(self, data):   return self.split.restoreState(data)
 
142
143
144
145
146
 
147
148
149
 
142
143
144
 
 
145
146
147
148
@@ -142,8 +142,7 @@
  # dialog setting   self.setLayout(base)   self.layout().setSizeConstraint(QLayout.SetFixedSize) - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_('Tag - %s') % hglib.tounicode(reponame)) + self.setWindowTitle(_('Tag - %s') % self.repo.displayname)   self.setWindowIcon(qtlib.geticon('tag'))     # prepare to show
 
119
120
121
122
123
 
124
125
126
 
119
120
121
 
 
122
123
124
125
@@ -119,8 +119,7 @@
  # dialog setting   self.setLayout(box)   self.layout().setSizeConstraint(QLayout.SetMinAndMaxSize) - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_('Import - %s') % hglib.tounicode(reponame)) + self.setWindowTitle(_('Import - %s') % self.repo.displayname)   #self.setWindowIcon(qtlib.geticon('import'))     # prepare to show
 
122
123
124
125
126
 
127
128
129
 
122
123
124
 
 
125
126
127
128
@@ -122,8 +122,7 @@
  # dialog setting   self.setLayout(box)   self.layout().setSizeConstraint(QLayout.SetMinAndMaxSize) - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_('Strip - %s') % hglib.tounicode(reponame)) + self.setWindowTitle(_('Strip - %s') % self.repo.displayname)   #self.setWindowIcon(qtlib.geticon('strip'))     # prepare to show
 
140
141
142
143
144
 
145
146
147
 
140
141
142
 
 
143
144
145
146
@@ -140,8 +140,7 @@
  # dialog setting   self.setLayout(box)   self.layout().setSizeConstraint(QLayout.SetFixedSize) - reponame = hglib.get_reponame(self.repo) - self.setWindowTitle(_('Update - %s') % hglib.tounicode(reponame)) + self.setWindowTitle(_('Update - %s') % self.repo.displayname)   self.setWindowIcon(qtlib.geticon('update'))     # prepare to show
 
17
18
19
20
 
21
22
23
 
276
277
278
279
 
280
281
282
 
326
327
328
329
 
330
331
332
 
563
564
565
566
 
567
568
569
 
17
18
19
 
20
21
22
23
 
276
277
278
 
279
280
281
282
 
326
327
328
 
329
330
331
332
 
563
564
565
 
566
567
568
569
@@ -17,7 +17,7 @@
   from tortoisehg.hgqt.i18n import _  from tortoisehg.util import hglib, paths -from tortoisehg.hgqt import qtlib +from tortoisehg.hgqt import qtlib, thgrepo    from PyQt4 import QtCore  from PyQt4 import QtGui @@ -276,7 +276,7 @@
  replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b,   plabel1=label1a, plabel2=label1b,   phash1=str(ctx1a), phash2=str(ctx1b), - repo=hglib.get_reponame(repo), + repo=hglib.fromunicode(repo.displayname),   clabel=label2, child=dir2, chash=str(ctx2))   launchtool(diffcmd, args, replace, True)   @@ -326,7 +326,7 @@
  title += _(' filtered')     self.resize(400, 250) - self.reponame = hglib.get_reponame(repo) + self.reponame = hglib.fromunicode(repo.displayname)     self.ctxs = (ctx1a, ctx1b, ctx2)   self.copies = cpy @@ -563,7 +563,7 @@
 def run(ui, *pats, **opts):   try:   path = opts.get('bundle') or paths.find_root() - repo = hg.repository(ui, path=path) + repo = thgrepo.repository(ui, path=path)   except error.RepoError:   ui.warn(_('No repository found here') + '\n')   return None