Re: [PATCH 02 of 10 V5] rcutil: split osrcpath to return default.d paths (API)
Excerpts from Yuya Nishihara's message of 2017-03-28 21:53:01 +0900: > On Sun, 26 Mar 2017 23:02:01 -0700, Jun Wu wrote: > > # HG changeset patch > > # User Jun Wu > > # Date 1490584892 25200 > > # Sun Mar 26 20:21:32 2017 -0700 > > # Node ID cd0c8320d216165bd8a62acc711e174ddef7a9f9 > > # Parent dcef7872ff35187d679a79dc6ad62cb9029923b1 > > # Available At https://bitbucket.org/quark-zju/hg-draft > > # hg pull https://bitbucket.org/quark-zju/hg-draft -r > > cd0c8320d216 > > rcutil: split osrcpath to return default.d paths (API) > > > @@ -61,4 +58,5 @@ def rcpath(): > > _rcpath.append(p) > > else: > > -_rcpath = osrcpath() > > +paths = defaultrcpath() + systemrcpath() + userrcpath() > > +_rcpath = map(os.path.normpath, paths) > > I've replaced map with pycompat.maplist for py3 compatibility, but anyway > it's removed by a subsequent patch. ;) Thanks! I was aware of pycompat.maplist but forgot to check deleted code. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 02 of 10 V5] rcutil: split osrcpath to return default.d paths (API)
On Sun, 26 Mar 2017 23:02:01 -0700, Jun Wu wrote: > # HG changeset patch > # User Jun Wu > # Date 1490584892 25200 > # Sun Mar 26 20:21:32 2017 -0700 > # Node ID cd0c8320d216165bd8a62acc711e174ddef7a9f9 > # Parent dcef7872ff35187d679a79dc6ad62cb9029923b1 > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r > cd0c8320d216 > rcutil: split osrcpath to return default.d paths (API) > @@ -61,4 +58,5 @@ def rcpath(): > _rcpath.append(p) > else: > -_rcpath = osrcpath() > +paths = defaultrcpath() + systemrcpath() + userrcpath() > +_rcpath = map(os.path.normpath, paths) I've replaced map with pycompat.maplist for py3 compatibility, but anyway it's removed by a subsequent patch. ;) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 02 of 10 V5] rcutil: split osrcpath to return default.d paths (API)
# HG changeset patch # User Jun Wu # Date 1490584892 25200 # Sun Mar 26 20:21:32 2017 -0700 # Node ID cd0c8320d216165bd8a62acc711e174ddef7a9f9 # Parent dcef7872ff35187d679a79dc6ad62cb9029923b1 # Available At https://bitbucket.org/quark-zju/hg-draft # hg pull https://bitbucket.org/quark-zju/hg-draft -r cd0c8320d216 rcutil: split osrcpath to return default.d paths (API) After this change, there are 3 rcpath functions: - defaultrcpath - systemrcpath - userrcpath This will allow us to insert another config layer in the middle. diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py --- a/mercurial/rcutil.py +++ b/mercurial/rcutil.py @@ -25,6 +25,6 @@ systemrcpath = scmplatform.systemrcpath userrcpath = scmplatform.userrcpath -def osrcpath(): -'''return default os-specific hgrc search path''' +def defaultrcpath(): +'''return rc paths in default.d''' path = [] defaultpath = os.path.join(util.datapath, 'default.d') @@ -33,7 +33,4 @@ def osrcpath(): if f.endswith('.rc'): path.append(os.path.join(defaultpath, f)) -path.extend(systemrcpath()) -path.extend(userrcpath()) -path = [os.path.normpath(f) for f in path] return path @@ -61,4 +58,5 @@ def rcpath(): _rcpath.append(p) else: -_rcpath = osrcpath() +paths = defaultrcpath() + systemrcpath() + userrcpath() +_rcpath = map(os.path.normpath, paths) return _rcpath ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel