diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -991,6 +991,8 @@ lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) if rpath: + if wd is not None: + rpath = os.path.join(wd, rpath) path = urlutil.get_clone_path(lui, rpath)[0] lui = ui.copy() if rcutil.use_repo_hgrc(): diff --git a/tests/test-chg.t b/tests/test-chg.t --- a/tests/test-chg.t +++ b/tests/test-chg.t @@ -433,6 +433,15 @@ YYYY/MM/DD HH:MM:SS (PID)> log -R cached YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) +-R is interpreted relative to --cwd + + $ hg init repo1 + $ hg init repo2 + $ printf "[alias]\nx=y\n" >> repo1/.hg/hgrc + $ printf "[alias]\nx=z\n" >> repo2/.hg/hgrc + $ (cd repo1; chg --cwd ../repo2 -R . show alias.x) + z + Test that chg works (sets to the user's actual LC_CTYPE) even when python "coerces" the locale (py3.7+) @@ -537,3 +546,4 @@ $ filteredchg log -r . --no-profile $ filteredchg log -r . Sample count: * (glob) + $ cd ../