Show More
@@ -9,7 +9,7 b' from node import nullid, nullrev' | |||
|
9 | 9 | from i18n import _ |
|
10 | 10 | import errno, util, os, heapq, filemerge |
|
11 | 11 | |
|
12 | def checkunknown(wctx, mctx): | |
|
12 | def _checkunknown(wctx, mctx): | |
|
13 | 13 | "check for collisions between unknown files and files in mctx" |
|
14 | 14 | man = mctx.manifest() |
|
15 | 15 | for f in wctx.unknown(): |
@@ -19,7 +19,7 b' def checkunknown(wctx, mctx):' | |||
|
19 | 19 | " from file in requested revision: '%s'") |
|
20 | 20 | % f) |
|
21 | 21 | |
|
22 | def checkcollision(mctx): | |
|
22 | def _checkcollision(mctx): | |
|
23 | 23 | "check for case folding collisions in the destination context" |
|
24 | 24 | folded = {} |
|
25 | 25 | for fn in mctx.manifest(): |
@@ -29,7 +29,7 b' def checkcollision(mctx):' | |||
|
29 | 29 | % (fn, folded[fold])) |
|
30 | 30 | folded[fold] = fn |
|
31 | 31 | |
|
32 | def forgetremoved(wctx, mctx, branchmerge): | |
|
32 | def _forgetremoved(wctx, mctx, branchmerge): | |
|
33 | 33 | """ |
|
34 | 34 | Forget removed files |
|
35 | 35 | |
@@ -58,41 +58,28 b' def forgetremoved(wctx, mctx, branchmerg' | |||
|
58 | 58 | |
|
59 | 59 | return action |
|
60 | 60 | |
|
61 | def findcopies(repo, m1, m2, ma, limit): | |
|
62 | """ | |
|
63 | Find moves and copies between m1 and m2 back to limit linkrev | |
|
64 | """ | |
|
65 | ||
|
66 | def nonoverlap(d1, d2, d3): | |
|
61 | def _nonoverlap(d1, d2, d3): | |
|
67 | 62 |
|
|
68 | 63 |
|
|
69 | 64 |
|
|
70 | 65 |
|
|
71 | 66 | |
|
72 |
|
|
|
67 | def _dirname(f): | |
|
73 | 68 |
|
|
74 | 69 |
|
|
75 | 70 |
|
|
76 | 71 |
|
|
77 | 72 | |
|
78 |
|
|
|
73 | def _dirs(files): | |
|
79 | 74 |
|
|
80 | 75 |
|
|
81 |
|
|
|
76 | f = _dirname(f) | |
|
82 | 77 |
|
|
83 | 78 |
|
|
84 |
|
|
|
79 | f = _dirname(f) | |
|
85 | 80 |
|
|
86 | 81 | |
|
87 | wctx = repo.workingctx() | |
|
88 | ||
|
89 | def makectx(f, n): | |
|
90 | if len(n) == 20: | |
|
91 | return repo.filectx(f, fileid=n) | |
|
92 | return wctx.filectx(f) | |
|
93 | ctx = util.cachefunc(makectx) | |
|
94 | ||
|
95 | def findold(fctx): | |
|
82 | def _findoldnames(fctx, limit): | |
|
96 | 83 |
|
|
97 | 84 |
|
|
98 | 85 |
|
@@ -106,7 +93,7 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
106 | 93 |
|
|
107 | 94 |
|
|
108 | 95 |
|
|
109 |
|
|
|
96 | if fc.rev() < limit: | |
|
110 | 97 |
|
|
111 | 98 |
|
|
112 | 99 | |
@@ -114,13 +101,26 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
114 | 101 |
|
|
115 | 102 |
|
|
116 | 103 | |
|
104 | def findcopies(repo, m1, m2, ma, limit): | |
|
105 | """ | |
|
106 | Find moves and copies between m1 and m2 back to limit linkrev | |
|
107 | """ | |
|
108 | ||
|
109 | wctx = repo.workingctx() | |
|
110 | ||
|
111 | def makectx(f, n): | |
|
112 | if len(n) == 20: | |
|
113 | return repo.filectx(f, fileid=n) | |
|
114 | return wctx.filectx(f) | |
|
115 | ctx = util.cachefunc(makectx) | |
|
116 | ||
|
117 | 117 | copy = {} |
|
118 | 118 | fullcopy = {} |
|
119 | 119 | diverge = {} |
|
120 | 120 | |
|
121 | 121 | def checkcopies(c, man, aman): |
|
122 | 122 | '''check possible copies for filectx c''' |
|
123 | for of in findold(c): | |
|
123 | for of in _findoldnames(c, limit): | |
|
124 | 124 | fullcopy[c.path()] = of # remember for dir rename detection |
|
125 | 125 | if of not in man: # original file not in other manifest? |
|
126 | 126 | if of in ma: |
@@ -149,8 +149,8 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
149 | 149 | |
|
150 | 150 | repo.ui.debug(_(" searching for copies back to rev %d\n") % limit) |
|
151 | 151 | |
|
152 | u1 = nonoverlap(m1, m2, ma) | |
|
153 | u2 = nonoverlap(m2, m1, ma) | |
|
152 | u1 = _nonoverlap(m1, m2, ma) | |
|
153 | u2 = _nonoverlap(m2, m1, ma) | |
|
154 | 154 | |
|
155 | 155 | if u1: |
|
156 | 156 | repo.ui.debug(_(" unmatched files in local:\n %s\n") |
@@ -188,14 +188,14 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
188 | 188 | repo.ui.debug(_(" checking for directory renames\n")) |
|
189 | 189 | |
|
190 | 190 | # generate a directory move map |
|
191 | d1, d2 = dirs(m1), dirs(m2) | |
|
191 | d1, d2 = _dirs(m1), _dirs(m2) | |
|
192 | 192 | invalid = {} |
|
193 | 193 | dirmove = {} |
|
194 | 194 | |
|
195 | 195 | # examine each file copy for a potential directory move, which is |
|
196 | 196 | # when all the files in a directory are moved to a new directory |
|
197 | 197 | for dst, src in fullcopy.items(): |
|
198 | dsrc, ddst = dirname(src), dirname(dst) | |
|
198 | dsrc, ddst = _dirname(src), _dirname(dst) | |
|
199 | 199 | if dsrc in invalid: |
|
200 | 200 | # already seen to be uninteresting |
|
201 | 201 | continue |
@@ -236,7 +236,7 b' def findcopies(repo, m1, m2, ma, limit):' | |||
|
236 | 236 | |
|
237 | 237 | return copy, diverge |
|
238 | 238 | |
|
239 | def symmetricdifference(repo, rev1, rev2): | |
|
239 | def _symmetricdifference(repo, rev1, rev2): | |
|
240 | 240 | """symmetric difference of the sets of ancestors of rev1 and rev2 |
|
241 | 241 | |
|
242 | 242 | I.e. revisions that are ancestors of rev1 or rev2, but not both. |
@@ -340,7 +340,7 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
340 | 340 | if rev1 is None: |
|
341 | 341 | # p1 is a workingctx |
|
342 | 342 | rev1 = p1.parents()[0].rev() |
|
343 | limit = min(symmetricdifference(repo, rev1, p2.rev())) | |
|
343 | limit = min(_symmetricdifference(repo, rev1, p2.rev())) | |
|
344 | 344 | copy, diverge = findcopies(repo, m1, m2, ma, limit) |
|
345 | 345 | |
|
346 | 346 | for of, fl in diverge.items(): |
@@ -615,10 +615,10 b' def update(repo, node, branchmerge, forc' | |||
|
615 | 615 | ### calculate phase |
|
616 | 616 | action = [] |
|
617 | 617 | if not force: |
|
618 | checkunknown(wc, p2) | |
|
618 | _checkunknown(wc, p2) | |
|
619 | 619 | if not util.checkfolding(repo.path): |
|
620 | checkcollision(p2) | |
|
621 | action += forgetremoved(wc, p2, branchmerge) | |
|
620 | _checkcollision(p2) | |
|
621 | action += _forgetremoved(wc, p2, branchmerge) | |
|
622 | 622 | action += manifestmerge(repo, wc, p2, pa, overwrite, partial) |
|
623 | 623 | |
|
624 | 624 | ### apply phase |
General Comments 0
You need to be logged in to leave comments.
Login now