comparison mercurial/context.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 653121e6941f
children 97ed99d1f419
comparison
equal deleted inserted replaced
13961:1708a0cad774 13962:8b252e826c68
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
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 nullid, nullrev, short, hex 8 from node import nullid, nullrev, short, hex
9 from i18n import _ 9 from i18n import _
10 import ancestor, bdiff, error, util, subrepo, patch, encoding 10 import ancestor, bdiff, error, util, scmutil, subrepo, patch, encoding
11 import os, errno, stat 11 import os, errno, stat
12 12
13 propertycache = util.propertycache 13 propertycache = util.propertycache
14 14
15 class changectx(object): 15 class changectx(object):
799 wlock = self._repo.wlock() 799 wlock = self._repo.wlock()
800 ui, ds = self._repo.ui, self._repo.dirstate 800 ui, ds = self._repo.ui, self._repo.dirstate
801 try: 801 try:
802 rejected = [] 802 rejected = []
803 for f in list: 803 for f in list:
804 scmutil.checkportable(ui, join(f))
804 p = self._repo.wjoin(f) 805 p = self._repo.wjoin(f)
805 try: 806 try:
806 st = os.lstat(p) 807 st = os.lstat(p)
807 except: 808 except:
808 ui.warn(_("%s does not exist!\n") % join(f)) 809 ui.warn(_("%s does not exist!\n") % join(f))