diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -363,7 +363,15 @@ def abort(s): raise error.Abort( _('invalid value %r for option %s, %s') % (val, opt, s)) - state[name] = defmap[name].newstate(state[name], val, abort) + if name == 'message': + if state[name] != '': + new_message = state[name] + "\n" + val + state[name] = defmap[name].newstate(state[name], \ + new_message, abort) + else: + state[name] = defmap[name].newstate(state[name], val, abort) + else : + state[name] = defmap[name].newstate(state[name], val, abort) # return unparsed args return args diff --git a/tests/test-commit.t b/tests/test-commit.t --- a/tests/test-commit.t +++ b/tests/test-commit.t @@ -17,7 +17,7 @@ $ hg commit -d '1 4444444' -m commit-3 hg: parse error: impossible time zone offset: 4444444 [255] - $ hg commit -d '1 15.1' -m commit-4 + $ hg commit -d '1 15.1' -m commit-4 hg: parse error: invalid date: '1\t15.1' [255] $ hg commit -d 'foo bar' -m commit-5 @@ -512,8 +512,8 @@ HG: dels= HG: files=changed HG: - HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 - HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 + HG: --- a/changed Thu Jan 01 00:00:00 1970 +0000 + HG: +++ b/changed Thu Jan 01 00:00:00 1970 +0000 HG: @@ -1,1 +1,2 @@ HG: changed HG: +changed @@ -573,8 +573,8 @@ HG: dels=removed HG: files=added removed HG: - HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 + HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: +++ b/added Thu Jan 01 00:00:00 1970 +0000 HG: @@ -0,0 +1,1 @@ HG: +added HG: @@ -583,8 +583,8 @@ HG: dels=removed HG: files=added removed HG: - HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 - HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 + HG: --- a/removed Thu Jan 01 00:00:00 1970 +0000 + HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 HG: @@ -1,1 +0,0 @@ HG: -removed HG: @@ -644,14 +644,14 @@ $ cat > evil-commit.py < from __future__ import absolute_import > from mercurial import context, hg, node, ui as uimod - > notrc = u".h\u200cg".encode('utf-8') + '/hgrc' + > notrc = u".h\u200cg".encode('utf-8') + b'/hgrc' > u = uimod.ui.load() - > r = hg.repository(u, '.') + > r = hg.repository(u, b'.') > def filectxfn(repo, memctx, path): > return context.memfilectx(repo, memctx, path, - > '[hooks]\nupdate = echo owned') - > c = context.memctx(r, [r['tip'].node(), node.nullid], - > 'evil', [notrc], filectxfn, 0) + > b'[hooks]\nupdate = echo owned') + > c = context.memctx(r, [r[b'tip'].node(), node.nullid], + > b'evil', [notrc], filectxfn, 0) > r.commitctx(c) > EOF $ $PYTHON evil-commit.py @@ -670,14 +670,14 @@ $ cat > evil-commit.py < from __future__ import absolute_import > from mercurial import context, hg, node, ui as uimod - > notrc = "HG~1/hgrc" + > notrc = b"HG~1/hgrc" > u = uimod.ui.load() - > r = hg.repository(u, '.') + > r = hg.repository(u, b'.') > def filectxfn(repo, memctx, path): > return context.memfilectx(repo, memctx, path, - > '[hooks]\nupdate = echo owned') - > c = context.memctx(r, [r['tip'].node(), node.nullid], - > 'evil', [notrc], filectxfn, 0) + > b'[hooks]\nupdate = echo owned') + > c = context.memctx(r, [r[b'tip'].node(), node.nullid], + > b'evil', [notrc], filectxfn, 0) > r.commitctx(c) > EOF $ $PYTHON evil-commit.py @@ -690,14 +690,14 @@ $ cat > evil-commit.py < from __future__ import absolute_import > from mercurial import context, hg, node, ui as uimod - > notrc = "HG8B6C~2/hgrc" + > notrc = b"HG8B6C~2/hgrc" > u = uimod.ui.load() - > r = hg.repository(u, '.') + > r = hg.repository(u, b'.') > def filectxfn(repo, memctx, path): > return context.memfilectx(repo, memctx, path, - > '[hooks]\nupdate = echo owned') - > c = context.memctx(r, [r['tip'].node(), node.nullid], - > 'evil', [notrc], filectxfn, 0) + > b'[hooks]\nupdate = echo owned') + > c = context.memctx(r, [r[b'tip'].node(), node.nullid], + > b'evil', [notrc], filectxfn, 0) > r.commitctx(c) > EOF $ $PYTHON evil-commit.py @@ -762,8 +762,8 @@ HG: Leave message empty to abort commit. HG: ------------------------ >8 ------------------------ diff -r e63c23eaa88a foo2 - --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000 + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/foo2 Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ +foo2 $ hg log -T '{desc}\n' -r . @@ -789,8 +789,8 @@ HG: Leave message empty to abort commit. HG: ------------------------ >8 ------------------------ diff -r 3661b22b0702 foo - --- a/foo Thu Jan 01 00:00:00 1970 +0000 - +++ b/foo Thu Jan 01 00:00:00 1970 +0000 + --- a/foo Thu Jan 01 00:00:00 1970 +0000 + +++ b/foo Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +1,2 @@ foo +foo @@ -820,8 +820,8 @@ HG: Leave message empty to abort commit. HG: ------------------------ >8 ------------------------ diff -r ce648f5f066f foo - --- a/foo Thu Jan 01 00:00:00 1970 +0000 - +++ b/foo Thu Jan 01 00:00:00 1970 +0000 + --- a/foo Thu Jan 01 00:00:00 1970 +0000 + +++ b/foo Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +1,3 @@ foo foo @@ -832,3 +832,21 @@ $ cd .. +Test that commit accpets multiple message (-m) flags + + $ hg init test4 + $ cd test4/ + $ echo a>>a + $ hg commit -qAm "This is the first line" -m "This is the follwing line" + $ hg log -v + changeset: 0:5e33a0fb6989 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + files: a + description: + This is the first line + This is the follwing line + + + $ cd ..