--- a/mercurial/cmdutil.py Thu May 17 15:33:28 2018 -0700
+++ b/mercurial/cmdutil.py Thu May 17 23:11:24 2018 -0700
@@ -197,17 +197,21 @@
return oldwrite
def filterchunks(ui, originalhunks, usecurses, testfile, operation=None):
- if usecurses:
- if testfile:
- recordfn = crecordmod.testdecorator(testfile,
- crecordmod.testchunkselector)
- else:
- recordfn = crecordmod.chunkselector
-
- return crecordmod.filterpatch(ui, originalhunks, recordfn, operation)
-
- else:
- return patch.filterpatch(ui, originalhunks, operation)
+ try:
+ if usecurses:
+ if testfile:
+ recordfn = crecordmod.testdecorator(
+ testfile, crecordmod.testchunkselector)
+ else:
+ recordfn = crecordmod.chunkselector
+
+ return crecordmod.filterpatch(ui, originalhunks, recordfn,
+ operation)
+ except crecordmod.fallbackerror as e:
+ ui.warn('%s\n' % e.message)
+ ui.warn(_('falling back to text mode\n'))
+
+ return patch.filterpatch(ui, originalhunks, operation)
def recordfilter(ui, originalhunks, operation=None):
""" Prompts the user to filter the originalhunks and return a list of