comparison mercurial/context.py @ 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 650b5b6e75ed
children 94f77624dbb5
comparison
equal deleted inserted replaced
22312:8b980fbbd6dc 22313:d226fe36e362
1591 user receives the committer name and defaults to current 1591 user receives the committer name and defaults to current
1592 repository username, date is the commit date in any format 1592 repository username, date is the commit date in any format
1593 supported by util.parsedate() and defaults to current date, extra 1593 supported by util.parsedate() and defaults to current date, extra
1594 is a dictionary of metadata or is left empty. 1594 is a dictionary of metadata or is left empty.
1595 """ 1595 """
1596
1597 # Mercurial <= 3.1 expects the filectxfn to raise IOError for missing files.
1598 # Extensions that need to retain compatibility across Mercurial 3.1 can use
1599 # this field to determine what to do in filectxfn.
1600 _returnnoneformissingfiles = True
1601
1596 def __init__(self, repo, parents, text, files, filectxfn, user=None, 1602 def __init__(self, repo, parents, text, files, filectxfn, user=None,
1597 date=None, extra=None, editor=False): 1603 date=None, extra=None, editor=False):
1598 super(memctx, self).__init__(repo, text, user, date, extra) 1604 super(memctx, self).__init__(repo, text, user, date, extra)
1599 self._rev = None 1605 self._rev = None
1600 self._node = None 1606 self._node = None