##// END OF EJS Templates
update: don't clobber untracked files with wrong casing
Mads Kiilerich -
r15538:b0a88bda stable
parent child Browse files
Show More
@@ -81,12 +81,20 b' class mergestate(object):'
81 81 self.mark(dfile, 'r')
82 82 return r
83 83
84 def _checkunknown(wctx, mctx):
84 def _checkunknown(wctx, mctx, folding):
85 85 "check for collisions between unknown files and files in mctx"
86 for f in wctx.unknown():
87 if f in mctx and mctx[f].cmp(wctx[f]):
86 if folding:
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 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 99 def _checkcollision(mctx):
92 100 "check for case folding collisions in the destination context"
@@ -537,9 +545,10 b' def update(repo, node, branchmerge, forc'
537 545 ### calculate phase
538 546 action = []
539 547 wc.status(unknown=True) # prime cache
548 folding = not util.checkcase(repo.path)
540 549 if not force:
541 _checkunknown(wc, p2)
542 if not util.checkcase(repo.path):
550 _checkunknown(wc, p2, folding)
551 if folding:
543 552 _checkcollision(p2)
544 553 action += _forgetremoved(wc, p2, branchmerge)
545 554 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
@@ -1,5 +1,8 b''
1 1 $ "$TESTDIR/hghave" icasefs || exit 80
2 2
3 $ hg debugfs | grep 'case-sensitive:'
4 case-sensitive: no
5
3 6 test file addition with bad case
4 7
5 8 $ hg init repo1
@@ -56,4 +59,16 b' used to fail under case insensitive fs'
56 59 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
57 60 $ hg up -C
58 61 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
62
63 no clobbering of untracked files with wrong casing
64
65 $ hg up -r null
66 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
67 $ echo gold > a
68 $ hg up
69 abort: untracked file in working directory differs from file in requested revision: 'a'
70 [255]
71 $ cat a
72 gold
73
59 74 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now