Show More
@@ -149,6 +149,7 b' def get_obfuscated_url(url_obj):' | |||||
149 |
|
149 | |||
150 |
|
150 | |||
151 | class GitRemote(RemoteBase): |
|
151 | class GitRemote(RemoteBase): | |
|
152 | COMMIT_ID_PAT = re.compile(rb'[0-9a-fA-F]{40}') | |||
152 |
|
153 | |||
153 | def __init__(self, factory): |
|
154 | def __init__(self, factory): | |
154 | self._factory = factory |
|
155 | self._factory = factory | |
@@ -633,6 +634,14 b' class GitRemote(RemoteBase):' | |||||
633 | return new_commit_id |
|
634 | return new_commit_id | |
634 |
|
635 | |||
635 | @reraise_safe_exceptions |
|
636 | @reraise_safe_exceptions | |
|
637 | def compare_commits(self, wire, commit_id1, commit_id2): | |||
|
638 | output, __ = self.run_git_command( | |||
|
639 | wire, ['log', '--reverse', '--pretty=format: %H', '-s', | |||
|
640 | f'{commit_id1}..{commit_id2}']) | |||
|
641 | commits = [safe_str(commit_id) for commit_id in self.COMMIT_ID_PAT.findall(output)] | |||
|
642 | return commits | |||
|
643 | ||||
|
644 | @reraise_safe_exceptions | |||
636 | def commit(self, wire, commit_data, branch, commit_tree, updated, removed): |
|
645 | def commit(self, wire, commit_data, branch, commit_tree, updated, removed): | |
637 |
|
646 | |||
638 | def mode2pygit(mode): |
|
647 | def mode2pygit(mode): | |
@@ -872,6 +881,14 b' class GitRemote(RemoteBase):' | |||||
872 | return revs |
|
881 | return revs | |
873 |
|
882 | |||
874 | @reraise_safe_exceptions |
|
883 | @reraise_safe_exceptions | |
|
884 | def get_common_ancestor(self, wire, rev1, rev2): | |||
|
885 | repo_init = self._factory.repo_libgit2(wire) | |||
|
886 | with repo_init as repo: | |||
|
887 | ancestor_id = repo.merge_base(rev1, rev2) | |||
|
888 | ||||
|
889 | return str(ancestor_id) | |||
|
890 | ||||
|
891 | @reraise_safe_exceptions | |||
875 | def get_object(self, wire, sha, maybe_unreachable=False): |
|
892 | def get_object(self, wire, sha, maybe_unreachable=False): | |
876 | cache_on, context_uid, repo_id = self._cache_on(wire) |
|
893 | cache_on, context_uid, repo_id = self._cache_on(wire) | |
877 | region = self._region(wire) |
|
894 | region = self._region(wire) |
General Comments 0
You need to be logged in to leave comments.
Login now