197 @return list of parent revisions (list of strings) |
197 @return list of parent revisions (list of strings) |
198 """ |
198 """ |
199 errMsg = "" |
199 errMsg = "" |
200 parents = [] |
200 parents = [] |
201 |
201 |
202 args = [] |
202 if int(rev) > 0: |
203 args.append("parents") |
203 args = [] |
204 if self.mode == "incoming": |
204 args.append("parents") |
205 if self.bundle: |
205 if self.mode == "incoming": |
206 args.append("--repository") |
206 if self.bundle: |
207 args.append(self.bundle) |
207 args.append("--repository") |
208 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile): |
208 args.append(self.bundle) |
209 args.append("--repository") |
209 elif self.vcs.bundleFile and os.path.exists(self.vcs.bundleFile): |
210 args.append(self.vcs.bundleFile) |
210 args.append("--repository") |
211 args.append("--template") |
211 args.append(self.vcs.bundleFile) |
212 args.append("{rev}:{node|short}\n") |
212 args.append("--template") |
213 args.append("-r") |
213 args.append("{rev}:{node|short}\n") |
214 args.append(rev) |
214 args.append("-r") |
215 if not self.projectMode: |
215 args.append(rev) |
216 args.append(self.filename) |
216 if not self.projectMode: |
217 |
217 args.append(self.filename) |
218 output = "" |
218 |
219 if self.__hgClient: |
219 output = "" |
220 output, errMsg = self.__hgClient.runcommand(args) |
220 if self.__hgClient: |
221 else: |
221 output, errMsg = self.__hgClient.runcommand(args) |
222 process = QProcess() |
222 else: |
223 process.setWorkingDirectory(self.repodir) |
223 process = QProcess() |
224 process.start('hg', args) |
224 process.setWorkingDirectory(self.repodir) |
225 procStarted = process.waitForStarted() |
225 process.start('hg', args) |
226 if procStarted: |
226 procStarted = process.waitForStarted() |
227 finished = process.waitForFinished(30000) |
227 if procStarted: |
228 if finished and process.exitCode() == 0: |
228 finished = process.waitForFinished(30000) |
229 output = \ |
229 if finished and process.exitCode() == 0: |
230 str(process.readAllStandardOutput(), |
230 output = \ |
231 Preferences.getSystem("IOEncoding"), |
231 str(process.readAllStandardOutput(), |
232 'replace') |
232 Preferences.getSystem("IOEncoding"), |
|
233 'replace') |
|
234 else: |
|
235 if not finished: |
|
236 errMsg = self.trUtf8( |
|
237 "The hg process did not finish within 30s.") |
233 else: |
238 else: |
234 if not finished: |
239 errMsg = self.trUtf8("Could not start the hg executable.") |
235 errMsg = self.trUtf8("The hg process did not finish within 30s.") |
240 |
236 else: |
241 if errMsg: |
237 errMsg = self.trUtf8("Could not start the hg executable.") |
242 E5MessageBox.critical(self, |
238 |
243 self.trUtf8("Mercurial Error"), |
239 if errMsg: |
244 errMsg) |
240 E5MessageBox.critical(self, |
245 |
241 self.trUtf8("Mercurial Error"), |
246 if output: |
242 errMsg) |
247 parents = [p for p in output.strip().splitlines()] |
243 |
|
244 if output: |
|
245 parents = [p for p in output.strip().splitlines()] |
|
246 |
248 |
247 return parents |
249 return parents |
248 |
250 |
249 def __procFinished(self, exitCode, exitStatus): |
251 def __procFinished(self, exitCode, exitStatus): |
250 """ |
252 """ |