D444: merge: move some of the logic in batchget() to workingfilectx
phillco (Phil Cohen)
phabricator at mercurial-scm.org
Wed Aug 30 21:12:35 UTC 2017
phillco updated this revision to Diff 1459.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D444?vs=1309&id=1459
REVISION DETAIL
https://phab.mercurial-scm.org/D444
AFFECTED FILES
mercurial/context.py
mercurial/merge.py
CHANGE DETAILS
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1150,9 +1150,7 @@
except OSError as e:
if e.errno != errno.ENOENT:
raise
-
- if repo.wvfs.isdir(f) and not repo.wvfs.islink(f):
- repo.wvfs.removedirs(f)
+ wctx[f].clearunknown()
wctx[f].write(fctx(f).data(), flags, backgroundclose=True)
if i == 100:
yield i, f
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1963,6 +1963,19 @@
self._repo.wwrite(self._path, data, flags,
backgroundclose=backgroundclose)
+ def clearunknown(self):
+ """Removes conflicting items in the working directory (and creates any
+ missing parent directories) so that ``write()`` can be called
+ successfully.
+ """
+ if self._repo.wvfs.isdir(self._path) and not self._repo.wvfs.islink(
+ self._path):
+ self._repo.wvfs.removedirs(self._path)
+
+ dirname = os.path.dirname(self._path)
+ if not self._repo.wvfs.isdir(dirname):
+ self._repo.wvfs.makedirs(dirname)
+
def setflags(self, l, x):
self._repo.wvfs.setflags(self._path, l, x)
To: phillco, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list