##// END OF EJS Templates
merge: inline act()...
Mads Kiilerich -
r18544:d0a8f09a default
parent child Browse files
Show More
@@ -193,9 +193,6 b' def manifestmerge(repo, p1, p2, pa, over'
193 193 partial = function to filter file lists
194 194 """
195 195
196 def act(msg, m, f, *args):
197 actions.append((f, m, args, msg))
198
199 196 actions, copy, movewithdir = [], {}, {}
200 197
201 198 if overwrite:
@@ -206,9 +203,9 b' def manifestmerge(repo, p1, p2, pa, over'
206 203 ret = copies.mergecopies(repo, p1, p2, pa)
207 204 copy, movewithdir, diverge, renamedelete = ret
208 205 for of, fl in diverge.iteritems():
209 act("divergent renames", "dr", of, fl)
206 actions.append((of, "dr", (fl,), "divergent renames"))
210 207 for of, fl in renamedelete.iteritems():
211 act("rename and delete", "rd", of, fl)
208 actions.append((of, "rd", (fl,), "rename and delete"))
212 209
213 210 repo.ui.note(_("resolving manifests\n"))
214 211 repo.ui.debug(" overwrite: %s, partial: %s\n"
@@ -242,31 +239,32 b' def manifestmerge(repo, p1, p2, pa, over'
242 239 pass # remote unchanged - keep local
243 240 elif n == a and fl1 == fla: # local unchanged - use remote
244 241 if n == n2: # optimization: keep local content
245 act("update permissions", "e", f, fl2)
242 actions.append((f, "e", (fl2,), "update permissions"))
246 243 else:
247 act("remote is newer", "g", f, fl2)
244 actions.append((f, "g", (fl2,), "remote is newer"))
248 245 elif nol and n2 == a: # remote only changed 'x'
249 act("update permissions", "e", f, fl2)
246 actions.append((f, "e", (fl2,), "update permissions"))
250 247 elif nol and n == a: # local only changed 'x'
251 act("remote is newer", "g", f, fl1)
248 actions.append((f, "g", (fl1,), "remote is newer"))
252 249 else: # both changed something
253 act("versions differ", "m", f, f, f, False)
250 actions.append((f, "m", (f, f, False), "versions differ"))
254 251 elif f in copied: # files we'll deal with on m2 side
255 252 pass
256 253 elif f in movewithdir: # directory rename
257 254 f2 = movewithdir[f]
258 act("remote renamed directory to " + f2, "d", f, None, f2,
259 m1.flags(f))
255 actions.append((f, "d", (None, f2, m1.flags(f)),
256 "remote renamed directory to " + f2))
260 257 elif f in copy:
261 258 f2 = copy[f]
262 act("local copied/moved to " + f2, "m", f, f2, f, False)
259 actions.append((f, "m", (f2, f, False),
260 "local copied/moved to " + f2))
263 261 elif f in ma: # clean, a different, no remote
264 262 if n != ma[f]:
265 263 prompts.append((f, "cd")) # prompt changed/deleted
266 264 elif n[20:] == "a": # added, no remote
267 act("remote deleted", "f", f)
265 actions.append((f, "f", None, "remote deleted"))
268 266 else:
269 act("other deleted", "r", f)
267 actions.append((f, "r", None, "other deleted"))
270 268
271 269 for f, n in m2.iteritems():
272 270 if partial and not partial(f):
@@ -275,23 +273,23 b' def manifestmerge(repo, p1, p2, pa, over'
275 273 continue
276 274 if f in movewithdir:
277 275 f2 = movewithdir[f]
278 act("local renamed directory to " + f2, "d", None, f, f2,
279 m2.flags(f))
276 actions.append((None, "d", (f, f2, m2.flags(f)),
277 "local renamed directory to " + f2))
280 278 elif f in copy:
281 279 f2 = copy[f]
282 280 if f2 in m2:
283 act("remote copied to " + f, "m",
284 f2, f, f, False)
281 actions.append((f2, "m", (f, f, False),
282 "remote copied to " + f))
285 283 else:
286 act("remote moved to " + f, "m",
287 f2, f, f, True)
284 actions.append((f2, "m", (f, f, True),
285 "remote moved to " + f))
288 286 elif f not in ma:
289 287 if (not overwrite
290 288 and _checkunknownfile(repo, p1, p2, f)):
291 act("remote differs from untracked local",
292 "m", f, f, f, False)
289 actions.append((f, "m", (f, f, False),
290 "remote differs from untracked local"))
293 291 else:
294 act("remote created", "g", f, m2.flags(f))
292 actions.append((f, "g", (m2.flags(f),), "remote created"))
295 293 elif n != ma[f]:
296 294 prompts.append((f, "dc")) # prompt deleted/changed
297 295
@@ -301,15 +299,15 b' def manifestmerge(repo, p1, p2, pa, over'
301 299 _("local changed %s which remote deleted\n"
302 300 "use (c)hanged version or (d)elete?") % f,
303 301 (_("&Changed"), _("&Delete")), 0):
304 act("prompt delete", "r", f)
302 actions.append((f, "r", None, "prompt delete"))
305 303 else:
306 act("prompt keep", "a", f)
304 actions.append((f, "a", None, "prompt keep"))
307 305 elif m == "dc":
308 306 if repo.ui.promptchoice(
309 307 _("remote changed %s which local deleted\n"
310 308 "use (c)hanged version or leave (d)eleted?") % f,
311 309 (_("&Changed"), _("&Deleted")), 0) == 0:
312 act("prompt recreating", "g", f, m2.flags(f))
310 actions.append((f, "g", (m2.flags(f),), "prompt recreating"))
313 311 else: assert False, m
314 312 return actions
315 313
General Comments 0
You need to be logged in to leave comments. Login now