changeset 22313:d226fe36e362

memctx: allow extensions to determine what filectxfn should do Rev 650b5b6e75ed switched the contract for filectxfn from "raise IOError if file is missing" to "return None if file is missing". Out of tree extensions need to be updated for that, but for extensions interested in compatibility with both Mercurial <= 3.1 and default, it is next to impossible to introspect core Mercurial to figure out what to do. This patch adds a field to memctx for extensions to use.
author Siddharth Agarwal <sid0@fb.com>
date Sat, 30 Aug 2014 05:29:38 -0700
parents 8b980fbbd6dc
children 188b8aa2120b
files mercurial/context.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Sat Aug 30 15:17:37 2014 +0200
+++ b/mercurial/context.py	Sat Aug 30 05:29:38 2014 -0700
@@ -1593,6 +1593,12 @@
     supported by util.parsedate() and defaults to current date, extra
     is a dictionary of metadata or is left empty.
     """
+
+    # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files.
+    # Extensions that need to retain compatibility across Mercurial 3.1 can use
+    # this field to determine what to do in filectxfn.
+    _returnnoneformissingfiles = True
+
     def __init__(self, repo, parents, text, files, filectxfn, user=None,
                  date=None, extra=None, editor=False):
         super(memctx, self).__init__(repo, text, user, date, extra)