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