Bug 4796 - push succeeds even if you pass a bad url
Summary: push succeeds even if you pass a bad url
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: default branch
Hardware: PC Mac OS
: urgent bug
Assignee: Gregory Szorc
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-25 20:10 UTC by Durham Goode
Modified: 2015-10-18 16:05 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Durham Goode 2015-08-25 20:10:32 UTC
Commit 10917b062adf "commands.push: use paths API" changed the way paths work and now pushing to a bad path succeeds.

~/myrepo> hg-3.5 push doesntexist
pushing to doesntexist
abort: repository doesntexist not found!

~/myrepo> hg-latest push doesntexist
pushing to ssh://myserver.com//data/myrepo
searching for changes
...
Comment 1 Matt Mackall 2015-08-26 13:28:00 UTC
Sure sounds like a regression to me -> urgent
Comment 2 Bugzilla 2015-09-06 00:00:13 UTC
Bug marked urgent for 10 days, bumping
Comment 3 Gregory Szorc 2015-09-06 13:53:27 UTC
I'll send a patch up shortly.
Comment 4 HG Bot 2015-09-09 15:46:00 UTC
Fixed by https://selenic.com/repo/hg/rev/663fbc336e22
Gregory Szorc <gregory.szorc@gmail.com>
ui: change default path fallback mechanism (issue4796)

The previous paths API code always fell back to the default path. This
was wrong because if a requested path doesn't exist, that should error.
Only if no path was requested should we fall back to the default.

As part of implementing the test case for issue 4796, it was discovered
that the "repository does not exist" error message raised by
localrepository.__init__ wasn't being seen because the paths API
validates paths before localrepository.__init__ was being called.
The exception and error message from localrepository.__init__ has
been introduced to getpath(). This necessitated rewriting
expandpath() both to catch the exception and to have proper
default fallback.

This code is more complicated than I'd like. But making all tests pass
was a big chore. As more code moves to getpath(), there will likely be
opportunities to improve things a bit.

(please test the fix)
Comment 5 Bugzilla 2015-10-18 16:05:55 UTC
Bug was set to TESTING for 39 days, resolving