##// END OF EJS Templates
copies: consider nullrev a common ancestor...
Martin von Zweigbergk -
r41437:b80af070 default
parent child Browse files
Show More
@@ -31,7 +31,6 b' def _findlimit(repo, a, b):'
31 Generally, this means finding the earliest revision number that's an
31 Generally, this means finding the earliest revision number that's an
32 ancestor of a or b but not both, except when a or b is a direct descendent
32 ancestor of a or b but not both, except when a or b is a direct descendent
33 of the other, in which case we can return the minimum revnum of a and b.
33 of the other, in which case we can return the minimum revnum of a and b.
34 None if no such revision exists.
35 """
34 """
36
35
37 # basic idea:
36 # basic idea:
@@ -55,7 +54,6 b' def _findlimit(repo, a, b):'
55 visit = [-a, -b]
54 visit = [-a, -b]
56 heapq.heapify(visit)
55 heapq.heapify(visit)
57 interesting = len(visit)
56 interesting = len(visit)
58 hascommonancestor = False
59 limit = node.wdirrev
57 limit = node.wdirrev
60
58
61 while interesting:
59 while interesting:
@@ -64,9 +62,9 b' def _findlimit(repo, a, b):'
64 parents = [cl.rev(p) for p in repo.dirstate.parents()]
62 parents = [cl.rev(p) for p in repo.dirstate.parents()]
65 else:
63 else:
66 parents = cl.parentrevs(r)
64 parents = cl.parentrevs(r)
65 if parents[1] == node.nullrev:
66 parents = parents[:1]
67 for p in parents:
67 for p in parents:
68 if p < 0:
69 continue
70 if p not in side:
68 if p not in side:
71 # first time we see p; add it to visit
69 # first time we see p; add it to visit
72 side[p] = side[r]
70 side[p] = side[r]
@@ -77,14 +75,10 b' def _findlimit(repo, a, b):'
77 # p was interesting but now we know better
75 # p was interesting but now we know better
78 side[p] = 0
76 side[p] = 0
79 interesting -= 1
77 interesting -= 1
80 hascommonancestor = True
81 if side[r]:
78 if side[r]:
82 limit = r # lowest rev visited
79 limit = r # lowest rev visited
83 interesting -= 1
80 interesting -= 1
84
81
85 if not hascommonancestor:
86 return None
87
88 # Consider the following flow (see test-commit-amend.t under issue4405):
82 # Consider the following flow (see test-commit-amend.t under issue4405):
89 # 1/ File 'a0' committed
83 # 1/ File 'a0' committed
90 # 2/ File renamed from 'a0' to 'a1' in a new commit (call it 'a1')
84 # 2/ File renamed from 'a0' to 'a1' in a new commit (call it 'a1')
@@ -169,8 +163,6 b' def _committedforwardcopies(a, b, match)'
169 dbg('debug.copies: looking into rename from %s to %s\n'
163 dbg('debug.copies: looking into rename from %s to %s\n'
170 % (a, b))
164 % (a, b))
171 limit = _findlimit(repo, a.rev(), b.rev())
165 limit = _findlimit(repo, a.rev(), b.rev())
172 if limit is None:
173 limit = node.nullrev
174 if debug:
166 if debug:
175 dbg('debug.copies: search limit: %d\n' % limit)
167 dbg('debug.copies: search limit: %d\n' % limit)
176 am = a.manifest()
168 am = a.manifest()
@@ -465,9 +457,6 b' def _fullcopytracing(repo, c1, c2, base)'
465 tca = _c1.ancestor(_c2)
457 tca = _c1.ancestor(_c2)
466
458
467 limit = _findlimit(repo, c1.rev(), c2.rev())
459 limit = _findlimit(repo, c1.rev(), c2.rev())
468 if limit is None:
469 # no common ancestor, no copies
470 return {}, {}, {}, {}, {}
471 repo.ui.debug(" searching for copies back to rev %d\n" % limit)
460 repo.ui.debug(" searching for copies back to rev %d\n" % limit)
472
461
473 m1 = c1.manifest()
462 m1 = c1.manifest()
General Comments 0
You need to be logged in to leave comments. Login now