comparison mercurial/merge.py @ 6242:a375ffc2aa1b

merge: fix handling of deleted files
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Wed, 12 Mar 2008 15:44:08 -0700
parents f89fd07fc51d
children 69c75d063c7a
comparison
equal deleted inserted replaced
6241:a718e66836e8 6242:a375ffc2aa1b
27 if fold in folded: 27 if fold in folded:
28 raise util.Abort(_("case-folding collision between %s and %s") 28 raise util.Abort(_("case-folding collision between %s and %s")
29 % (fn, folded[fold])) 29 % (fn, folded[fold]))
30 folded[fold] = fn 30 folded[fold] = fn
31 31
32 def forgetremoved(wctx, mctx): 32 def forgetremoved(wctx, mctx, branchmerge):
33 """ 33 """
34 Forget removed files 34 Forget removed files
35 35
36 If we're jumping between revisions (as opposed to merging), and if 36 If we're jumping between revisions (as opposed to merging), and if
37 neither the working directory nor the target rev has the file, 37 neither the working directory nor the target rev has the file,
38 then we need to remove it from the dirstate, to prevent the 38 then we need to remove it from the dirstate, to prevent the
39 dirstate from listing the file when it is no longer in the 39 dirstate from listing the file when it is no longer in the
40 manifest. 40 manifest.
41
42 If we're merging, and the other revision has removed a file
43 that is not present in the working directory, we need to mark it
44 as removed.
41 """ 45 """
42 46
43 action = [] 47 action = []
44 man = mctx.manifest() 48 man = mctx.manifest()
45 for f in wctx.deleted() + wctx.removed(): 49 state = branchmerge and 'r' or 'f'
50 for f in wctx.deleted():
46 if f not in man: 51 if f not in man:
47 action.append((f, "f")) 52 action.append((f, state))
53
54 if not branchmerge:
55 for f in wctx.removed():
56 if f not in man:
57 action.append((f, "f"))
48 58
49 return action 59 return action
50 60
51 def findcopies(repo, m1, m2, ma, limit): 61 def findcopies(repo, m1, m2, ma, limit):
52 """ 62 """
606 action = [] 616 action = []
607 if not force: 617 if not force:
608 checkunknown(wc, p2) 618 checkunknown(wc, p2)
609 if not util.checkfolding(repo.path): 619 if not util.checkfolding(repo.path):
610 checkcollision(p2) 620 checkcollision(p2)
611 if not branchmerge: 621 action += forgetremoved(wc, p2, branchmerge)
612 action += forgetremoved(wc, p2)
613 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) 622 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
614 623
615 ### apply phase 624 ### apply phase
616 if not branchmerge: # just jump to the new rev 625 if not branchmerge: # just jump to the new rev
617 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' 626 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''