# HG changeset patch # User Augie Fackler # Date 2019-05-09 22:37:37 # Node ID 838f3a094b4fb9169c5a8552a7ae01c7735fe62a # Parent b3fc78c028efa8c39545b9cedc471111675bba4b # Parent ce5f1232631ffd86d283e0087cf29b19a5bb039a merge with stable diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -272,6 +272,15 @@ def dorecord(ui, repo, commitfunc, cmdsu raise error.Abort(_('cannot partially commit a merge ' '(use "hg commit" instead)')) + def fail(f, msg): + raise error.Abort('%s: %s' % (f, msg)) + + force = opts.get('force') + if not force: + vdirs = [] + match.explicitdir = vdirs.append + match.bad = fail + status = repo.status(match=match) overrides = {(b'ui', b'commitsubrepos'): True} @@ -294,15 +303,6 @@ def dorecord(ui, repo, commitfunc, cmdsu dirtyreason = wctx.sub(s).dirtyreason(True) raise error.Abort(dirtyreason) - def fail(f, msg): - raise error.Abort('%s: %s' % (f, msg)) - - force = opts.get('force') - if not force: - vdirs = [] - match.explicitdir = vdirs.append - match.bad = fail - if not force: repo.checkcommitpatterns(wctx, vdirs, match, status, fail) diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True, diff --git a/mercurial/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -147,7 +147,8 @@ def buildargsdict(trees, funcname, argsp arguments are rejected, but missing keyword arguments are just omitted. """ poskeys, varkey, keys, optkey = argspec - kwstart = next((i for i, x in enumerate(trees) if x[0] == keyvaluenode), + kwstart = next((i for i, x in enumerate(trees) + if x and x[0] == keyvaluenode), len(trees)) if kwstart < len(poskeys): raise error.ParseError(_("%(func)s takes at least %(nargs)d positional " @@ -171,7 +172,7 @@ def buildargsdict(trees, funcname, argsp if optkey: args[optkey] = util.sortdict() for x in trees[kwstart:]: - if x[0] != keyvaluenode or x[1][0] != keynode: + if not x or x[0] != keyvaluenode or x[1][0] != keynode: raise error.ParseError(_("%(func)s got an invalid argument") % {'func': funcname}) k = x[1][1] diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -722,7 +722,7 @@ def _defaultcacerts(ui): certs = certifi.where() if os.path.exists(certs): ui.debug('using ca certificates from certifi\n') - return certs + return pycompat.fsencode(certs) except (ImportError, AttributeError): pass diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t --- a/tests/test-commit-interactive.t +++ b/tests/test-commit-interactive.t @@ -775,12 +775,24 @@ Record end +10 +11 +Interactive commit can name a directory instead of files (issue6131) $ mkdir subdir + $ echo a > subdir/a + $ hg ci -d '16 0' -i subdir -Amsubdir < y + > y + > EOF + adding subdir/a + diff --git a/subdir/a b/subdir/a + new file mode 100644 + examine changes to 'subdir/a'? [Ynesfdaq?] y + + @@ -0,0 +1,1 @@ + +a + record this change to 'subdir/a'? [Ynesfdaq?] y + $ cd subdir - $ echo a > a - $ hg ci -d '16 0' -Amsubdir - adding subdir/a $ echo a >> a $ hg commit -i -d '16 0' -m subdir-change a <