Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Jul 01 14:09:53 2016 +0200 +++ b/mercurial/merge.py Fri Jul 01 17:42:55 2016 +0200 @@ -1076,15 +1076,14 @@ absf = repo.wjoin(f) orig = scmutil.origpath(ui, repo, absf) try: - # TODO Mercurial has always aborted if an untracked - # directory is replaced by a tracked file, or generally - # with file/directory merges. This needs to be sorted out. if repo.wvfs.isfileorlink(f): util.rename(absf, orig) except OSError as e: if e.errno != errno.ENOENT: raise + if repo.wvfs.isdir(f): + repo.wvfs.removedirs(f) wwrite(f, fctx(f).data(), flags, backgroundclose=True) if i == 100: yield i, f