comparison mercurial/merge.py @ 15538:b0a88bda3381 stable

update: don't clobber untracked files with wrong casing
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 20 Nov 2011 23:09:32 +0100
parents 3afe5edda4e3
children 6c8573dd1b6b 7f01ad702405
comparison
equal deleted inserted replaced
15536:415d69df8a02 15538:b0a88bda3381
79 del self._state[dfile] 79 del self._state[dfile]
80 elif not r: 80 elif not r:
81 self.mark(dfile, 'r') 81 self.mark(dfile, 'r')
82 return r 82 return r
83 83
84 def _checkunknown(wctx, mctx): 84 def _checkunknown(wctx, mctx, folding):
85 "check for collisions between unknown files and files in mctx" 85 "check for collisions between unknown files and files in mctx"
86 for f in wctx.unknown(): 86 if folding:
87 if f in mctx and mctx[f].cmp(wctx[f]): 87 foldf = util.normcase
88 else:
89 foldf = lambda fn: fn
90 folded = {}
91 for fn in mctx:
92 folded[foldf(fn)] = fn
93 for fn in wctx.unknown():
94 f = foldf(fn)
95 if f in folded and mctx[folded[f]].cmp(wctx[f]):
88 raise util.Abort(_("untracked file in working directory differs" 96 raise util.Abort(_("untracked file in working directory differs"
89 " from file in requested revision: '%s'") % f) 97 " from file in requested revision: '%s'") % fn)
90 98
91 def _checkcollision(mctx): 99 def _checkcollision(mctx):
92 "check for case folding collisions in the destination context" 100 "check for case folding collisions in the destination context"
93 folded = {} 101 folded = {}
94 for fn in mctx: 102 for fn in mctx:
535 overwrite = True 543 overwrite = True
536 544
537 ### calculate phase 545 ### calculate phase
538 action = [] 546 action = []
539 wc.status(unknown=True) # prime cache 547 wc.status(unknown=True) # prime cache
548 folding = not util.checkcase(repo.path)
540 if not force: 549 if not force:
541 _checkunknown(wc, p2) 550 _checkunknown(wc, p2, folding)
542 if not util.checkcase(repo.path): 551 if folding:
543 _checkcollision(p2) 552 _checkcollision(p2)
544 action += _forgetremoved(wc, p2, branchmerge) 553 action += _forgetremoved(wc, p2, branchmerge)
545 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) 554 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
546 555
547 ### apply phase 556 ### apply phase