Patchwork D1157: context: audit paths before clearing unknown files and dirs

login
register
mail settings
Submitter phabricator
Date Oct. 17, 2017, 3:15 p.m.
Message ID <differential-rev-PHID-DREV-jxf2f5ccdpcnp7lsgslp-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25123/
State Superseded
Headers show

Comments

phabricator - Oct. 17, 2017, 3:15 p.m.
mbthomas created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Fix regression introduced in https://phab.mercurial-scm.org/D785.
  
  In some circumstances, context.clearunknown can be called before the path is
  audited. Audit the path before deleting any conflicting files.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1157

AFFECTED FILES
  mercurial/context.py
  tests/test-audit-path.t

CHANGE DETAILS




To: mbthomas, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 17, 2017, 9:10 p.m.
ryanmce accepted this revision.
ryanmce added a comment.
This revision is now accepted and ready to land.


  queued

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D1157

To: mbthomas, #hg-reviewers, ryanmce
Cc: ryanmce, mercurial-devel

Patch

diff --git a/tests/test-audit-path.t b/tests/test-audit-path.t
--- a/tests/test-audit-path.t
+++ b/tests/test-audit-path.t
@@ -124,8 +124,7 @@ 
   abort: path contains illegal component: ../test (glob)
   [255]
   $ cat ../test/file
-  cat: ../test/file: No such file or directory
-  [1]
+  data
 
 attack /tmp/test
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1940,6 +1940,7 @@ 
         """
         wvfs = self._repo.wvfs
         f = self._path
+        wvfs.audit(f)
         if wvfs.isdir(f) and not wvfs.islink(f):
             wvfs.rmtree(f, forcibly=True)
         for p in reversed(list(util.finddirs(f))):