Patchwork [2,of,6] merge: replace repo.wvfs.unlinkpath() with calls to wctx[f].remove()

login
register
mail settings
Submitter Phillip Cohen
Date June 26, 2017, 5:36 a.m.
Message ID <27b3d6c945ab47745d89.1498455362@phillco-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/21720/
State Accepted
Headers show

Comments

Phillip Cohen - June 26, 2017, 5:36 a.m.
# HG changeset patch
# User Phil Cohen <phillco@fb.com>
# Date 1498435106 25200
#      Sun Jun 25 16:58:26 2017 -0700
# Node ID 27b3d6c945ab47745d89b21e5b4f1bc66f53c4a1
# Parent  4153ee913fcbcc4465c09a7b39d0520252b3e0a7
merge: replace repo.wvfs.unlinkpath() with calls to wctx[f].remove()

The code inside workingfilectx.remove() is a straight call to
repo.wvfs.unlinkpath, so this should be a no-op.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -495,7 +495,7 @@ 
                 self._repo.wwrite(dfile, f.read(), flags)
                 f.close()
             else:
-                self._repo.wvfs.unlinkpath(dfile, ignoremissing=True)
+                wctx[dfile].remove(ignoremissing=True)
             complete, r, deleted = filemerge.premerge(self._repo, self._local,
                                                       lfile, fcd, fco, fca,
                                                       labels=self._labels)
@@ -1084,7 +1084,6 @@ 
     yields tuples for progress updates
     """
     verbose = repo.ui.verbose
-    unlinkpath = repo.wvfs.unlinkpath
     audit = repo.wvfs.audit
     try:
         cwd = pycompat.getcwd()
@@ -1099,7 +1098,7 @@ 
             repo.ui.note(_("removing %s\n") % f)
         audit(f)
         try:
-            unlinkpath(f, ignoremissing=True)
+            wctx[f].remove(ignoremissing=True)
         except OSError as inst:
             repo.ui.warn(_("update failed to remove %s: %s!\n") %
                          (f, inst.strerror))
@@ -1213,7 +1212,7 @@ 
         if os.path.lexists(repo.wjoin(f)):
             repo.ui.debug("removing %s\n" % f)
             audit(f)
-            repo.wvfs.unlinkpath(f)
+            wctx[f].remove()
 
     numupdates = sum(len(l) for m, l in actions.items() if m != 'k')
 
@@ -1272,7 +1271,7 @@ 
         repo.ui.note(_("moving %s to %s\n") % (f0, f))
         audit(f)
         repo.wwrite(f, wctx.filectx(f0).data(), flags)
-        repo.wvfs.unlinkpath(f0)
+        wctx[f0].remove()
         updated += 1
 
     # local directory rename, get