D5907: copy: respect ui.relative-paths in copy/rename

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Feb 11 00:25:39 EST 2019


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D5907#86625, @yuja wrote:
  
  > >   > It might
  > >   >  break some Windows tests, but it should already be broken since https://phab.mercurial-scm.org/rHGa997163e7fae2fe933f8d0c6d1013205befd1ee4.
  > >   >  Some (or all?) `uipathfn()`s have to respect `ui.slash` config on Windows.
  > >   
  > >   Did that commit change any behavior on Windows?
  >
  > Probably. `pathto(f, cwd='')` would return backslash path on Windows.
  
  
  `getuipathfn()` uses `repo.pathto()` when a relative path was requested (including by setting `legacyrelativevalue=True` or `forcerelativevalue=True`), so I think there shouldn't be much change in behavior with that commit.
  
  > 
  > 
  >> I was trying to figure out where the conversion to Windows paths was done and thought it seemed like it was mostly just done in `util.pathto()`, so e.g. `m.rel()` would use backslashes and `m.abs()` would use slashes. (I just learned that there is a deprecated ui.slash config too, but that doesn't seem to change much.)
  > 
  > Correct. Path handling on Windows seemed inconsistent from the start. Some
  >  commands used to use `dirstate.pathto()` which always returns backslash/slash
  >  paths depending on ui.slash, and the others using `m.rel|abs|uipath()` don't.
  > 
  > Since we have `scmutil.getuipathfn()` now, maybe we can fix the inconsistency?
  
  Yep, I was going to switch from `lambda f: f` to `util.localpath` for repo-relative paths. I was leaving that for when I'm done with the rest in case it affects tests on Windows, so they don't need to be updated several times.
  
  In https://phab.mercurial-scm.org/D5907#86625, @yuja wrote:
  
  > >   > It might
  > >   >  break some Windows tests, but it should already be broken since https://phab.mercurial-scm.org/rHGa997163e7fae2fe933f8d0c6d1013205befd1ee4.
  > >   >  Some (or all?) `uipathfn()`s have to respect `ui.slash` config on Windows.
  > >   
  > >   Did that commit change any behavior on Windows?
  >
  > Probably. `pathto(f, cwd='')` would return backslash path on Windows.
  >
  > > I was trying to figure out where the conversion to Windows paths was done and thought it seemed like it was mostly just done in `util.pathto()`, so e.g. `m.rel()` would use backslashes and `m.abs()` would use slashes. (I just learned that there is a deprecated ui.slash config too, but that doesn't seem to change much.)
  >
  > Correct. Path handling on Windows seemed inconsistent from the start. Some
  >  commands used to use `dirstate.pathto()` which always returns backslash/slash
  >  paths depending on ui.slash, and the others using `m.rel|abs|uipath()` don't.
  >
  > Since we have `scmutil.getuipathfn()` now, maybe we can fix the inconsistency?

REPOSITORY
  rHG Mercurial

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

To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list