Mercurial > kallithea
comparison rhodecode/model/pull_request.py @ 3300:2c0208bd686b beta
pull request: shuffle different-repo and hg-git conditionals around, no code change
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Thu, 31 Jan 2013 23:27:21 +0100 |
parents | 14e9a06c37a7 |
children | 3c91ec4419a6 |
comparison
equal
deleted
inserted
replaced
3299:d561eb3787f5 | 3300:2c0208bd686b |
---|---|
170 :param other_ref: | 170 :param other_ref: |
171 :param tmp: | 171 :param tmp: |
172 """ | 172 """ |
173 | 173 |
174 changesets = [] | 174 changesets = [] |
175 #case two independent repos | 175 |
176 if org_repo != other_repo: | 176 if alias == 'hg': |
177 revs = [ | 177 |
178 org_repo._repo.lookup(org_ref[1]), | 178 #case two independent repos |
179 org_repo._repo.lookup(other_ref[1]), | 179 if org_repo != other_repo: |
180 ] | 180 revs = [ |
181 | 181 org_repo._repo.lookup(org_ref[1]), |
182 obj = findcommonoutgoing(org_repo._repo, | 182 org_repo._repo.lookup(other_ref[1]), |
183 localrepo.locallegacypeer(other_repo._repo.local()), | 183 ] |
184 revs, | 184 |
185 force=True) | 185 obj = findcommonoutgoing(org_repo._repo, |
186 revs = obj.missing | 186 localrepo.locallegacypeer(other_repo._repo.local()), |
187 | 187 revs, |
188 for cs in map(binascii.hexlify, revs): | 188 force=True) |
189 _cs = org_repo.get_changeset(cs) | 189 revs = obj.missing |
190 changesets.append(_cs) | 190 |
191 # in case we have revisions filter out the ones not in given range | 191 for cs in map(binascii.hexlify, revs): |
192 if org_ref[0] == 'rev' and other_ref[0] == 'rev': | 192 _cs = org_repo.get_changeset(cs) |
193 revs = [x.raw_id for x in changesets] | 193 changesets.append(_cs) |
194 start = org_ref[1] | 194 # in case we have revisions filter out the ones not in given range |
195 stop = other_ref[1] | 195 if org_ref[0] == 'rev' and other_ref[0] == 'rev': |
196 changesets = changesets[revs.index(start):revs.index(stop) + 1] | 196 revs = [x.raw_id for x in changesets] |
197 else: | 197 start = org_ref[1] |
198 stop = other_ref[1] | |
199 changesets = changesets[revs.index(start):revs.index(stop) + 1] | |
200 | |
198 #no remote compare do it on the same repository | 201 #no remote compare do it on the same repository |
199 if alias == 'hg': | 202 else: |
200 _revset_predicates = { | 203 _revset_predicates = { |
201 'branch': 'branch', | 204 'branch': 'branch', |
202 'book': 'bookmark', | 205 'book': 'bookmark', |
203 'tag': 'tag', | 206 'tag': 'tag', |
204 'rev': 'id', | 207 'rev': 'id', |
212 ] | 215 ] |
213 | 216 |
214 out = scmutil.revrange(org_repo._repo, revs) | 217 out = scmutil.revrange(org_repo._repo, revs) |
215 for cs in (out): | 218 for cs in (out): |
216 changesets.append(org_repo.get_changeset(cs)) | 219 changesets.append(org_repo.get_changeset(cs)) |
217 elif alias == 'git': | 220 |
218 so, se = org_repo.run_git_command( | 221 elif alias == 'git': |
219 'log --reverse --pretty="format: %%H" -s -p %s..%s' % (org_ref[1], | 222 assert org_repo == other_repo, (org_repo, other_repo) # no git support for different repos |
220 other_ref[1]) | 223 so, se = org_repo.run_git_command( |
221 ) | 224 'log --reverse --pretty="format: %%H" -s -p %s..%s' % (org_ref[1], |
222 ids = re.findall(r'[0-9a-fA-F]{40}', so) | 225 other_ref[1]) |
223 for cs in (ids): | 226 ) |
224 changesets.append(org_repo.get_changeset(cs)) | 227 ids = re.findall(r'[0-9a-fA-F]{40}', so) |
228 for cs in (ids): | |
229 changesets.append(org_repo.get_changeset(cs)) | |
225 | 230 |
226 return changesets | 231 return changesets |
227 | 232 |
228 def get_compare_data(self, org_repo, org_ref, other_repo, other_ref): | 233 def get_compare_data(self, org_repo, org_ref, other_repo, other_ref): |
229 """ | 234 """ |