##// END OF EJS Templates
compare: let _get_changesets work on the already resolved revisions
Mads Kiilerich -
r4041:15f48258 default
parent child Browse files
Show More
@@ -96,16 +96,10 b' class CompareController(BaseRepoControll'
96 redirect(h.url('summary_home', repo_name=repo.repo_name))
96 redirect(h.url('summary_home', repo_name=repo.repo_name))
97 raise HTTPBadRequest()
97 raise HTTPBadRequest()
98
98
99 def _get_changesets(self, alias, org_repo, org_ref, other_repo, other_ref, merge):
99 def _get_changesets(self, alias, org_repo, org_rev, other_repo, other_rev, merge):
100 """
100 """
101 Returns a list of changesets that can be merged from org_repo@org_ref
101 Returns a list of changesets that can be merged from org_repo@org_rev
102 to other_repo@other_ref ... and the ancestor that would be used for merge
102 to other_repo@other_rev ... and the ancestor that would be used for merge
103
104 :param org_repo:
105 :param org_ref:
106 :param other_repo:
107 :param other_ref:
108 :param tmp:
109 """
103 """
110
104
111 ancestor = None
105 ancestor = None
@@ -116,22 +110,6 b' class CompareController(BaseRepoControll'
116 ancestor = org_rev
110 ancestor = org_rev
117
111
118 elif alias == 'hg':
112 elif alias == 'hg':
119 # lookup up the exact node id
120 _revset_predicates = {
121 'branch': 'branch',
122 'book': 'bookmark',
123 'tag': 'tag',
124 'rev': 'id',
125 }
126
127 org_rev_spec = "max(%s(%%s))" % _revset_predicates[org_ref[0]]
128 org_revs = org_repo._repo.revs(org_rev_spec, safe_str(org_ref[1]))
129 org_rev = org_repo._repo[org_revs[-1] if org_revs else -1].hex()
130
131 other_revs_spec = "max(%s(%%s))" % _revset_predicates[other_ref[0]]
132 other_revs = other_repo._repo.revs(other_revs_spec, safe_str(other_ref[1]))
133 other_rev = other_repo._repo[other_revs[-1] if other_revs else -1].hex()
134
135 #case two independent repos
113 #case two independent repos
136 if org_repo != other_repo:
114 if org_repo != other_repo:
137 hgrepo = unionrepo.unionrepository(other_repo.baseui,
115 hgrepo = unionrepo.unionrepository(other_repo.baseui,
@@ -166,7 +144,7 b' class CompareController(BaseRepoControll'
166
144
167 so, se = org_repo.run_git_command(
145 so, se = org_repo.run_git_command(
168 'log --reverse --pretty="format: %%H" -s -p %s..%s'
146 'log --reverse --pretty="format: %%H" -s -p %s..%s'
169 % (org_ref[1], other_ref[1])
147 % (org_rev, other_rev)
170 )
148 )
171 changesets = [org_repo.get_changeset(cs)
149 changesets = [org_repo.get_changeset(cs)
172 for cs in re.findall(r'[0-9a-fA-F]{40}', so)]
150 for cs in re.findall(r'[0-9a-fA-F]{40}', so)]
@@ -235,8 +213,8 b' class CompareController(BaseRepoControll'
235 c.other_ref_type = other_ref[0]
213 c.other_ref_type = other_ref[0]
236
214
237 c.cs_ranges, c.ancestor = self._get_changesets(org_repo.scm_instance.alias,
215 c.cs_ranges, c.ancestor = self._get_changesets(org_repo.scm_instance.alias,
238 org_repo.scm_instance, org_ref,
216 org_repo.scm_instance, org_rev,
239 other_repo.scm_instance, other_ref,
217 other_repo.scm_instance, other_rev,
240 merge)
218 merge)
241
219
242 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
220 c.statuses = c.rhodecode_db_repo.statuses([x.raw_id for x in
General Comments 0
You need to be logged in to leave comments. Login now