comparison mercurial/merge.py @ 15673:d550168f11ce stable

merge: check filename case collision between changesets for branch merging this patch makes branch merging abort when merged changesets have same file in different case on case insensitive filesystem. this patch does not prevent linear update which merges between target and working contexts, because 'branchmerge' is False in such case.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 16 Dec 2011 21:21:27 +0900
parents 7f01ad702405
children 7b7f03502b5a
comparison
equal deleted inserted replaced
15672:2ebe3d0ce91d 15673:d550168f11ce
94 f = foldf(fn) 94 f = foldf(fn)
95 if f in folded and mctx[folded[f]].cmp(wctx[f]): 95 if f in folded and mctx[folded[f]].cmp(wctx[f]):
96 raise util.Abort(_("untracked file in working directory differs" 96 raise util.Abort(_("untracked file in working directory differs"
97 " from file in requested revision: '%s'") % fn) 97 " from file in requested revision: '%s'") % fn)
98 98
99 def _checkcollision(mctx): 99 def _checkcollision(mctx, wctx):
100 "check for case folding collisions in the destination context" 100 "check for case folding collisions in the destination context"
101 folded = {} 101 folded = {}
102 for fn in mctx: 102 for fn in mctx:
103 fold = util.normcase(fn) 103 fold = util.normcase(fn)
104 if fold in folded: 104 if fold in folded:
105 raise util.Abort(_("case-folding collision between %s and %s") 105 raise util.Abort(_("case-folding collision between %s and %s")
106 % (fn, folded[fold])) 106 % (fn, folded[fold]))
107 folded[fold] = fn 107 folded[fold] = fn
108
109 if wctx:
110 for fn in wctx:
111 fold = util.normcase(fn)
112 mfn = folded.get(fold, None)
113 if mfn and (mfn != fn):
114 raise util.Abort(_("case-folding collision between %s and %s")
115 % (mfn, fn))
108 116
109 def _forgetremoved(wctx, mctx, branchmerge): 117 def _forgetremoved(wctx, mctx, branchmerge):
110 """ 118 """
111 Forget removed files 119 Forget removed files
112 120
547 wc.status(unknown=True) # prime cache 555 wc.status(unknown=True) # prime cache
548 folding = not util.checkcase(repo.path) 556 folding = not util.checkcase(repo.path)
549 if not force: 557 if not force:
550 _checkunknown(wc, p2, folding) 558 _checkunknown(wc, p2, folding)
551 if folding: 559 if folding:
552 _checkcollision(p2) 560 _checkcollision(p2, branchmerge and p1)
553 action += _forgetremoved(wc, p2, branchmerge) 561 action += _forgetremoved(wc, p2, branchmerge)
554 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) 562 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
555 563
556 ### apply phase 564 ### apply phase
557 if not branchmerge: # just jump to the new rev 565 if not branchmerge: # just jump to the new rev