D2588: commit: adds multiline commit message support(issue5616)
sangeet259 (Sangeet Kumar Mishra)
phabricator at mercurial-scm.org
Sun Mar 4 00:04:44 EST 2018
sangeet259 updated this revision to Diff 6536.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D2588?vs=6438&id=6536
REVISION DETAIL
https://phab.mercurial-scm.org/D2588
AFFECTED FILES
mercurial/fancyopts.py
tests/test-commit.t
CHANGE DETAILS
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -832,3 +832,20 @@
$ 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 ..
diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py
--- a/mercurial/fancyopts.py
+++ b/mercurial/fancyopts.py
@@ -362,7 +362,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
To: sangeet259, #hg-reviewers
Cc: jeffpc, mercurial-devel
More information about the Mercurial-devel
mailing list