Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/merge.py Sun Nov 20 16:06:51 2011 -0600 +++ b/mercurial/merge.py Sun Nov 20 23:09:32 2011 +0100 @@ -81,12 +81,20 @@ self.mark(dfile, 'r') return r -def _checkunknown(wctx, mctx): +def _checkunknown(wctx, mctx, folding): "check for collisions between unknown files and files in mctx" - for f in wctx.unknown(): - if f in mctx and mctx[f].cmp(wctx[f]): + if folding: + foldf = util.normcase + else: + foldf = lambda fn: fn + folded = {} + for fn in mctx: + folded[foldf(fn)] = fn + for fn in wctx.unknown(): + f = foldf(fn) + if f in folded and mctx[folded[f]].cmp(wctx[f]): raise util.Abort(_("untracked file in working directory differs" - " from file in requested revision: '%s'") % f) + " from file in requested revision: '%s'") % fn) def _checkcollision(mctx): "check for case folding collisions in the destination context" @@ -537,9 +545,10 @@ ### calculate phase action = [] wc.status(unknown=True) # prime cache + folding = not util.checkcase(repo.path) if not force: - _checkunknown(wc, p2) - if not util.checkcase(repo.path): + _checkunknown(wc, p2, folding) + if folding: _checkcollision(p2) action += _forgetremoved(wc, p2, branchmerge) action += manifestmerge(repo, wc, p2, pa, overwrite, partial)