codereview: protect against read-only upstream repository

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6742053
This commit is contained in:
Shenghou Ma 2012-10-20 17:23:48 +08:00
parent 3e3fa7b5f1
commit bcdb7926dd

View file

@ -1951,7 +1951,8 @@ def submit(ui, repo, *pats, **opts):
# Push changes to remote. If it works, we're committed. If not, roll back.
try:
hg_push(ui, repo)
if hg_push(ui, repo):
raise hg_util.Abort("push error")
except hg_error.Abort, e:
if e.message.find("push creates new heads") >= 0:
# Remote repository had changes we missed.