##// END OF EJS Templates
revert: apply normallookup on reverted file if size isn't changed (issue4583)...
FUJIWARA Katsunori -
r24843:21b33f04 stable
parent child Browse files
Show More
@@ -3066,7 +3066,7 b' def _performrevert(repo, parents, ctx, a'
3066 node = ctx.node()
3066 node = ctx.node()
3067 def checkout(f):
3067 def checkout(f):
3068 fc = ctx[f]
3068 fc = ctx[f]
3069 repo.wwrite(f, fc.data(), fc.flags())
3069 return repo.wwrite(f, fc.data(), fc.flags())
3070
3070
3071 audit_path = pathutil.pathauditor(repo.root)
3071 audit_path = pathutil.pathauditor(repo.root)
3072 for f in actions['forget'][0]:
3072 for f in actions['forget'][0]:
@@ -3114,9 +3114,13 b' def _performrevert(repo, parents, ctx, a'
3114 del fp
3114 del fp
3115 else:
3115 else:
3116 for f in actions['revert'][0]:
3116 for f in actions['revert'][0]:
3117 checkout(f)
3117 wsize = checkout(f)
3118 if normal:
3118 if normal:
3119 normal(f)
3119 normal(f)
3120 elif wsize == repo.dirstate._map[f][2]:
3121 # changes may be overlooked without normallookup,
3122 # if size isn't changed at reverting
3123 repo.dirstate.normallookup(f)
3120
3124
3121 for f in actions['add'][0]:
3125 for f in actions['add'][0]:
3122 checkout(f)
3126 checkout(f)
@@ -917,6 +917,10 b' class localrepository(object):'
917 return self._filter(self._encodefilterpats, filename, data)
917 return self._filter(self._encodefilterpats, filename, data)
918
918
919 def wwrite(self, filename, data, flags):
919 def wwrite(self, filename, data, flags):
920 """write ``data`` into ``filename`` in the working directory
921
922 This returns length of written (maybe decoded) data.
923 """
920 data = self._filter(self._decodefilterpats, filename, data)
924 data = self._filter(self._decodefilterpats, filename, data)
921 if 'l' in flags:
925 if 'l' in flags:
922 self.wvfs.symlink(data, filename)
926 self.wvfs.symlink(data, filename)
@@ -924,6 +928,7 b' class localrepository(object):'
924 self.wvfs.write(filename, data)
928 self.wvfs.write(filename, data)
925 if 'x' in flags:
929 if 'x' in flags:
926 self.wvfs.setflags(filename, False, True)
930 self.wvfs.setflags(filename, False, True)
931 return len(data)
927
932
928 def wwritedata(self, filename, data):
933 def wwritedata(self, filename, data):
929 return self._filter(self._decodefilterpats, filename, data)
934 return self._filter(self._decodefilterpats, filename, data)
@@ -608,7 +608,16 b' update is a merge ...'
608 true.executable=cat
608 true.executable=cat
609 # hg update -C 1
609 # hg update -C 1
610 $ hg update -q 0
610 $ hg update -q 0
611 $ f -s f
612 f: size=17
613 $ touch -t 200001010000 f
614 $ hg status f
611 $ hg revert -q -r 1 .
615 $ hg revert -q -r 1 .
616 $ f -s f
617 f: size=17
618 $ touch -t 200001010000 f
619 $ hg status f
620 M f
612 $ hg update -r 2
621 $ hg update -r 2
613 merging f
622 merging f
614 revision 1
623 revision 1
@@ -634,7 +643,16 b' update should also have --tool'
634 true.executable=cat
643 true.executable=cat
635 # hg update -C 1
644 # hg update -C 1
636 $ hg update -q 0
645 $ hg update -q 0
646 $ f -s f
647 f: size=17
648 $ touch -t 200001010000 f
649 $ hg status f
637 $ hg revert -q -r 1 .
650 $ hg revert -q -r 1 .
651 $ f -s f
652 f: size=17
653 $ touch -t 200001010000 f
654 $ hg status f
655 M f
638 $ hg update -r 2 --tool false
656 $ hg update -r 2 --tool false
639 merging f
657 merging f
640 merging f failed!
658 merging f failed!
General Comments 0
You need to be logged in to leave comments. Login now