Show More
@@ -952,14 +952,22 b' def _getlocal(ui, rpath, wd=None):' | |||||
952 |
|
952 | |||
953 | Takes paths in [cwd]/.hg/hgrc into account." |
|
953 | Takes paths in [cwd]/.hg/hgrc into account." | |
954 | """ |
|
954 | """ | |
|
955 | try: | |||
|
956 | cwd = encoding.getcwd() | |||
|
957 | except OSError as e: | |||
|
958 | raise error.Abort( | |||
|
959 | _(b"error getting current working directory: %s") | |||
|
960 | % encoding.strtolocal(e.strerror) | |||
|
961 | ) | |||
|
962 | ||||
|
963 | # If using an alternate wd, temporarily switch to it so that relative | |||
|
964 | # paths are resolved correctly during config loading. | |||
|
965 | oldcwd = None | |||
955 | if wd is None: |
|
966 | if wd is None: | |
956 | try: |
|
967 | wd = cwd | |
957 | wd = encoding.getcwd() |
|
968 | else: | |
958 | except OSError as e: |
|
969 | oldcwd = cwd | |
959 | raise error.Abort( |
|
970 | os.chdir(wd) | |
960 | _(b"error getting current working directory: %s") |
|
|||
961 | % encoding.strtolocal(e.strerror) |
|
|||
962 | ) |
|
|||
963 |
|
971 | |||
964 | path = cmdutil.findrepo(wd) or b"" |
|
972 | path = cmdutil.findrepo(wd) or b"" | |
965 | if not path: |
|
973 | if not path: | |
@@ -979,6 +987,9 b' def _getlocal(ui, rpath, wd=None):' | |||||
979 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
987 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) | |
980 | lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) |
|
988 | lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) | |
981 |
|
989 | |||
|
990 | if oldcwd: | |||
|
991 | os.chdir(oldcwd) | |||
|
992 | ||||
982 | return path, lui |
|
993 | return path, lui | |
983 |
|
994 | |||
984 |
|
995 |
@@ -432,6 +432,20 b' check server log:' | |||||
432 | YYYY/MM/DD HH:MM:SS (PID)> log -R cached |
|
432 | YYYY/MM/DD HH:MM:SS (PID)> log -R cached | |
433 | YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) |
|
433 | YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s) | |
434 |
|
434 | |||
|
435 | Test that -R is interpreted relative to --cwd. | |||
|
436 | ||||
|
437 | $ hg init repo1 | |||
|
438 | $ mkdir -p a/b | |||
|
439 | $ hg init a/b/repo2 | |||
|
440 | $ printf "[alias]\ntest=repo1\n" >> repo1/.hg/hgrc | |||
|
441 | $ printf "[alias]\ntest=repo2\n" >> a/b/repo2/.hg/hgrc | |||
|
442 | $ cd a | |||
|
443 | $ chg --cwd .. -R repo1 show alias.test | |||
|
444 | repo1 | |||
|
445 | $ chg --cwd . -R b/repo2 show alias.test | |||
|
446 | repo2 | |||
|
447 | $ cd .. | |||
|
448 | ||||
435 | Test that chg works (sets to the user's actual LC_CTYPE) even when python |
|
449 | Test that chg works (sets to the user's actual LC_CTYPE) even when python | |
436 | "coerces" the locale (py3.7+) |
|
450 | "coerces" the locale (py3.7+) | |
437 |
|
451 |
General Comments 0
You need to be logged in to leave comments.
Login now