# HG changeset patch # User Philippe Pepiot # Date 1476431558 -7200 # Node ID df224038c5161e23888f7f71cfbd38d88fb0de4d # Parent 75c71c53397782679aa746dca71c535c27da7551 commit: return 1 for interactive commit with no changes (issue5397) For consistency with non interactive commit diff -r 75c71c533977 -r df224038c516 mercurial/commands.py --- a/mercurial/commands.py Fri Oct 14 03:03:39 2016 +0200 +++ b/mercurial/commands.py Fri Oct 14 09:52:38 2016 +0200 @@ -1638,9 +1638,11 @@ def _docommit(ui, repo, *pats, **opts): if opts.get('interactive'): opts.pop('interactive') - cmdutil.dorecord(ui, repo, commit, None, False, - cmdutil.recordfilter, *pats, **opts) - return + ret = cmdutil.dorecord(ui, repo, commit, None, False, + cmdutil.recordfilter, *pats, **opts) + # ret can be 0 (no changes to record) or the value returned by + # commit(), 1 if nothing changed or None on success. + return 1 if ret == 0 else ret if opts.get('subrepos'): if opts.get('amend'): diff -r 75c71c533977 -r df224038c516 tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t Fri Oct 14 03:03:39 2016 +0200 +++ b/tests/test-commit-interactive-curses.t Fri Oct 14 09:52:38 2016 +0200 @@ -37,6 +37,7 @@ > EOF $ hg commit -i -m "a" -d "0 0" no changes to record + [1] $ hg tip changeset: -1:000000000000 tag: tip @@ -60,6 +61,7 @@ Check that commit -i works with no changes $ hg commit -i no changes to record + [1] Committing only one file diff -r 75c71c533977 -r df224038c516 tests/test-commit-interactive.t --- a/tests/test-commit-interactive.t Fri Oct 14 03:03:39 2016 +0200 +++ b/tests/test-commit-interactive.t Fri Oct 14 09:52:38 2016 +0200 @@ -29,6 +29,7 @@ examine changes to 'empty-rw'? [Ynesfdaq?] n no changes to record + [1] $ hg tip -p changeset: -1:000000000000 @@ -1376,6 +1377,7 @@ record this change to 'editedfile'? [Ynesfdaq?] e no changes to record + [1] $ cat editedfile This change will not be committed This is the second line @@ -1487,6 +1489,7 @@ record this change to 'editedfile'? [Ynesfdaq?] n no changes to record + [1] random text in random positions is still an error