##// END OF EJS Templates
merge: only store one direction of copies in the copy map...
Matt Mackall -
r3730:d377f8d2 default
parent child Browse files
Show More
@@ -136,25 +136,24 b' def findcopies(repo, m1, m2, ma, limit):'
136
136
137 def checkpair(c, f2, man):
137 def checkpair(c, f2, man):
138 ''' check if an apparent pair actually matches '''
138 ''' check if an apparent pair actually matches '''
139 if f2 not in man:
140 return
139 c2 = ctx(f2, man[f2])
141 c2 = ctx(f2, man[f2])
140 ca = c.ancestor(c2)
142 ca = c.ancestor(c2)
141 if not ca or c == ca or c2 == ca:
143 if not ca or c == ca or c2 == ca:
142 return
144 return
143 if ca.path() == c.path() or ca.path() == c2.path():
145 if ca.path() == c.path() or ca.path() == c2.path():
144 copy[c.path()] = f2
146 copy[c.path()] = f2
145 copy[f2] = c.path()
146
147
147 for f in u1:
148 for f in u1:
148 c = ctx(dcopies.get(f, f), m1[f])
149 c = ctx(dcopies.get(f, f), m1[f])
149 for of in findold(c, limit):
150 for of in findold(c, limit):
150 if of in m2:
151 checkpair(c, of, m2)
151 checkpair(c, of, m2)
152
152
153 for f in u2:
153 for f in u2:
154 c = ctx(f, m2[f])
154 c = ctx(f, m2[f])
155 for of in findold(c, limit):
155 for of in findold(c, limit):
156 if of in m1:
156 checkpair(c, of, m1)
157 checkpair(c, of, m1)
158
157
159 return copy
158 return copy
160
159
@@ -176,7 +175,6 b' def manifestmerge(repo, p1, p2, pa, over'
176 backwards = (pa == p2)
175 backwards = (pa == p2)
177 action = []
176 action = []
178 copy = {}
177 copy = {}
179 copied = {}
180
178
181 def fmerge(f, f2=None, fa=None):
179 def fmerge(f, f2=None, fa=None):
182 """merge executable flags"""
180 """merge executable flags"""
@@ -192,6 +190,7 b' def manifestmerge(repo, p1, p2, pa, over'
192
190
193 if pa and not (backwards or overwrite):
191 if pa and not (backwards or overwrite):
194 copy = findcopies(repo, m1, m2, ma, pa.rev())
192 copy = findcopies(repo, m1, m2, ma, pa.rev())
193 copied = dict.fromkeys(copy.values())
195
194
196 # Compare manifests
195 # Compare manifests
197 for f, n in m1.iteritems():
196 for f, n in m1.iteritems():
@@ -216,19 +215,16 b' def manifestmerge(repo, p1, p2, pa, over'
216 elif m1.execf(f) != m2.execf(f):
215 elif m1.execf(f) != m2.execf(f):
217 if overwrite or fmerge(f) != m1.execf(f):
216 if overwrite or fmerge(f) != m1.execf(f):
218 act("update permissions", "e", f, m2.execf(f))
217 act("update permissions", "e", f, m2.execf(f))
218 elif f in copied:
219 continue
219 elif f in copy:
220 elif f in copy:
220 f2 = copy[f]
221 f2 = copy[f]
221 copied[f2] = True
222 if f2 in m1: # case 2 A,B/B/B
222 if f in ma: # case 3,20 A/B/A
223 act("local copied to " + f2, "m",
223 act("remote moved to " + f2, "m",
224 f, f2, f, fmerge(f, f2, f2), False)
224 f, f2, f2, fmerge(f, f2, f), True)
225 else: # case 4,21 A/B/B
225 else:
226 act("local moved to " + f2, "m",
226 if f2 in m1: # case 2 A,B/B/B
227 f, f2, f, fmerge(f, f2, f2), False)
227 act("local copied to " + f2, "m",
228 f, f2, f, fmerge(f, f2, f2), False)
229 else: # case 4,21 A/B/B
230 act("local moved to " + f2, "m",
231 f, f2, f, fmerge(f, f2, f2), False)
232 elif f in ma:
228 elif f in ma:
233 if n != ma[f] and not overwrite:
229 if n != ma[f] and not overwrite:
234 if repo.ui.prompt(
230 if repo.ui.prompt(
@@ -251,9 +247,12 b' def manifestmerge(repo, p1, p2, pa, over'
251 continue
247 continue
252 if f in copy:
248 if f in copy:
253 f2 = copy[f]
249 f2 = copy[f]
254 # rename case 1, A/A,B/A
250 if f2 in m2: # rename case 1, A/A,B/A
255 act("remote copied to " + f, "m",
251 act("remote copied to " + f, "m",
256 f2, f, f, fmerge(f2, f, f2), False)
252 f2, f, f, fmerge(f2, f, f2), False)
253 else: # case 3,20 A/B/A
254 act("remote moved to " + f, "m",
255 f2, f, f, fmerge(f2, f, f2), True)
257 elif f in ma:
256 elif f in ma:
258 if overwrite or backwards:
257 if overwrite or backwards:
259 act("recreating", "g", f, m2.execf(f))
258 act("recreating", "g", f, m2.execf(f))
@@ -47,8 +47,8 b' test L:up a R:nm a b W: - 3 get'
47 resolving manifests
47 resolving manifests
48 overwrite None partial False
48 overwrite None partial False
49 ancestor 924404dff337 local e300d1c794ec+ remote e03727d2d66b
49 ancestor 924404dff337 local e300d1c794ec+ remote e03727d2d66b
50 rev: versions differ -> m
50 a: remote moved to b -> m
51 a: remote moved to b -> m
51 rev: versions differ -> m
52 merging a and b
52 merging a and b
53 my a@e300d1c794ec+ other b@e03727d2d66b ancestor a@924404dff337
53 my a@e300d1c794ec+ other b@e03727d2d66b ancestor a@924404dff337
54 copying a to b
54 copying a to b
@@ -351,8 +351,8 b' test L:up a R:um a b W: - 20 mer'
351 resolving manifests
351 resolving manifests
352 overwrite None partial False
352 overwrite None partial False
353 ancestor 924404dff337 local e300d1c794ec+ remote 79cc6877a3b7
353 ancestor 924404dff337 local e300d1c794ec+ remote 79cc6877a3b7
354 rev: versions differ -> m
354 a: remote moved to b -> m
355 a: remote moved to b -> m
355 rev: versions differ -> m
356 merging a and b
356 merging a and b
357 my a@e300d1c794ec+ other b@79cc6877a3b7 ancestor a@924404dff337
357 my a@e300d1c794ec+ other b@79cc6877a3b7 ancestor a@924404dff337
358 copying a to b
358 copying a to b
General Comments 0
You need to be logged in to leave comments. Login now