Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 13962:8b252e826c68
add: introduce a warning message for non-portable filenames (issue2756) (BC)
On POSIX platforms, the 'add', 'addremove', 'copy' and 'rename' commands now
warn if a file has a name that can't be checked out on Windows.
Example:
$ hg add con.xml
warning: filename contains 'con', which is reserved on Windows: 'con.xml'
$ hg status
A con.xml
The file is added despite the warning.
The warning is ON by default. It can be suppressed by setting the config option
'portablefilenames' in section 'ui' to 'ignore' or 'false':
$ hg --config ui.portablefilenames=ignore add con.xml
$ hg sta
A con.xml
If ui.portablefilenames is set to 'abort', then the command is aborted:
$ hg --config ui.portablefilenames=abort add con.xml
abort: filename contains 'con', which is reserved on Windows: 'con.xml'
On Windows, the ui.portablefilenames config setting is irrelevant and the
command is always aborted if a problematic filename is found.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 19 Apr 2011 12:42:53 +0200 |
parents | 03f3ce7ca2a8 |
children | bfeaa88b875d |
comparison
equal
deleted
inserted
replaced
13961:1708a0cad774 | 13962:8b252e826c68 |
---|---|
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from node import hex, nullid, nullrev, short | 8 from node import hex, nullid, nullrev, short |
9 from i18n import _ | 9 from i18n import _ |
10 import os, sys, errno, re, glob, tempfile | 10 import os, sys, errno, re, glob, tempfile |
11 import util, templater, patch, error, encoding, templatekw | 11 import util, scmutil, templater, patch, error, encoding, templatekw |
12 import match as matchmod | 12 import match as matchmod |
13 import similar, revset, subrepo | 13 import similar, revset, subrepo |
14 | 14 |
15 revrangesep = ':' | 15 revrangesep = ':' |
16 | 16 |
433 reltarget = repo.pathto(abstarget, cwd) | 433 reltarget = repo.pathto(abstarget, cwd) |
434 target = repo.wjoin(abstarget) | 434 target = repo.wjoin(abstarget) |
435 src = repo.wjoin(abssrc) | 435 src = repo.wjoin(abssrc) |
436 state = repo.dirstate[abstarget] | 436 state = repo.dirstate[abstarget] |
437 | 437 |
438 util.checkfilename(abstarget) | 438 scmutil.checkportable(ui, abstarget) |
439 | 439 |
440 # check for collisions | 440 # check for collisions |
441 prevsrc = targets.get(abstarget) | 441 prevsrc = targets.get(abstarget) |
442 if prevsrc is not None: | 442 if prevsrc is not None: |
443 ui.warn(_('%s: not overwriting - %s collides with %s\n') % | 443 ui.warn(_('%s: not overwriting - %s collides with %s\n') % |