diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -96,13 +96,11 @@ class patchheader(object): for line in file(pf): line = line.rstrip() - if line.startswith('diff --git'): + if (line.startswith('diff --git') + or (diffstart and line.startswith('+++ '))): diffstart = 2 break - if diffstart: - if line.startswith('+++ '): - diffstart = 2 - break + diffstart = 0 # reset if line.startswith("--- "): diffstart = 1 continue diff --git a/tests/test-mq-qimport b/tests/test-mq-qimport --- a/tests/test-mq-qimport +++ b/tests/test-mq-qimport @@ -43,6 +43,7 @@ Text before patch. First line of commit message. More text in commit message. +--- confuse the diff detection diff --git a/x b/x new file mode 100644