Show More
@@ -0,0 +1,34 b'' | |||
|
1 | run only on case-sensitive filesystems | |
|
2 | ||
|
3 | $ "$TESTDIR/hghave" no-icasefs || exit 80 | |
|
4 | ||
|
5 | test file addition with colliding case | |
|
6 | ||
|
7 | $ hg init repo1 | |
|
8 | $ cd repo1 | |
|
9 | $ echo a > a | |
|
10 | $ echo A > A | |
|
11 | $ hg add a | |
|
12 | $ hg st | |
|
13 | A a | |
|
14 | ? A | |
|
15 | $ hg add --config ui.portablefilenames=abort A | |
|
16 | abort: possible case-folding collision for A | |
|
17 | [255] | |
|
18 | $ hg st | |
|
19 | A a | |
|
20 | ? A | |
|
21 | $ hg add A | |
|
22 | warning: possible case-folding collision for A | |
|
23 | $ hg st | |
|
24 | A A | |
|
25 | A a | |
|
26 | $ hg forget A | |
|
27 | $ hg st | |
|
28 | A a | |
|
29 | ? A | |
|
30 | $ hg add --config ui.portablefilenames=no A | |
|
31 | $ hg st | |
|
32 | A A | |
|
33 | A a | |
|
34 | $ cd .. |
@@ -1314,9 +1314,16 b' def add(ui, repo, match, dryrun, listsub' | |||
|
1314 | 1314 | match.bad = lambda x, y: bad.append(x) or oldbad(x, y) |
|
1315 | 1315 | names = [] |
|
1316 | 1316 | wctx = repo[None] |
|
1317 | wctx.status(clean=True) | |
|
1318 | existing = None | |
|
1319 | if scmutil.showportabilityalert(ui): | |
|
1320 | existing = dict([(fn.lower(), fn) for fn in | |
|
1321 | wctx.added() + wctx.clean() + wctx.modified()]) | |
|
1317 | 1322 | for f in repo.walk(match): |
|
1318 | 1323 | exact = match.exact(f) |
|
1319 | 1324 | if exact or f not in repo.dirstate: |
|
1325 | if existing: | |
|
1326 | scmutil.checkcasecollision(ui, f, existing) | |
|
1320 | 1327 | names.append(f) |
|
1321 | 1328 | if ui.verbose or not exact: |
|
1322 | 1329 | ui.status(_('adding %s\n') % match.rel(join(f))) |
@@ -22,6 +22,11 b' def checkportable(ui, f):' | |||
|
22 | 22 | if msg: |
|
23 | 23 | portabilityalert(ui, "%s: %r" % (msg, f)) |
|
24 | 24 | |
|
25 | def checkcasecollision(ui, f, files): | |
|
26 | if f.lower() in files and files[f.lower()] != f: | |
|
27 | portabilityalert(ui, _('possible case-folding collision for %s') % f) | |
|
28 | files[f.lower()] = f | |
|
29 | ||
|
25 | 30 | def checkportabilityalert(ui): |
|
26 | 31 | '''check if the user's config requests nothing, a warning, or abort for |
|
27 | 32 | non-portable filenames''' |
General Comments 0
You need to be logged in to leave comments.
Login now