diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py index ca1ad8ef38be225caec42564502aafe43cae173d_bWVyY3VyaWFsL2NtZHV0aWwucHk=..21b33f0460e045495b19312a0dbf05cf89fd21cf_bWVyY3VyaWFsL2NtZHV0aWwucHk= 100644 --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3066,7 +3066,7 @@ node = ctx.node() def checkout(f): fc = ctx[f] - repo.wwrite(f, fc.data(), fc.flags()) + return repo.wwrite(f, fc.data(), fc.flags()) audit_path = pathutil.pathauditor(repo.root) for f in actions['forget'][0]: @@ -3114,6 +3114,6 @@ del fp else: for f in actions['revert'][0]: - checkout(f) + wsize = checkout(f) if normal: normal(f) @@ -3118,5 +3118,9 @@ if normal: normal(f) + elif wsize == repo.dirstate._map[f][2]: + # changes may be overlooked without normallookup, + # if size isn't changed at reverting + repo.dirstate.normallookup(f) for f in actions['add'][0]: checkout(f) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py index ca1ad8ef38be225caec42564502aafe43cae173d_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..21b33f0460e045495b19312a0dbf05cf89fd21cf_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644 --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -917,6 +917,10 @@ return self._filter(self._encodefilterpats, filename, data) def wwrite(self, filename, data, flags): + """write ``data`` into ``filename`` in the working directory + + This returns length of written (maybe decoded) data. + """ data = self._filter(self._decodefilterpats, filename, data) if 'l' in flags: self.wvfs.symlink(data, filename) @@ -924,6 +928,7 @@ self.wvfs.write(filename, data) if 'x' in flags: self.wvfs.setflags(filename, False, True) + return len(data) def wwritedata(self, filename, data): return self._filter(self._decodefilterpats, filename, data) diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t index ca1ad8ef38be225caec42564502aafe43cae173d_dGVzdHMvdGVzdC1tZXJnZS10b29scy50..21b33f0460e045495b19312a0dbf05cf89fd21cf_dGVzdHMvdGVzdC1tZXJnZS10b29scy50 100644 --- a/tests/test-merge-tools.t +++ b/tests/test-merge-tools.t @@ -608,4 +608,8 @@ true.executable=cat # hg update -C 1 $ hg update -q 0 + $ f -s f + f: size=17 + $ touch -t 200001010000 f + $ hg status f $ hg revert -q -r 1 . @@ -611,4 +615,9 @@ $ hg revert -q -r 1 . + $ f -s f + f: size=17 + $ touch -t 200001010000 f + $ hg status f + M f $ hg update -r 2 merging f revision 1 @@ -634,4 +643,8 @@ true.executable=cat # hg update -C 1 $ hg update -q 0 + $ f -s f + f: size=17 + $ touch -t 200001010000 f + $ hg status f $ hg revert -q -r 1 . @@ -637,4 +650,9 @@ $ hg revert -q -r 1 . + $ f -s f + f: size=17 + $ touch -t 200001010000 f + $ hg status f + M f $ hg update -r 2 --tool false merging f merging f failed!