Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGe41449818bee: copy: respect ui.relative-paths in copy/rename
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -51,8 +51,10 @@
)
if pycompat.iswindows:
+ from . import windows as platformfrom . import scmwindows as scmplatformelse:
+ from . import posix as platformfrom . import scmposix as scmplatform
It's util.localpath().
@@ -757,7 +759,7 @@
pathto = repo.pathto return lambda f: pathto(f, cwd) else:
- return lambda f: f
+ return platform.localpath
I've removed this since it seemed unrelated to this specific patch. It might
break some Windows tests, but it should already be broken since a997163e7fae.
Some (or all?) uipathfn()s have to respect ui.slash config on Windows.
That was just something I was experimenting with and must have accidentally amended in. Thanks for fixing!
It might
break some Windows tests, but it should already be broken since a997163e7fae.
Some (or all?) uipathfn()s have to respect ui.slash config on Windows.
Did that commit change any behavior 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.)
> 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?
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.
`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.
But the default of hg status is relative=False, so the status output
would have significant change on Windows.
Ohhh, now I see! hg status changed because it used repo.pathto(f, cwd='') in the non-relative case, and repo.pathto() calls uitil.localpath(). I think most or all of the other commands I've changed with recent patches simply use f the non-relative case. So I have hopefully only broken hg status. But I'll hopefully fix almost all of them to use native paths soon :)