Commit d4cdba70 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

compat: patch overlayworkingctx._markdirty() for hg 5.0 and earlier

This is required for the fix for issue6416 (4a09e95d29c9) to work on older
Mercurial versions.
parent 189f4775ac2b
Pipeline #25728 passed with stage
in 16 minutes and 45 seconds
......@@ -493,3 +493,39 @@
flags=self.flags(path), copied=origin)
context.overlayworkingctx.markcopied = fixedmarkcopied
# what we're actually targeting here is e079e001d536
# hg <= 5.0 (dc3fdd1b5af4)
try:
from mercurial import state as statemod
markdirtyfixed = util.safehasattr(statemod, '_statecheck')
except (AttributeError, ImportError):
markdirtyfixed = False
if not markdirtyfixed:
def fixedmarkdirty(
self,
path,
exists,
data=None,
date=None,
flags='',
copied=None,
):
# 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')
if data is None:
data = self._wrappedctx[path].data()
self._cache[path] = {
'exists': exists,
'data': data,
'date': date,
'flags': flags,
'copied': copied,
}
context.overlayworkingctx._markdirty = fixedmarkdirty
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment