D7725: match: don't util.normpath() cwd

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Fri Dec 27 00:29:57 UTC 2019


mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The problem here is that `util.normpath()` calls `util.pconvert()`, which
  switches to Unix style separators.  That results in two test failures like this
  since 5685ce2ea3bf <https://phab.mercurial-scm.org/rHG5685ce2ea3bfe2f82ba0119788e2fef853bcf97a>:
  
    - c:/Users/Matt/hg/tests/test-globalopts.t +++ c:/Users/Matt/hg/tests/test-globalopts.t.err @@ -89,7 +89,7 @@ [255] $ hg -R b ann a/a abort: a/a not under root '$TESTTMP/b'
  - (consider using '--cwd b') +  (consider using '--cwd ..\$TESTTMP\b') [255] $ hg log abort: no repository found in '$TESTTMP' (.hg not found)!
  
    ERROR: test-globalopts.t output changed
  
  Martin originally had `os.path.normpath()` (which *would* work here too), but
  changed it during review.  He didn't remember why he thought any form is needed
  here.  Most uses simply pass '' or `repo.getcwd()`, so these should generally be
  in local format anyway.  It seems better if `cwd` and `root` use consistent
  styles here.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -232,7 +232,7 @@
     False
     """
     assert os.path.isabs(root)
-    cwd = util.normpath(os.path.join(root, cwd))
+    cwd = os.path.join(root, util.localpath(cwd))
     normalize = _donormalize
     if icasefs:
         dirstate = ctx.repo().dirstate



To: mharbison72, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list