[PATCH 07 of 13 V3] scmutil: extract rc.d listing function from rccomponents
Kevin Bullock
kbullock+mercurial at ringworld.org
Thu Mar 23 16:23:50 EDT 2017
> On Mar 22, 2017, at 12:23, Jun Wu <quark at fb.com> wrote:
>
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1490201429 25200
> # Wed Mar 22 09:50:29 2017 -0700
> # Node ID d604e5baed4ac2f5470860bff89728c282d71e3a
> # Parent 44c865487bfd2f081bfb322b1fb1b700d57f7adf
> # Available At https://bitbucket.org/quark-zju/hg-draft
> # hg pull https://bitbucket.org/quark-zju/hg-draft -r d604e5baed4a
> scmutil: extract rc.d listing function from rccomponents
>
> This is suggested by dsop and makes the code cleaner. A side effect is
> "normpath" will be called on paths in $HGRCPATH, which seems to be more
> correct.
>
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -452,4 +452,13 @@ def rcpath():
> _rccomponents = None
>
> +def _expandrcpath(path):
> + '''path could be a file or a directory. return a list of file paths'''
> + p = util.expandpath(path)
> + join = os.path.join
> + if os.path.isdir(p):
> + return [join(p, f) for f, k in osutil.listdir(p) if f.endswith('.rc')]
> + else:
> + return [p]
Nit: this `else:` line is unnecessary -- remove it and unindent the `return [p]`.
Also: it looks to me like you could reuse this in defaultrcpath() as well?
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial-devel
mailing list