[PATCH] crecord: add dictionary to default return value of filterpatch

cdelahousse at fb.com cdelahousse at fb.com
Thu Dec 10 01:10:13 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1449709287 28800
#      Wed Dec 09 17:01:27 2015 -0800
# Node ID 9a1a06e8de4b19baa01277db2ae6d46fa74b91b0
# Parent  42aa0e570eaa364a622bc4443b0bcb79b1100a58
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.

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -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
diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
--- a/tests/test-commit-interactive-curses.t
+++ b/tests/test-commit-interactive-curses.t
@@ -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


More information about the Mercurial-devel mailing list