##// END OF EJS Templates
refactoring: drop unused 'discovery data' in pull request and compare diffs
Mads Kiilerich -
r3192:b9105d31 beta
parent child Browse files
Show More
@@ -127,7 +127,7 class CompareController(BaseRepoControll
127 org_ref = ('rev', rev_start)
127 org_ref = ('rev', rev_start)
128 other_ref = ('rev', rev_end)
128 other_ref = ('rev', rev_end)
129
129
130 c.cs_ranges, discovery_data = PullRequestModel().get_compare_data(
130 c.cs_ranges = PullRequestModel().get_compare_data(
131 org_repo, org_ref, other_repo, other_ref,
131 org_repo, org_ref, other_repo, other_ref,
132 )
132 )
133
133
@@ -156,7 +156,6 class CompareController(BaseRepoControll
156 diff_limit = self.cut_off_limit if not fulldiff else None
156 diff_limit = self.cut_off_limit if not fulldiff else None
157
157
158 _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref,
158 _diff = diffs.differ(org_repo, org_ref, other_repo, other_ref,
159 discovery_data,
160 remote_compare=incoming_changesets)
159 remote_compare=incoming_changesets)
161
160
162 diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff',
161 diff_processor = diffs.DiffProcessor(_diff or '', format='gitdiff',
@@ -704,7 +704,7 class InMemoryBundleRepo(bundlerepositor
704 self.bundlefilespos = {}
704 self.bundlefilespos = {}
705
705
706
706
707 def differ(org_repo, org_ref, other_repo, other_ref, discovery_data=None,
707 def differ(org_repo, org_ref, other_repo, other_ref,
708 remote_compare=False, context=3, ignore_whitespace=False):
708 remote_compare=False, context=3, ignore_whitespace=False):
709 """
709 """
710 General differ between branches, bookmarks, revisions of two remote or
710 General differ between branches, bookmarks, revisions of two remote or
@@ -735,7 +735,6 def differ(org_repo, org_ref, other_repo
735
735
736 elif remote_compare:
736 elif remote_compare:
737 opts = diffopts(git=True, ignorews=ignore_whitespace, context=context)
737 opts = diffopts(git=True, ignorews=ignore_whitespace, context=context)
738 common, incoming, rheads = discovery_data
739 org_repo_peer = localrepo.locallegacypeer(org_repo.local())
738 org_repo_peer = localrepo.locallegacypeer(org_repo.local())
740 # create a bundle (uncompressed if other repo is not local)
739 # create a bundle (uncompressed if other repo is not local)
741 if org_repo_peer.capable('getbundle'):
740 if org_repo_peer.capable('getbundle'):
@@ -155,8 +155,7 class PullRequestModel(BaseModel):
155 pull_request.updated_on = datetime.datetime.now()
155 pull_request.updated_on = datetime.datetime.now()
156 self.sa.add(pull_request)
156 self.sa.add(pull_request)
157
157
158 def _get_changesets(self, alias, org_repo, org_ref, other_repo, other_ref,
158 def _get_changesets(self, alias, org_repo, org_ref, other_repo, other_ref):
159 discovery_data):
160 """
159 """
161 Returns a list of changesets that are incoming from org_repo@org_ref
160 Returns a list of changesets that are incoming from org_repo@org_ref
162 to other_repo@other_ref
161 to other_repo@other_ref
@@ -170,7 +169,6 class PullRequestModel(BaseModel):
170
169
171 changesets = []
170 changesets = []
172 #case two independent repos
171 #case two independent repos
173 common, incoming, rheads = discovery_data
174 if org_repo != other_repo:
172 if org_repo != other_repo:
175 revs = [
173 revs = [
176 org_repo._repo.lookup(org_ref[1]),
174 org_repo._repo.lookup(org_ref[1]),
@@ -223,46 +221,9 class PullRequestModel(BaseModel):
223
221
224 return changesets
222 return changesets
225
223
226 def _get_discovery(self, org_repo, org_ref, other_repo, other_ref):
227 """
228 Get's mercurial discovery data used to calculate difference between
229 repos and refs
230
231 :param org_repo:
232 :type org_repo:
233 :param org_ref:
234 :type org_ref:
235 :param other_repo:
236 :type other_repo:
237 :param other_ref:
238 :type other_ref:
239 """
240
241 _org_repo = org_repo._repo
242 org_rev_type, org_rev = org_ref
243
244 _other_repo = other_repo._repo
245 other_rev_type, other_rev = other_ref
246
247 log.debug('Doing discovery for %s@%s vs %s@%s' % (
248 org_repo, org_ref, other_repo, other_ref)
249 )
250
251 #log.debug('Filter heads are %s[%s]' % ('', org_ref[1]))
252 org_peer = localrepo.locallegacypeer(_org_repo.local())
253 tmp = discovery.findcommonincoming(
254 repo=_other_repo, # other_repo we check for incoming
255 remote=org_peer, # org_repo source for incoming
256 # heads=[_other_repo[other_rev].node(),
257 # _org_repo[org_rev].node()],
258 force=True
259 )
260 return tmp
261
262 def get_compare_data(self, org_repo, org_ref, other_repo, other_ref):
224 def get_compare_data(self, org_repo, org_ref, other_repo, other_ref):
263 """
225 """
264 Returns a tuple of incomming changesets, and discoverydata cache for
226 Returns incomming changesets for mercurial repositories
265 mercurial repositories
266
227
267 :param org_repo:
228 :param org_repo:
268 :type org_repo:
229 :type org_repo:
@@ -284,12 +245,7 class PullRequestModel(BaseModel):
284 other_repo_scm = other_repo.scm_instance
245 other_repo_scm = other_repo.scm_instance
285
246
286 alias = org_repo.scm_instance.alias
247 alias = org_repo.scm_instance.alias
287 discovery_data = [None, None, None]
288 if alias == 'hg':
289 discovery_data = self._get_discovery(org_repo_scm, org_ref,
290 other_repo_scm, other_ref)
291 cs_ranges = self._get_changesets(alias,
248 cs_ranges = self._get_changesets(alias,
292 org_repo_scm, org_ref,
249 org_repo_scm, org_ref,
293 other_repo_scm, other_ref,
250 other_repo_scm, other_ref)
294 discovery_data)
251 return cs_ranges
295 return cs_ranges, discovery_data
General Comments 0
You need to be logged in to leave comments. Login now