changeset 13899:a7cd0eee396b

commit: note when files are missing Before, you could experience the following strange interaction: $ hg commit nothing changed $ hg merge abort: outstanding uncommitted changes which confused at least one user in #mercurial.
author Martin Geisler <mg@aragost.com>
date Wed, 06 Apr 2011 16:21:12 +0200
parents 77b09a7fc8fc
children a6c69abd91a0
files mercurial/commands.py tests/test-commit.t
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Apr 06 15:26:49 2011 +0200
+++ b/mercurial/commands.py	Wed Apr 06 16:21:12 2011 +0200
@@ -894,7 +894,12 @@
 
     node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
     if not node:
-        ui.status(_("nothing changed\n"))
+        stat = repo.status(match=cmdutil.match(repo, pats, opts))
+        if stat[3]:
+            ui.status(_("nothing changed (%d missing files, see 'hg status')\n")
+                      % len(stat[3]))
+        else:
+            ui.status(_("nothing changed\n"))
         return 1
 
     ctx = repo[node]
--- a/tests/test-commit.t	Wed Apr 06 15:26:49 2011 +0200
+++ b/tests/test-commit.t	Wed Apr 06 16:21:12 2011 +0200
@@ -32,7 +32,7 @@
   $ hg add bar
   $ rm bar
   $ hg commit -m commit-8
-  nothing changed
+  nothing changed (1 missing files, see 'hg status')
   [1]
   $ hg commit -m commit-8-2 bar
   abort: bar: file not found!