Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 14068:04ce8fa1015d
add: notify when adding a file that would cause a case-folding collision
On a case-sensitive file system, files can be added with names that differ
only in case (a "case collision"). This would cause an error on case-insensitive
filesystems. A warning or error is now given for such collisions, depending on
the value of ui.portablefilenames ('warn', 'abort', or 'ignore'):
$ touch file File
$ hg add --config ui.portablefilenames=abort File
abort: possible case-folding collision for File
$ hg add File
warning: possible case-folding collision for File
author | Kevin Gessner <kevin@kevingessner.com> |
---|---|
date | Sat, 30 Apr 2011 12:39:46 +0200 |
parents | e4bfb9c337f3 |
children | 9f5a0acb0056 |
comparison
equal
deleted
inserted
replaced
14067:e88a4958a6b7 | 14068:04ce8fa1015d |
---|---|
1312 bad = [] | 1312 bad = [] |
1313 oldbad = match.bad | 1313 oldbad = match.bad |
1314 match.bad = lambda x, y: bad.append(x) or oldbad(x, y) | 1314 match.bad = lambda x, y: bad.append(x) or oldbad(x, y) |
1315 names = [] | 1315 names = [] |
1316 wctx = repo[None] | 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 for f in repo.walk(match): | 1322 for f in repo.walk(match): |
1318 exact = match.exact(f) | 1323 exact = match.exact(f) |
1319 if exact or f not in repo.dirstate: | 1324 if exact or f not in repo.dirstate: |
1325 if existing: | |
1326 scmutil.checkcasecollision(ui, f, existing) | |
1320 names.append(f) | 1327 names.append(f) |
1321 if ui.verbose or not exact: | 1328 if ui.verbose or not exact: |
1322 ui.status(_('adding %s\n') % match.rel(join(f))) | 1329 ui.status(_('adding %s\n') % match.rel(join(f))) |
1323 | 1330 |
1324 if listsubrepos: | 1331 if listsubrepos: |