hgext/win32text.py
branchstable
changeset 48796 c00d3ce4e94b
parent 48388 f5dea753fe4e
child 48875 6000f5b25c9b
equal deleted inserted replaced
48776:b84ff512b645 48796:c00d3ce4e94b
    45 
    45 
    46 import re
    46 import re
    47 from mercurial.i18n import _
    47 from mercurial.i18n import _
    48 from mercurial.node import short
    48 from mercurial.node import short
    49 from mercurial import (
    49 from mercurial import (
       
    50     cmdutil,
       
    51     extensions,
    50     pycompat,
    52     pycompat,
    51     registrar,
    53     registrar,
    52 )
    54 )
    53 from mercurial.utils import stringutil
    55 from mercurial.utils import stringutil
    54 
    56 
   213         return
   215         return
   214     for name, fn in pycompat.iteritems(_filters):
   216     for name, fn in pycompat.iteritems(_filters):
   215         repo.adddatafilter(name, fn)
   217         repo.adddatafilter(name, fn)
   216 
   218 
   217 
   219 
       
   220 def wrap_revert(orig, repo, ctx, names, uipathfn, actions, *args, **kwargs):
       
   221     # reset dirstate cache for file we touch
       
   222     ds = repo.dirstate
       
   223     with ds.parentchange():
       
   224         for filename in actions[b'revert'][0]:
       
   225             entry = ds.get_entry(filename)
       
   226             if entry is not None:
       
   227                 if entry.p1_tracked:
       
   228                     ds.update_file(
       
   229                         filename,
       
   230                         entry.tracked,
       
   231                         p1_tracked=True,
       
   232                         p2_info=entry.p2_info,
       
   233                     )
       
   234     return orig(repo, ctx, names, uipathfn, actions, *args, **kwargs)
       
   235 
       
   236 
   218 def extsetup(ui):
   237 def extsetup(ui):
   219     # deprecated config: win32text.warn
   238     # deprecated config: win32text.warn
   220     if ui.configbool(b'win32text', b'warn'):
   239     if ui.configbool(b'win32text', b'warn'):
   221         ui.warn(
   240         ui.warn(
   222             _(
   241             _(
   223                 b"win32text is deprecated: "
   242                 b"win32text is deprecated: "
   224                 b"https://mercurial-scm.org/wiki/Win32TextExtension\n"
   243                 b"https://mercurial-scm.org/wiki/Win32TextExtension\n"
   225             )
   244             )
   226         )
   245         )
       
   246     extensions.wrapfunction(cmdutil, '_performrevert', wrap_revert)