Submitter | Matt Harbison |
---|---|
Date | Dec. 26, 2018, 9:33 p.m. |
Message ID | <be536e648c4f96fa625a.1545860015@Envy> |
Download | mbox | patch |
Permalink | /patch/37357/ |
State | Accepted |
Headers | show |
Comments
On Wed, 26 Dec 2018 16:33:35 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@yahoo.com> > # Date 1545599773 18000 > # Sun Dec 23 16:16:13 2018 -0500 > # Node ID be536e648c4f96fa625a6222e9c50d45fee38bb5 > # Parent 04b6bbd552360d479d44e956d1e0c201d19f15ef > largefiles: port configitems to exthelper > from mercurial import ( > + configitems, > + exthelper, > hg, > localrepo, > registrar, > @@ -126,19 +128,19 @@ from . import ( > # leave the attribute unspecified. > testedwith = 'ships-with-hg-core' > > -configtable = {} > -configitem = registrar.configitem(configtable) > +eh = exthelper.exthelper() > > -configitem('largefiles', 'minsize', > - default=configitem.dynamicdefault, > +eh.configitem('largefiles', 'minsize', > + default=configitems.dynamicdefault, Nit: eh.configitem.dynamicdefault ?
On Thu, 27 Dec 2018 06:29:09 -0500, Yuya Nishihara <yuya@tcha.org> wrote: > On Wed, 26 Dec 2018 16:33:35 -0500, Matt Harbison wrote: >> # HG changeset patch >> # User Matt Harbison <matt_harbison@yahoo.com> >> # Date 1545599773 18000 >> # Sun Dec 23 16:16:13 2018 -0500 >> # Node ID be536e648c4f96fa625a6222e9c50d45fee38bb5 >> # Parent 04b6bbd552360d479d44e956d1e0c201d19f15ef >> largefiles: port configitems to exthelper > >> from mercurial import ( >> + configitems, >> + exthelper, >> hg, >> localrepo, >> registrar, >> @@ -126,19 +128,19 @@ from . import ( >> # leave the attribute unspecified. >> testedwith = 'ships-with-hg-core' >> >> -configtable = {} >> -configitem = registrar.configitem(configtable) >> +eh = exthelper.exthelper() >> >> -configitem('largefiles', 'minsize', >> - default=configitem.dynamicdefault, >> +eh.configitem('largefiles', 'minsize', >> + default=configitems.dynamicdefault, > > Nit: eh.configitem.dynamicdefault ? Not sure- I don't know what the difference between configitems and configitem really is. The examples I saw in core used configitems, so I assumed it was just a typo. It works, and we would be able to drop one import though.
On Thu, 27 Dec 2018 16:13:02 -0500, Matt Harbison wrote: > On Thu, 27 Dec 2018 06:29:09 -0500, Yuya Nishihara <yuya@tcha.org> wrote: > > > On Wed, 26 Dec 2018 16:33:35 -0500, Matt Harbison wrote: > >> # HG changeset patch > >> # User Matt Harbison <matt_harbison@yahoo.com> > >> # Date 1545599773 18000 > >> # Sun Dec 23 16:16:13 2018 -0500 > >> # Node ID be536e648c4f96fa625a6222e9c50d45fee38bb5 > >> # Parent 04b6bbd552360d479d44e956d1e0c201d19f15ef > >> largefiles: port configitems to exthelper > > > >> from mercurial import ( > >> + configitems, > >> + exthelper, > >> hg, > >> localrepo, > >> registrar, > >> @@ -126,19 +128,19 @@ from . import ( > >> # leave the attribute unspecified. > >> testedwith = 'ships-with-hg-core' > >> > >> -configtable = {} > >> -configitem = registrar.configitem(configtable) > >> +eh = exthelper.exthelper() > >> > >> -configitem('largefiles', 'minsize', > >> - default=configitem.dynamicdefault, > >> +eh.configitem('largefiles', 'minsize', > >> + default=configitems.dynamicdefault, > > > > Nit: eh.configitem.dynamicdefault ? > > Not sure- I don't know what the difference between configitems and > configitem really is. The examples I saw in core used configitems, so I > assumed it was just a typo. It works, and we would be able to drop one > import though. Yep, that's the point that registrar objects "reexport" some constants.
Patch
diff --git a/hgext/largefiles/__init__.py b/hgext/largefiles/__init__.py --- a/hgext/largefiles/__init__.py +++ b/hgext/largefiles/__init__.py @@ -107,6 +107,8 @@ command. from __future__ import absolute_import from mercurial import ( + configitems, + exthelper, hg, localrepo, registrar, @@ -126,19 +128,19 @@ from . import ( # leave the attribute unspecified. testedwith = 'ships-with-hg-core' -configtable = {} -configitem = registrar.configitem(configtable) +eh = exthelper.exthelper() -configitem('largefiles', 'minsize', - default=configitem.dynamicdefault, +eh.configitem('largefiles', 'minsize', + default=configitems.dynamicdefault, ) -configitem('largefiles', 'patterns', +eh.configitem('largefiles', 'patterns', default=list, ) -configitem('largefiles', 'usercache', +eh.configitem('largefiles', 'usercache', default=None, ) +configtable = eh.configtable reposetup = reposetup.reposetup def featuresetup(ui, supported):