##// END OF EJS Templates
merge: use contexts in checkunknown and forgetremoved
Matt Mackall -
r3312:c5075ad5 default
parent child Browse files
Show More
@@ -63,17 +63,18 b' def filemerge(repo, fw, fo, wctx, mctx):'
63 os.unlink(c)
63 os.unlink(c)
64 return r
64 return r
65
65
66 def checkunknown(repo, m2, wctx):
66 def checkunknown(wctx, mctx):
67 """
67 """
68 check for collisions between unknown files and files in m2
68 check for collisions between unknown files and files in m2
69 """
69 """
70 man = mctx.manifest()
70 for f in wctx.unknown():
71 for f in wctx.unknown():
71 if f in m2:
72 if f in man:
72 if repo.file(f).cmp(m2[f], repo.wread(f)):
73 if mctx.filectx(f).cmp(wctx.filectx(f).data()):
73 raise util.Abort(_("'%s' already exists in the working"
74 raise util.Abort(_("'%s' already exists in the working"
74 " dir and differs from remote") % f)
75 " dir and differs from remote") % f)
75
76
76 def forgetremoved(m2, wctx):
77 def forgetremoved(wctx, mctx):
77 """
78 """
78 Forget removed files
79 Forget removed files
79
80
@@ -85,9 +86,9 b' def forgetremoved(m2, wctx):'
85 """
86 """
86
87
87 action = []
88 action = []
88
89 man = mctx.manifest()
89 for f in wctx.deleted() + wctx.removed():
90 for f in wctx.deleted() + wctx.removed():
90 if f not in m2:
91 if f not in man:
91 action.append((f, "f"))
92 action.append((f, "f"))
92
93
93 return action
94 return action
@@ -383,9 +384,6 b' def update(repo, node, branchmerge=False'
383 if wc.modified() or wc.added() or wc.removed():
384 if wc.modified() or wc.added() or wc.removed():
384 raise util.Abort(_("outstanding uncommitted changes"))
385 raise util.Abort(_("outstanding uncommitted changes"))
385
386
386 m1 = wc.manifest()
387 m2 = p2.manifest()
388
389 # resolve the manifest to determine which files
387 # resolve the manifest to determine which files
390 # we care about merging
388 # we care about merging
391 repo.ui.note(_("resolving manifests\n"))
389 repo.ui.note(_("resolving manifests\n"))
@@ -396,9 +394,9 b' def update(repo, node, branchmerge=False'
396 action = []
394 action = []
397
395
398 if not force:
396 if not force:
399 checkunknown(repo, m2, wc)
397 checkunknown(wc, p2)
400 if not branchmerge:
398 if not branchmerge:
401 action += forgetremoved(m2, wc)
399 action += forgetremoved(wc, p2)
402
400
403 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
401 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
404
402
General Comments 0
You need to be logged in to leave comments. Login now