Submitter | Yuya Nishihara |
---|---|
Date | Sept. 2, 2015, 2:53 p.m. |
Message ID | <d24f5a98f8f67421ebce.1441205587@mimosa> |
Download | mbox | patch |
Permalink | /patch/10367/ |
State | Accepted |
Headers | show |
Comments
On Wed, Sep 02, 2015 at 11:53:07PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1441031355 -32400 > # Mon Aug 31 23:29:15 2015 +0900 > # Node ID d24f5a98f8f67421ebce8c41e3afb54d73a033e6 > # Parent 5163ebffa5fbc6283893c3287d2d15e92caca540 > dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC) Queued these. Love how the error messages are actually kinda helpful now. > > 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". > > diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py > --- a/mercurial/dispatch.py > +++ b/mercurial/dispatch.py > @@ -890,6 +890,8 @@ def _dispatch(req): > 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 > diff --git a/tests/test-clone.t b/tests/test-clone.t > --- a/tests/test-clone.t > +++ b/tests/test-clone.t > @@ -1020,7 +1020,7 @@ Test that auto sharing doesn't cause fai > $ 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 > diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t > --- a/tests/test-commandserver.t > +++ b/tests/test-commandserver.t > @@ -589,6 +589,15 @@ start without repository: > 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 > diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t > --- a/tests/test-ssh-bundle1.t > +++ b/tests/test-ssh-bundle1.t > @@ -43,14 +43,14 @@ configure for serving > 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 @@ pull from wrong ssh URL > > $ 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] > > diff --git a/tests/test-ssh.t b/tests/test-ssh.t > --- a/tests/test-ssh.t > +++ b/tests/test-ssh.t > @@ -34,14 +34,14 @@ configure for serving > 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 @@ pull from wrong ssh URL > > $ 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] > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > https://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -890,6 +890,8 @@ def _dispatch(req): 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 diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -1020,7 +1020,7 @@ Test that auto sharing doesn't cause fai $ 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 diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -589,6 +589,15 @@ start without repository: 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 diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -43,14 +43,14 @@ configure for serving 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 @@ pull from wrong ssh URL $ 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] diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -34,14 +34,14 @@ configure for serving 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 @@ pull from wrong ssh URL $ 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]