diff -r 28a97cf212af -r 02c35e640b3c hgext/mq.py --- a/hgext/mq.py Tue Feb 06 08:54:36 2018 -0800 +++ b/hgext/mq.py Tue Feb 06 08:55:54 2018 -0800 @@ -553,10 +553,8 @@ for patchfn in patches: patchf = self.opener(patchfn, 'r') # if the patch was a git patch, refresh it as a git patch - for line in patchf: - if line.startswith('diff --git'): - diffopts.git = True - break + diffopts.git = any(line.startswith('diff --git') + for line in patchf) patchf.close() return diffopts