comparison mercurial/merge.py @ 29480:1e4512eac59e

update: teach hg to override untracked dir with a tracked file on update This is a fix to an old problem when Mercurial got confused by an untracked folder with the same name as one of the files in a commit hg was trying to update to. It is pretty safe to remove this folder if it is empty. Backing up an empty folder seems to go against Mercurial's "don't track dirs" philosophy.
author Kostia Balytskyi <ikostia@fb.com>
date Fri, 01 Jul 2016 17:42:55 +0200
parents 0d83ad967bf8
children b33c0c38d68f
comparison
equal deleted inserted replaced
29479:5d16ebe7b14f 29480:1e4512eac59e
1074 1074
1075 if backup: 1075 if backup:
1076 absf = repo.wjoin(f) 1076 absf = repo.wjoin(f)
1077 orig = scmutil.origpath(ui, repo, absf) 1077 orig = scmutil.origpath(ui, repo, absf)
1078 try: 1078 try:
1079 # TODO Mercurial has always aborted if an untracked
1080 # directory is replaced by a tracked file, or generally
1081 # with file/directory merges. This needs to be sorted out.
1082 if repo.wvfs.isfileorlink(f): 1079 if repo.wvfs.isfileorlink(f):
1083 util.rename(absf, orig) 1080 util.rename(absf, orig)
1084 except OSError as e: 1081 except OSError as e:
1085 if e.errno != errno.ENOENT: 1082 if e.errno != errno.ENOENT:
1086 raise 1083 raise
1087 1084
1085 if repo.wvfs.isdir(f):
1086 repo.wvfs.removedirs(f)
1088 wwrite(f, fctx(f).data(), flags, backgroundclose=True) 1087 wwrite(f, fctx(f).data(), flags, backgroundclose=True)
1089 if i == 100: 1088 if i == 100:
1090 yield i, f 1089 yield i, f
1091 i = 0 1090 i = 0
1092 i += 1 1091 i += 1