# HG changeset patch # User Anton Shestakov # Date 1556863876 -28800 # Node ID 0f01394457a0343c22e535807bbdce5e58f56beb # Parent 165b1aad43da84e5578e9fb567bcbcdd4eebc6c4 commit: add ability to print file status after each successful invocation When commands.commit.post-status is enabled, `hg commit` will effectively run `hg status -mardu` after committing. It can help catch mistakes like not committing all needed files or not adding unknown files that should've been part of the just created commit. diff -r 165b1aad43da -r 0f01394457a0 mercurial/commands.py --- a/mercurial/commands.py Fri May 03 14:07:14 2019 +0800 +++ b/mercurial/commands.py Fri May 03 14:11:16 2019 +0800 @@ -1735,6 +1735,10 @@ cmdutil.commitstatus(repo, node, branch, bheads, opts) + if not ui.quiet and ui.configbool('commands', 'commit.post-status'): + status(ui, repo, modified=True, added=True, removed=True, deleted=True, + unknown=True, subrepos=opts.get('subrepos')) + @command('config|showconfig|debugconfig', [('u', 'untrusted', None, _('show untrusted configuration options')), ('e', 'edit', None, _('edit user config')), diff -r 165b1aad43da -r 0f01394457a0 mercurial/configitems.py --- a/mercurial/configitems.py Fri May 03 14:07:14 2019 +0800 +++ b/mercurial/configitems.py Fri May 03 14:11:16 2019 +0800 @@ -202,6 +202,9 @@ default=dynamicdefault, ) _registerdiffopts(section='commands', configprefix='commit.interactive.') +coreconfigitem('commands', 'commit.post-status', + default=False, +) coreconfigitem('commands', 'grep.all-files', default=False, ) diff -r 165b1aad43da -r 0f01394457a0 mercurial/help/config.txt --- a/mercurial/help/config.txt Fri May 03 14:07:14 2019 +0800 +++ b/mercurial/help/config.txt Fri May 03 14:11:16 2019 +0800 @@ -438,6 +438,10 @@ ``commands`` ------------ +``commit.post-status`` + Show status of files in the working directory after successful commit. + (default: False) + ``resolve.confirm`` Confirm before performing action if no filename is passed. (default: False) diff -r 165b1aad43da -r 0f01394457a0 tests/test-commit.t --- a/tests/test-commit.t Fri May 03 14:07:14 2019 +0800 +++ b/tests/test-commit.t Fri May 03 14:11:16 2019 +0800 @@ -838,3 +838,42 @@ second line $ cd .. + +testing commands.commit.post-status config option + + $ hg init ci-post-st + $ cd ci-post-st + $ echo '[commands]' > .hg/hgrc + $ echo 'commit.post-status = 1' >> .hg/hgrc + + $ echo 'ignored-file' > .hgignore + $ hg ci -qAm 0 + + $ echo 'c' > clean-file + $ echo 'a' > added-file + $ echo '?' > unknown-file + $ echo 'i' > ignored-file + $ hg add clean-file added-file + $ hg ci -m 1 clean-file + A added-file + ? unknown-file + $ hg st -mardu + A added-file + ? unknown-file + + $ touch modified-file + $ hg add modified-file + $ hg ci -m 2 modified-file -q + + $ echo 'm' > modified-file + $ hg ci --amend -m 'reworded' -X 're:' + saved backup bundle to $TESTTMP/ci-post-st/.hg/strip-backup/*-amend.hg (glob) + M modified-file + A added-file + ? unknown-file + $ hg st -mardu + M modified-file + A added-file + ? unknown-file + + $ cd ..