diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -116,6 +116,7 @@ for i in [0, 1]: utestpats[i].append((p, m)) utestfilters = [ + (r"<<(\S+)((.|\n)*?\n > \1)", rephere), (r"( *)(#([^\n]*\S)?)", repcomment), ] diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -5,7 +5,8 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -import getopt +import getopt, util +from i18n import _ def gnugetopt(args, options, longoptions): """Parse options mostly like getopt.gnu_getopt. @@ -105,7 +106,11 @@ def fancyopts(args, options, state, gnu= if t is type(fancyopts): state[name] = defmap[name](val) elif t is type(1): - state[name] = int(val) + try: + state[name] = int(val) + except ValueError: + raise util.Abort(_('invalid value %r for option %s, ' + 'expected int') % (val, opt)) elif t is type(''): state[name] = val elif t is type([]): diff --git a/tests/test-check-code-hg.t b/tests/test-check-code-hg.t --- a/tests/test-check-code-hg.t +++ b/tests/test-check-code-hg.t @@ -162,19 +162,6 @@ tests/autodiff.py:0: > ui.write('data lost for: %s\n' % fn) warning: unwrapped ui message - tests/test-convert-mtn.t:0: - > > function get_passphrase(keypair_id) - don't use 'function', use old style - tests/test-import-git.t:0: - > > Mc\${NkU|\`?^000jF3jhEB - ^ must be quoted - tests/test-import.t:0: - > > diff -Naur proj-orig/foo proj-new/foo - don't use 'diff -N' - don't use 'diff -N' - tests/test-schemes.t:0: - > > z = file:\$PWD/ - don't use $PWD, use `pwd` tests/test-ui-color.py:0: > testui.warn('warning\n') warning: unwrapped ui message diff --git a/tests/test-fncache.t b/tests/test-fncache.t --- a/tests/test-fncache.t +++ b/tests/test-fncache.t @@ -117,3 +117,43 @@ Non fncache repo: .hg/undo.dirstate $ cd .. +#if no-windows + +Encoding of reserved / long paths in the store + + $ hg init r2 + $ cd r2 + $ cat < .hg/hgrc + > [ui] + > portablefilenames = ignore + > EOF + + $ DIR="bla.aux/prn/PRN/lpt/com3/nul/coma/foo.NUL" + $ mkdir -p "$DIR" + $ echo foo > "$DIR/normal.c" + $ DIR="AUX/SECOND/X.PRN/FOURTH/FI:FTH/SIXTH/SEVENTH/EIGHTH/NINETH/TENTH/ELEVENTH" + $ mkdir -p "$DIR" + $ echo foo > "$DIR/LOREMIPSUM.TXT" + $ DIR="enterprise/openesbaddons/contrib-imola/corba-bc/netbeansplugin/wsdlExtension/src/main/java/META-INF/services" + $ mkdir -p "$DIR" + $ echo foo > "$DIR/org.netbeans.modules.xml.wsdl.bindingsupport.spi.ExtensibilityElementTemplateProvider" + $ DIR="Project Planning/Resources/AnotherLongDirectoryName/Followedbyanother/AndAnother" + $ mkdir -p "$DIR" + $ echo foo > "$DIR/AndThenAnExtremelyLongFileName.txt" + $ DIR="12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345" + $ mkdir -p "$DIR" + $ echo foo > "$DIR/xxxxxxxxx-xxxxxxxxx-xxxxxxxxx-123456789-12.3456789-12345-ABCDEFGHIJKLMNOPRSTUVWXYZ-abcdefghjiklmnopqrstuvwxyz" + $ hg ci -qAm1 + $ find .hg/store -name *.i | sort + .hg/store/00changelog.i + .hg/store/00manifest.i + .hg/store/data/bla.aux/pr~6e/_p_r_n/lpt/co~6d3/nu~6c/coma/foo._n_u_l/normal.c.i + .hg/store/dh/12345678/12345678/12345678/12345678/12345678/12345678/12345678/12345/xxxxxx168e07b38e65eff86ab579afaaa8e30bfbe0f35f.i + .hg/store/dh/au~78/second/x.prn/fourth/fi~3afth/sixth/seventh/eighth/nineth/tenth/loremia20419e358ddff1bf8751e38288aff1d7c32ec05.i + .hg/store/dh/enterpri/openesba/contrib-/corba-bc/netbeans/wsdlexte/src/main/java/org.net7018f27961fdf338a598a40c4683429e7ffb9743.i + .hg/store/dh/project_/resource/anotherl/followed/andanoth/andthenanextremelylongfilename0d8e1f4187c650e2f1fdca9fd90f786bc0976b6b.i + + $ cd .. + +#endif + diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -602,6 +602,9 @@ test -p0 $ echo a > a $ hg ci -Am t adding a + $ hg import -p foo + abort: invalid value 'foo' for option -p, expected int + [255] $ hg import -p0 - << EOF > foobar > --- a Sat Apr 12 22:43:58 2008 -0400