##// END OF EJS Templates
git: use rev-list for fetching last commit data inc ase of single commit. It's faster that using git log
marcink -
r3459:57dba41e default
parent child Browse files
Show More
@@ -309,10 +309,14 b' class GitCommit(base.BaseCommit):'
309 self._get_filectx(path)
309 self._get_filectx(path)
310 f_path = safe_str(path)
310 f_path = safe_str(path)
311
311
312 cmd = ['log']
312 # optimize for n==1, rev-list is much faster for that use-case
313 if limit:
313 if limit == 1:
314 cmd.extend(['-n', str(safe_int(limit, 0))])
314 cmd = ['rev-list', '-1', self.raw_id, '--', f_path]
315 cmd.extend(['--pretty=format: %H', '-s', self.raw_id, '--', f_path])
315 else:
316 cmd = ['log']
317 if limit:
318 cmd.extend(['-n', str(safe_int(limit, 0))])
319 cmd.extend(['--pretty=format: %H', '-s', self.raw_id, '--', f_path])
316
320
317 output, __ = self.repository.run_git_command(cmd)
321 output, __ = self.repository.run_git_command(cmd)
318 commit_ids = re.findall(r'[0-9a-fA-F]{40}', output)
322 commit_ids = re.findall(r'[0-9a-fA-F]{40}', output)
General Comments 0
You need to be logged in to leave comments. Login now