Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 13974:23f2736abce3
move checkfilename from util to scmutil
checkfilename is specific to Mercurial, since it contains the knowledege
that Mercurial can't track files with \n or \r in the name.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Thu, 21 Apr 2011 13:18:52 +0200 |
parents | 366fa83f9820 |
children | 938fbeacac84 |
comparison
equal
deleted
inserted
replaced
13973:366fa83f9820 | 13974:23f2736abce3 |
---|---|
7 | 7 |
8 from i18n import _ | 8 from i18n import _ |
9 import util, error | 9 import util, error |
10 import os, errno, stat | 10 import os, errno, stat |
11 | 11 |
12 def checkfilename(f): | |
13 '''Check that the filename f is an acceptable filename for a tracked file''' | |
14 if '\r' in f or '\n' in f: | |
15 raise util.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) | |
16 | |
12 def checkportable(ui, f): | 17 def checkportable(ui, f): |
13 '''Check if filename f is portable and warn or abort depending on config''' | 18 '''Check if filename f is portable and warn or abort depending on config''' |
14 util.checkfilename(f) | 19 checkfilename(f) |
15 val = ui.config('ui', 'portablefilenames', 'warn') | 20 val = ui.config('ui', 'portablefilenames', 'warn') |
16 lval = val.lower() | 21 lval = val.lower() |
17 abort = os.name == 'nt' or lval == 'abort' | 22 abort = os.name == 'nt' or lval == 'abort' |
18 bval = util.parsebool(val) | 23 bval = util.parsebool(val) |
19 if abort or lval == 'warn' or bval: | 24 if abort or lval == 'warn' or bval: |