# HG changeset patch # User Stanislau Hlebik <st...@fb.com> # Date 1485791649 28800 # Mon Jan 30 07:54:09 2017 -0800 # Node ID 227796849698292c76c70e874179de52b7b688d6 # Parent a96117003c763be640a975d8128068d2bd3527c0 selectivepull: support list of default bookmarks
The addition is that we now support list of default bookmarks, instead of a single default bookmark (the previous behavior). diff --git a/remotenames.py b/remotenames.py --- a/remotenames.py +++ b/remotenames.py @@ -81,14 +81,19 @@ return ui.configbool('remotenames', 'selectivepull', False) def _getselectivepulldefaultbookmarks(ui, remotebookmarks): - default_book = ui.config('remotenames', 'selectivepulldefault') - if not default_book: - raise error.Abort(_('no default bookmark specified for selectivepull')) - if default_book in remotebookmarks: - return {default_book: remotebookmarks[default_book]} - else: + default_books = ui.configlist('remotenames', 'selectivepulldefault') + if not default_books: + raise error.Abort(_('no default bookmarks specified for selectivepull')) + + result = {} + for default_book in default_books: + if default_book in remotebookmarks: + result[default_book] = remotebookmarks[default_book] + + if not default_books: raise error.Abort( - _('default bookmark %s is not found on remote') % default_book) + _('default bookmarks %s are not found on remote') % default_books) + return result def _trypullremotebookmark(mayberemotebookmark, repo, ui): ui.warn(_('`%s` not found: assuming it is a remote bookmark ' diff --git a/tests/test-selective-pull.t b/tests/test-selective-pull.t --- a/tests/test-selective-pull.t +++ b/tests/test-selective-pull.t @@ -227,3 +227,14 @@ $ hg pull -q $ hg book --remote default/master 2:0238718db2b1 + +Set two bookmarks in selectivepulldefault, make sure both of them were pulled + $ cat >> .hg/hgrc << EOF + > [remotenames] + > selectivepulldefault=master,thirdbook + > EOF + $ rm .hg/selectivepullenabled + $ hg pull -q + $ hg book --remote + default/master 2:0238718db2b1 + default/thirdbook 0:1449e7934ec1 _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel