comparison mercurial/merge.py @ 16478:cbf2ea2f5ca1 stable

icasefs: make case-folding collision detection as rename aware (issue3370) if the file in target context causes case-folding collision against one in working context, current implementation aborts merging with it, even thouhg collding one (in target) is the file renamed from collided one (in working). this patch uses file copy information to know whether colliding file is renamed from collided one or not: if so, collision between them is ignored. this patch also avoids collision detection between current context and target context, if working context is clean (with --check/-c) or will be clean (with --clean/-C).
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 16 Apr 2012 01:11:29 +0900
parents 2b0a406d3043
children 774e2dcd0a65
comparison
equal deleted inserted replaced
16477:70b5e25f1598 16478:cbf2ea2f5ca1
108 raise util.Abort(_("case-folding collision between %s and %s") 108 raise util.Abort(_("case-folding collision between %s and %s")
109 % (fn, folded[fold])) 109 % (fn, folded[fold]))
110 folded[fold] = fn 110 folded[fold] = fn
111 111
112 if wctx: 112 if wctx:
113 # class to delay looking up copy mapping
114 class pathcopies(object):
115 @util.propertycache
116 def map(self):
117 # {dst@mctx: src@wctx} copy mapping
118 return copies.pathcopies(wctx, mctx)
119 pc = pathcopies()
120
113 for fn in wctx: 121 for fn in wctx:
114 fold = util.normcase(fn) 122 fold = util.normcase(fn)
115 mfn = folded.get(fold, None) 123 mfn = folded.get(fold, None)
116 if mfn and (mfn != fn): 124 if mfn and mfn != fn and pc.map.get(mfn) != fn:
117 raise util.Abort(_("case-folding collision between %s and %s") 125 raise util.Abort(_("case-folding collision between %s and %s")
118 % (mfn, fn)) 126 % (mfn, fn))
119 127
120 def _forgetremoved(wctx, mctx, branchmerge): 128 def _forgetremoved(wctx, mctx, branchmerge):
121 """ 129 """
566 574
567 ### calculate phase 575 ### calculate phase
568 action = [] 576 action = []
569 folding = not util.checkcase(repo.path) 577 folding = not util.checkcase(repo.path)
570 if folding: 578 if folding:
571 _checkcollision(p2, branchmerge and p1) 579 # collision check is not needed for clean update
580 if not branchmerge and force:
581 _checkcollision(p2, None)
582 else:
583 _checkcollision(p2, wc)
572 if not force: 584 if not force:
573 _checkunknown(repo, wc, p2) 585 _checkunknown(repo, wc, p2)
574 action += _forgetremoved(wc, p2, branchmerge) 586 action += _forgetremoved(wc, p2, branchmerge)
575 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) 587 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
576 588