##// END OF EJS Templates
copies: compute the exact set of revision to walk...
marmoute -
r43593:83bb1e89 default
parent child Browse files
Show More
@@ -8,7 +8,6 b''
8 8 from __future__ import absolute_import
9 9
10 10 import collections
11 import heapq
12 11 import os
13 12
14 13 from .i18n import _
@@ -229,6 +228,8 b' def _changesetforwardcopies(a, b, match)'
229 228
230 229 cl = repo.changelog
231 230 missingrevs = cl.findmissingrevs(common=[a.rev()], heads=[b.rev()])
231 mrset = set(missingrevs)
232 roots = set()
232 233 for r in missingrevs:
233 234 for p in cl.parentrevs(r):
234 235 if p == node.nullrev:
@@ -237,17 +238,25 b' def _changesetforwardcopies(a, b, match)'
237 238 children[p] = [r]
238 239 else:
239 240 children[p].append(r)
241 if p not in mrset:
242 roots.add(p)
243 if not roots:
244 # no common revision to track copies from
245 return {}
246 min_root = min(roots)
240 247
241 roots = set(children) - set(missingrevs)
242 work = list(roots)
248 from_head = set(
249 cl.reachableroots(min_root, [b.rev()], list(roots), includepath=True)
250 )
251
252 iterrevs = set(from_head)
253 iterrevs &= mrset
254 iterrevs.update(roots)
255 iterrevs.remove(b.rev())
243 256 all_copies = {r: {} for r in roots}
244 heapq.heapify(work)
245 257 alwaysmatch = match.always()
246 while work:
247 r = heapq.heappop(work)
258 for r in sorted(iterrevs):
248 259 copies = all_copies.pop(r)
249 if r == b.rev():
250 return copies
251 260 for i, c in enumerate(children[r]):
252 261 p1, p2, p1copies, p2copies, removed = revinfo(c)
253 262 if r == p1:
@@ -273,7 +282,6 b' def _changesetforwardcopies(a, b, match)'
273 282 del newcopies[f]
274 283 othercopies = all_copies.get(c)
275 284 if othercopies is None:
276 heapq.heappush(work, c)
277 285 all_copies[c] = newcopies
278 286 else:
279 287 # we are the second parent to work on c, we need to merge our
@@ -293,7 +301,7 b' def _changesetforwardcopies(a, b, match)'
293 301 else:
294 302 newcopies.update(othercopies)
295 303 all_copies[c] = newcopies
296 assert False
304 return all_copies[b.rev()]
297 305
298 306
299 307 def _forwardcopies(a, b, base=None, match=None):
General Comments 0
You need to be logged in to leave comments. Login now