[PATCH v2] pager: migrate to core
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Nov 24 18:24:47 CST 2015
On 11/24/2015 02:26 PM, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bos at serpentine.com>
> # Date 1448403972 28800
> # Tue Nov 24 14:26:12 2015 -0800
> # Node ID a27d1306d305a0012508441e6262f4c65b9fdf86
> # Parent f668eef04abc3de94f41b527daa0bb7a0cf76f56
> pager: migrate to core
+1 for having the code into core
-1 for changing the default behavior in the same patch.
This requires more discussion. Street rumor also says we have a couple
of bug with the pager config and behavior that we should probably take
care of first.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -74,6 +74,8 @@ globalopts = [
> ('', 'version', None, _('output version information and exit')),
> ('h', 'help', None, _('display help and exit')),
> ('', 'hidden', False, _('consider hidden changesets')),
> + ('', 'pager', 'auto',
> + _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
> ]
We should import this with a "never" default to not alter current core
behavior. Moving the code in is a long awaited event but discussing
behavior change and implementing them should happen separately.
In the same spirit of adding global flag. I think having a global -P
flag to do '--pager yes' easily on any command would make sense (this
should not be done in this patch, just throwing the idea in the air)
> dryrunopts = [('n', 'dry-run', None,
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -33,6 +33,7 @@ from . import (
> fancyopts,
> hg,
> hook,
> + pager,
> ui as uimod,
> util,
> )
> @@ -779,6 +780,7 @@ def _dispatch(req):
> if shellaliasfn:
> return shellaliasfn()
>
> + pager.uisetup(lui)
urg, do you plan to extract the uisetup part to merge it with the actual
code? Monkey patching Core Mercurial from Core Mercurial is something we
probably want to avoid.
> # Configure extensions in phases: uisetup, extsetup, cmdtable, and
> # reposetup. Programs like TortoiseHg will call _dispatch several
> # times so we keep track of configured extensions in _loaded.
> diff --git a/mercurial/extensions.py b/mercurial/extensions.py
> --- a/mercurial/extensions.py
> +++ b/mercurial/extensions.py
> @@ -24,7 +24,8 @@ from . import (
> _extensions = {}
> _aftercallbacks = {}
> _order = []
> -_ignore = ['hbisect', 'bookmarks', 'parentrevspec', 'interhg', 'inotify']
> +_ignore = set(['hbisect', 'bookmarks', 'parentrevspec', 'pager', 'interhg',
> + 'inotify'])
Delaying the behavior change means we still need the extensions to turn
the default configuration to "auto".
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list