changeset 27321:dcdf0a52ad36

crecord: add dictionary to default return value of filterpatch When committing interactively without changes, the user would get a ValueError exception. This patch adds a dictionary to the return value of filterpatch when there are no files to change.
author Laurent Charignon <lcharignon@fb.com>
date Wed, 09 Dec 2015 17:01:27 -0800
parents b64b6fdc5c9b
children 84e85f461b79
files mercurial/crecord.py tests/test-commit-interactive-curses.t
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/crecord.py	Wed Dec 02 16:12:15 2015 -0800
+++ b/mercurial/crecord.py	Wed Dec 09 17:01:27 2015 -0800
@@ -451,7 +451,7 @@
 
     # if there are no changed files
     if len(headers) == 0:
-        return []
+        return [], {}
     uiheaders = [uiheader(h) for h in headers]
     # let user choose headers/hunks/lines, and mark their applied flags
     # accordingly
--- a/tests/test-commit-interactive-curses.t	Wed Dec 02 16:12:15 2015 -0800
+++ b/tests/test-commit-interactive-curses.t	Wed Dec 09 17:01:27 2015 -0800
@@ -41,6 +41,10 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     a
   
+Check that commit -i works with no changes
+  $ hg commit -i
+  no changes to record
+
 Committing only one file
 
   $ echo "a" >> a