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.
( )
durin42 | |
martinvonz | |
Alphare |
hg-reviewers |
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.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | hgext/narrow/narrowdirstate.py (4 lines) | |||
M | hgext/win32text.py (20 lines) | |||
M | tests/test-win32text.t (1 line) |
Status | Author | Revision | |
---|---|---|---|
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute | ||
Closed | marmoute |
class narrowdirstate(dirstate.__class__): | class narrowdirstate(dirstate.__class__): | ||||
# Prevent adding/editing/copying/deleting files that are outside the | # Prevent adding/editing/copying/deleting files that are outside the | ||||
# sparse checkout | # sparse checkout | ||||
@_editfunc | @_editfunc | ||||
def normal(self, *args, **kwargs): | def normal(self, *args, **kwargs): | ||||
return super(narrowdirstate, self).normal(*args, **kwargs) | return super(narrowdirstate, self).normal(*args, **kwargs) | ||||
@_editfunc | @_editfunc | ||||
def set_tracked(self, *args): | def set_tracked(self, *args, **kwargs): | ||||
return super(narrowdirstate, self).set_tracked(*args) | return super(narrowdirstate, self).set_tracked(*args, **kwargs) | ||||
@_editfunc | @_editfunc | ||||
def set_untracked(self, *args): | def set_untracked(self, *args): | ||||
return super(narrowdirstate, self).set_untracked(*args) | return super(narrowdirstate, self).set_untracked(*args) | ||||
@_editfunc | @_editfunc | ||||
def add(self, *args): | def add(self, *args): | ||||
return super(narrowdirstate, self).add(*args) | return super(narrowdirstate, self).add(*args) |
''' | ''' | ||||
from __future__ import absolute_import | from __future__ import absolute_import | ||||
import re | import re | ||||
from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
from mercurial.node import short | from mercurial.node import short | ||||
from mercurial import ( | from mercurial import ( | ||||
cmdutil, | |||||
extensions, | |||||
pycompat, | pycompat, | ||||
registrar, | registrar, | ||||
) | ) | ||||
from mercurial.utils import stringutil | from mercurial.utils import stringutil | ||||
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for | ||||
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should | ||||
# be specifying the version(s) of Mercurial they are tested with, or | # be specifying the version(s) of Mercurial they are tested with, or | ||||
def reposetup(ui, repo): | def reposetup(ui, repo): | ||||
if not repo.local(): | if not repo.local(): | ||||
return | return | ||||
for name, fn in pycompat.iteritems(_filters): | for name, fn in pycompat.iteritems(_filters): | ||||
repo.adddatafilter(name, fn) | 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: | |||||
ds.update_file( | |||||
filename, | |||||
entry.tracked, | |||||
p1_tracked=True, | |||||
p2_info=entry.p2_info, | |||||
) | |||||
return orig(repo, ctx, names, uipathfn, actions, *args, **kwargs) | |||||
def extsetup(ui): | def extsetup(ui): | ||||
# deprecated config: win32text.warn | # deprecated config: win32text.warn | ||||
if ui.configbool(b'win32text', b'warn'): | if ui.configbool(b'win32text', b'warn'): | ||||
ui.warn( | ui.warn( | ||||
_( | _( | ||||
b"win32text is deprecated: " | b"win32text is deprecated: " | ||||
b"https://mercurial-scm.org/wiki/Win32TextExtension\n" | b"https://mercurial-scm.org/wiki/Win32TextExtension\n" | ||||
) | ) | ||||
) | ) | ||||
extensions.wrapfunction(cmdutil, '_performrevert', wrap_revert) |
% just linefeed | % just linefeed | ||||
$ hg st -q | $ hg st -q | ||||
$ echo modified >> linefeed | $ echo modified >> linefeed | ||||
$ hg st -q | $ hg st -q | ||||
M linefeed | M linefeed | ||||
$ hg revert -a | $ hg revert -a | ||||
reverting linefeed | reverting linefeed | ||||
$ hg st -q | $ hg st -q | ||||
M linefeed (known-bad-output !) | |||||
$ cat linefeed | $ cat linefeed | ||||
% just linefeed\r (esc) | % just linefeed\r (esc) | ||||
$ cd .. | $ cd .. |