Mercurial > hg
changeset 30382:dedf0915ca5b
shelve: move 'nothing changed' messaging to a separate function
This has nothing to do with the future obsshelve implementation, I just
thought that moving this messaging to a separate function will improve
shelve code readability.
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Thu, 10 Nov 2016 03:33:01 -0800 |
parents | caba61934721 |
children | 455f7856db20 |
files | hgext/shelve.py |
diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/shelve.py Thu Nov 10 03:26:31 2016 -0800 +++ b/hgext/shelve.py Thu Nov 10 03:33:01 2016 -0800 @@ -320,6 +320,14 @@ return interactivecommitfunc if interactive else commitfunc +def _nothingtoshelvemessaging(ui, repo, pats, opts): + stat = repo.status(match=scmutil.match(repo[None], pats, opts)) + if stat.deleted: + ui.status(_("nothing changed (%d missing files, see " + "'hg status')\n") % len(stat.deleted)) + else: + ui.status(_("nothing changed\n")) + def _docreatecmd(ui, repo, pats, opts): wctx = repo[None] parents = wctx.parents() @@ -369,12 +377,7 @@ node = cmdutil.dorecord(ui, repo, commitfunc, None, False, cmdutil.recordfilter, *pats, **opts) if not node: - stat = repo.status(match=scmutil.match(repo[None], pats, opts)) - if stat.deleted: - ui.status(_("nothing changed (%d missing files, see " - "'hg status')\n") % len(stat.deleted)) - else: - ui.status(_("nothing changed\n")) + _nothingtoshelvemessaging(ui, repo, pats, opts) return 1 bases = list(mutableancestors(repo[node]))