[PATCH 6 of 6 remotenames-ext] selectivepull: support list of default bookmarks
Gregory Szorc
gregory.szorc at gmail.com
Sat Feb 11 13:54:43 EST 2017
> On Jan 30, 2017, at 07:56, Stanislau Hlebik <stash at fb.com> wrote:
>
> # HG changeset patch
> # User Stanislau Hlebik <stash at 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).
Cool series!
[paths] entries have sub-options to control push behavior, including which rev is pushed by default (https://www.mercurial-scm.org/repo/hg/file/a95fc01aaffe/mercurial/help/config.txt#l1348).
So if we wanted to implement selective pull in core, the mechanism to support defining the config is there...
>
> 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 at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170211/72787f38/attachment.html>
More information about the Mercurial-devel
mailing list