pull: abort pull --update if config requires destination (issue5528)

This commit is contained in:
Ryan McElroy 2017-04-07 06:31:50 -07:00
parent c043268b6d
commit ce07523994
2 changed files with 18 additions and 0 deletions

View File

@ -3938,6 +3938,12 @@ def pull(ui, repo, source="default", **opts):
Returns 0 on success, 1 if an update had unresolved files.
"""
if ui.configbool('commands', 'update.requiredest') and opts.get('update'):
msg = _('update destination required by configuration')
hint = _('use hg pull followed by hg update DEST')
raise error.Abort(msg, hint=hint)
source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
ui.status(_('pulling from %s\n') % util.hidepassword(source))
other = hg.peer(repo, opts, source)

View File

@ -21,3 +21,15 @@ Test update.requiredest
$ cd ..
Check update.requiredest interaction with pull --update
$ hg clone repo clone
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd repo
$ echo a >> a
$ hg commit -qAm aa
$ cd ../clone
$ hg pull --update
abort: update destination required by configuration
(use hg pull followed by hg update DEST)
[255]