Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Commit 3aaf58e1 authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

win32text: drop associated dirstate cache information on revert

Otherwise the could get size from one version of the file while the on-disk
version is still clean but with another size.

This fix the previously introduced error.

Differential Revision:
parent f838f5bca038
......@@ -38,8 +38,8 @@ def wrapdirstate(repo, dirstate):
return super(narrowdirstate, self).normal(*args, **kwargs)
def set_tracked(self, *args):
return super(narrowdirstate, self).set_tracked(*args)
def set_tracked(self, *args, **kwargs):
return super(narrowdirstate, self).set_tracked(*args, **kwargs)
def set_untracked(self, *args):
......@@ -47,6 +47,8 @@ import re
from mercurial.i18n import _
from mercurial.node import short
from mercurial import (
......@@ -215,6 +217,23 @@ def reposetup(ui, repo):
repo.adddatafilter(name, fn)
def wrap_revert(orig, repo, ctx, names, uipathfn, actions, *args, **kwargs):
# reset dirstate cache for file we touch
ds = repo.dirstate
with ds.parentchange():
for filename in actions[b'revert'][0]:
entry = ds.get_entry(filename)
if entry is not None:
if entry.p1_tracked:
return orig(repo, ctx, names, uipathfn, actions, *args, **kwargs)
def extsetup(ui):
# deprecated config: win32text.warn
if ui.configbool(b'win32text', b'warn'):
......@@ -224,3 +243,4 @@ def extsetup(ui):
extensions.wrapfunction(cmdutil, '_performrevert', wrap_revert)
......@@ -418,7 +418,6 @@ Disable warning:
$ hg revert -a
reverting linefeed
$ hg st -q
M linefeed (known-bad-output !)
$ cat linefeed
% just linefeed\r (esc)
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