infinitepush: disable pushes to svn repo

Summary:
During infinitepush test we noticed that `hg push -r . --to SCRATCHBRANCH`
fails with stack trace in www. This is expected because infinitepush doesn't work
with svn servers. But it's better to print a nice error message instead of stack trace.

Test Plan:
Try to push to scratch bookmark from www without specifying path:
stash@dev1918 ~/www (344c6bf) $ hg push -r . --to hack/durhamstash
abort: infinite push does not work with svn repo
(Did you forget to `hg push default`?)
[Exit: 255]

Got nice error instead of stack trace.

Push to scratch bookmark from www with path specified works fine

Reviewers: rmcelroy, mitrandir, durham

Reviewed By: durham

Subscribers: mjpieters, #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D4103745

Tasks: 12479677

Signature: t1:4103745:1477950448:14b5ae8484f3e65cb88c83b2628f73f3a670b1a0
This commit is contained in:
Stanislau Hlebik 2016-11-01 01:50:34 -07:00
parent 563a57128e
commit cf1214923e
2 changed files with 8 additions and 0 deletions

View File

@ -575,6 +575,9 @@ def _push(orig, ui, repo, dest=None, *args, **opts):
# Copy-paste from `push` command
path = ui.paths.getpath(dest, default=('default-push', 'default'))
destpath = path.pushloc or path.loc
if destpath.startswith('svn+') and scratchpush:
raise error.Abort('infinite push does not work with svn repo',
hint='did you forget to `hg push default`?')
# Remote scratch bookmarks will be deleted because remotenames doesn't
# know about them. Let's save it before push and restore after
remotescratchbookmarks = _readscratchremotebookmarks(ui, repo, destpath)

View File

@ -430,3 +430,8 @@ Use --force because this push creates new head
"node": "0000000000000000000000000000000000000000"
}
]
Push to svn server should fail
$ hg push svn+ssh://svn.vip.facebook.com/svnroot/tfb/trunk/www -r . --to scratch/serversidebook
abort: infinite push does not work with svn repo
(did you forget to `hg push default`?)
[255]