Patchwork [6,of,8,shelve-ext] shelve: move 'nothing changed' messaging to a separate function

login
register
mail settings
Submitter Kostia Balytskyi
Date Nov. 8, 2016, 1:51 p.m.
Message ID <31ef2cba32928a93982e.1478613102@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17397/
State Superseded
Headers show

Comments

Kostia Balytskyi - Nov. 8, 2016, 1:51 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@fb.com>
# Date 1478543425 28800
#      Mon Nov 07 10:30:25 2016 -0800
# Node ID 31ef2cba32928a93982ea6adea2d189030ce18bf
# Parent  30a215efa288dea9294407037ed962d9ec466b23
shelve: move 'nothing changed' messaging to a separate function

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -322,6 +322,15 @@  def getcommitfunc(extra, interactive, ed
 
     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()
@@ -370,12 +379,7 @@  def _docreatecmd(ui, repo, pats, opts):
             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]))