Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py

changeset 213
42bb97ff0bbb
parent 212
19785b4c1bed
child 214
eb1cf9398a3f
equal deleted inserted replaced
212:19785b4c1bed 213:42bb97ff0bbb
26 Class implementing a dialog to show the output of the hg log command process. 26 Class implementing a dialog to show the output of the hg log command process.
27 27
28 The dialog is nonmodal. Clicking a link in the upper text pane shows 28 The dialog is nonmodal. Clicking a link in the upper text pane shows
29 a diff of the revisions. 29 a diff of the revisions.
30 """ 30 """
31 def __init__(self, vcs, mode = "log", parent = None): 31 def __init__(self, vcs, mode = "log", bundle = None, parent = None):
32 """ 32 """
33 Constructor 33 Constructor
34 34
35 @param vcs reference to the vcs object 35 @param vcs reference to the vcs object
36 @param mode mode of the dialog (string; one of log, incoming, outgoing) 36 @param mode mode of the dialog (string; one of log, incoming, outgoing)
37 @param bundle name of a bundle file (string)
37 @param parent parent widget (QWidget) 38 @param parent parent widget (QWidget)
38 """ 39 """
39 QWidget.__init__(self, parent) 40 QWidget.__init__(self, parent)
40 self.setupUi(self) 41 self.setupUi(self)
41 42
45 self.vcs = vcs 46 self.vcs = vcs
46 if mode in ("log", "incoming", "outgoing"): 47 if mode in ("log", "incoming", "outgoing"):
47 self.mode = mode 48 self.mode = mode
48 else: 49 else:
49 self.mode = "log" 50 self.mode = "log"
51 self.bundle = bundle
50 52
51 self.contents.setHtml(\ 53 self.contents.setHtml(\
52 self.trUtf8('<b>Processing your request, please wait...</b>')) 54 self.trUtf8('<b>Processing your request, please wait...</b>'))
53 55
54 self.connect(self.process, SIGNAL('finished(int, QProcess::ExitStatus)'), 56 self.connect(self.process, SIGNAL('finished(int, QProcess::ExitStatus)'),
127 if self.mode == "log": 129 if self.mode == "log":
128 args.append('--copies') 130 args.append('--copies')
129 args.append('--style') 131 args.append('--style')
130 args.append(os.path.join(os.path.dirname(__file__), "styles", "logDialog.style")) 132 args.append(os.path.join(os.path.dirname(__file__), "styles", "logDialog.style"))
131 if self.mode == "incoming": 133 if self.mode == "incoming":
132 project = e5App().getObject("Project") 134 if self.bundle:
133 self.vcs.bundleFile = os.path.join( 135 args.append(self.bundle)
134 project.getProjectManagementDir(), "hg-bundle.hg") 136 else:
135 args.append('--bundle') 137 project = e5App().getObject("Project")
136 args.append(self.vcs.bundleFile) 138 self.vcs.bundleFile = os.path.join(
139 project.getProjectManagementDir(), "hg-bundle.hg")
140 args.append('--bundle')
141 args.append(self.vcs.bundleFile)
137 if not self.projectMode: 142 if not self.projectMode:
138 args.append(self.filename) 143 args.append(self.filename)
139 144
140 self.process.setWorkingDirectory(self.repodir) 145 self.process.setWorkingDirectory(self.repodir)
141 146
161 parents = [] 166 parents = []
162 167
163 process = QProcess() 168 process = QProcess()
164 args = [] 169 args = []
165 args.append("parents") 170 args.append("parents")
166 if self.mode == "incoming" and self.vcs.bundleFile: 171 if self.mode == "incoming":
167 args.append("--repository") 172 if self.bundle:
168 args.append(self.vcs.bundleFile) 173 args.append("--repository")
169 args.append("--template") 174 args.append(self.bundle)
170 args.append("{rev}:{node|short}\n") 175 elif self.vcs.bundleFile:
171 args.append("-r") 176 args.append("--repository")
172 args.append(rev) 177 args.append(self.vcs.bundleFile)
173 if not self.projectMode: 178 if not self.projectMode:
174 args.append(self.filename) 179 args.append(self.filename)
175 180
176 process.setWorkingDirectory(self.repodir) 181 process.setWorkingDirectory(self.repodir)
177 process.start('hg', args) 182 process.start('hg', args)
367 372
368 if self.diff: 373 if self.diff:
369 del self.diff 374 del self.diff
370 self.diff = HgDiffDialog(self.vcs) 375 self.diff = HgDiffDialog(self.vcs)
371 self.diff.show() 376 self.diff.show()
372 self.diff.start(filename, [v1, v2]) 377 self.diff.start(filename, [v1, v2], self.bundle)
373 378
374 def on_passwordCheckBox_toggled(self, isOn): 379 def on_passwordCheckBox_toggled(self, isOn):
375 """ 380 """
376 Private slot to handle the password checkbox toggled. 381 Private slot to handle the password checkbox toggled.
377 382

eric ide

mercurial