diff -r e09fad982ef5 -r 95bd19f60957 mercurial/context.py --- a/mercurial/context.py Tue Aug 14 22:20:28 2018 +0900 +++ b/mercurial/context.py Wed Aug 15 17:40:21 2018 -0700 @@ -2033,6 +2033,13 @@ return keys def _markdirty(self, path, exists, data=None, date=None, flags=''): + # data not provided, let's see if we already have some; if not, let's + # grab it from our underlying context, so that we always have data if + # the file is marked as existing. + if exists and data is None: + oldentry = self._cache.get(path) or {} + data = oldentry.get('data') or self._wrappedctx[path].data() + self._cache[path] = { 'exists': exists, 'data': data,