mercurial/merge.py
changeset 29480 1e4512eac59e
parent 29341 0d83ad967bf8
child 29629 b33c0c38d68f
--- 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