Mercurial > hg-stable
changeset 26142:7332bf4ae959
dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Before this patch, repo could be set to None for wrong -R. It's okay for
commands that can reject repo=None, but the command server have a problem
because:
- it accepts repo=None for "unbound" mode
- and it reenters dispatch() where repo object is created for cwd by default
Test outputs are changed because the error is detected earlier. I think new
message is better than ".hg not found".
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 31 Aug 2015 23:29:15 +0900 |
parents | fa6ba7c9600b |
children | 42bb1812686f |
files | mercurial/dispatch.py tests/test-clone.t tests/test-commandserver.t tests/test-ssh-bundle1.t tests/test-ssh.t |
diffstat | 5 files changed, 18 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Tue Sep 01 16:38:52 2015 +0900 +++ b/mercurial/dispatch.py Mon Aug 31 23:29:15 2015 +0900 @@ -890,6 +890,8 @@ except error.RequirementError: raise except error.RepoError: + if rpath and rpath[-1]: # invalid -R path + raise if cmd not in commands.optionalrepo.split(): if (cmd in commands.inferrepo.split() and args and not path): # try to infer -R from command args
--- a/tests/test-clone.t Tue Sep 01 16:38:52 2015 +0900 +++ b/tests/test-clone.t Mon Aug 31 23:29:15 2015 +0900 @@ -1020,7 +1020,7 @@ $ hg -R a id -r 0 acb14030fe0a $ hg id -R remote -r 0 - abort: there is no Mercurial repository here (.hg not found) + abort: repository remote not found! [255] $ hg --config share.pool=share -q clone -e "python \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote $ hg -R remote id -r 0
--- a/tests/test-commandserver.t Tue Sep 01 16:38:52 2015 +0900 +++ b/tests/test-commandserver.t Mon Aug 31 23:29:15 2015 +0900 @@ -589,6 +589,15 @@ 000000000000 tip +don't fall back to cwd if invalid -R path is specified (issue4805): + + $ cd repo + $ hg serve --cmdserver pipe -R ../nonexistent + abort: repository ../nonexistent not found! + [255] + $ cd .. + + unix domain socket: $ cd repo
--- a/tests/test-ssh-bundle1.t Tue Sep 01 16:38:52 2015 +0900 +++ b/tests/test-ssh-bundle1.t Mon Aug 31 23:29:15 2015 +0900 @@ -43,14 +43,14 @@ repo not found error $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local - remote: abort: there is no Mercurial repository here (.hg not found)! + remote: abort: repository nonexistent not found! abort: no suitable response from remote hg! [255] non-existent absolute path $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy//`pwd`/nonexistent local - remote: abort: there is no Mercurial repository here (.hg not found)! + remote: abort: repository /$TESTTMP/nonexistent not found! abort: no suitable response from remote hg! [255] @@ -128,7 +128,7 @@ $ hg pull -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist pulling from ssh://user@dummy/doesnotexist - remote: abort: there is no Mercurial repository here (.hg not found)! + remote: abort: repository doesnotexist not found! abort: no suitable response from remote hg! [255]
--- a/tests/test-ssh.t Tue Sep 01 16:38:52 2015 +0900 +++ b/tests/test-ssh.t Mon Aug 31 23:29:15 2015 +0900 @@ -34,14 +34,14 @@ repo not found error $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local - remote: abort: there is no Mercurial repository here (.hg not found)! + remote: abort: repository nonexistent not found! abort: no suitable response from remote hg! [255] non-existent absolute path $ hg clone -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local - remote: abort: there is no Mercurial repository here (.hg not found)! + remote: abort: repository $TESTTMP/nonexistent not found! abort: no suitable response from remote hg! [255] @@ -119,7 +119,7 @@ $ hg pull -e "python \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist pulling from ssh://user@dummy/doesnotexist - remote: abort: there is no Mercurial repository here (.hg not found)! + remote: abort: repository doesnotexist not found! abort: no suitable response from remote hg! [255]