comparison mercurial/merge.py @ 29629:b33c0c38d68f stable

update: fix bug when update tries to modify folder symlink In 1e4512eac59e0114bc60ecbcdc4157fc0fa0439d, I introduced a new bug: when a symlink points to a folder in commit A and to another folder in commit B, while updating from A to B, Mercurial will try to use removedir on this symlink, which will fail. This is a very bad bug, since it basically renders symlinks to folders unusable in repos. Added test case fails without a fix and passes with it.
author Kostia Balytskyi <ikostia@fb.com>
date Thu, 21 Jul 2016 15:55:47 -0700
parents 1e4512eac59e
children a7f8939641aa
comparison
equal deleted inserted replaced
29628:6217180f9ab8 29629:b33c0c38d68f
1080 util.rename(absf, orig) 1080 util.rename(absf, orig)
1081 except OSError as e: 1081 except OSError as e:
1082 if e.errno != errno.ENOENT: 1082 if e.errno != errno.ENOENT:
1083 raise 1083 raise
1084 1084
1085 if repo.wvfs.isdir(f): 1085 if repo.wvfs.isdir(f) and not repo.wvfs.islink(f):
1086 repo.wvfs.removedirs(f) 1086 repo.wvfs.removedirs(f)
1087 wwrite(f, fctx(f).data(), flags, backgroundclose=True) 1087 wwrite(f, fctx(f).data(), flags, backgroundclose=True)
1088 if i == 100: 1088 if i == 100:
1089 yield i, f 1089 yield i, f
1090 i = 0 1090 i = 0