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