Mercurial > hg
comparison hgext/largefiles/__init__.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 72d4a1761fbc |
children | 687b865b95ad |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
133 eh = exthelper.exthelper() | 133 eh = exthelper.exthelper() |
134 eh.merge(lfcommands.eh) | 134 eh.merge(lfcommands.eh) |
135 eh.merge(overrides.eh) | 135 eh.merge(overrides.eh) |
136 eh.merge(proto.eh) | 136 eh.merge(proto.eh) |
137 | 137 |
138 eh.configitem('largefiles', 'minsize', | 138 eh.configitem( |
139 default=eh.configitem.dynamicdefault, | 139 'largefiles', 'minsize', default=eh.configitem.dynamicdefault, |
140 ) | 140 ) |
141 eh.configitem('largefiles', 'patterns', | 141 eh.configitem( |
142 default=list, | 142 'largefiles', 'patterns', default=list, |
143 ) | 143 ) |
144 eh.configitem('largefiles', 'usercache', | 144 eh.configitem( |
145 default=None, | 145 'largefiles', 'usercache', default=None, |
146 ) | 146 ) |
147 | 147 |
148 cmdtable = eh.cmdtable | 148 cmdtable = eh.cmdtable |
149 configtable = eh.configtable | 149 configtable = eh.configtable |
150 extsetup = eh.finalextsetup | 150 extsetup = eh.finalextsetup |
151 reposetup = reposetup.reposetup | 151 reposetup = reposetup.reposetup |
152 uisetup = eh.finaluisetup | 152 uisetup = eh.finaluisetup |
153 | 153 |
154 | |
154 def featuresetup(ui, supported): | 155 def featuresetup(ui, supported): |
155 # don't die on seeing a repo with the largefiles requirement | 156 # don't die on seeing a repo with the largefiles requirement |
156 supported |= {'largefiles'} | 157 supported |= {'largefiles'} |
158 | |
157 | 159 |
158 @eh.uisetup | 160 @eh.uisetup |
159 def _uisetup(ui): | 161 def _uisetup(ui): |
160 localrepo.featuresetupfuncs.add(featuresetup) | 162 localrepo.featuresetupfuncs.add(featuresetup) |
161 hg.wirepeersetupfuncs.append(proto.wirereposetup) | 163 hg.wirepeersetupfuncs.append(proto.wirereposetup) |
163 cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook) | 165 cmdutil.outgoinghooks.add('largefiles', overrides.outgoinghook) |
164 cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook) | 166 cmdutil.summaryremotehooks.add('largefiles', overrides.summaryremotehook) |
165 | 167 |
166 # create the new wireproto commands ... | 168 # create the new wireproto commands ... |
167 wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')( | 169 wireprotov1server.wireprotocommand('putlfile', 'sha', permission='push')( |
168 proto.putlfile) | 170 proto.putlfile |
171 ) | |
169 wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')( | 172 wireprotov1server.wireprotocommand('getlfile', 'sha', permission='pull')( |
170 proto.getlfile) | 173 proto.getlfile |
174 ) | |
171 wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')( | 175 wireprotov1server.wireprotocommand('statlfile', 'sha', permission='pull')( |
172 proto.statlfile) | 176 proto.statlfile |
177 ) | |
173 wireprotov1server.wireprotocommand('lheads', '', permission='pull')( | 178 wireprotov1server.wireprotocommand('lheads', '', permission='pull')( |
174 wireprotov1server.heads) | 179 wireprotov1server.heads |
175 | 180 ) |
176 extensions.wrapfunction(wireprotov1server.commands['heads'], 'func', | 181 |
177 proto.heads) | 182 extensions.wrapfunction( |
183 wireprotov1server.commands['heads'], 'func', proto.heads | |
184 ) | |
178 # TODO also wrap wireproto.commandsv2 once heads is implemented there. | 185 # TODO also wrap wireproto.commandsv2 once heads is implemented there. |
179 | 186 |
180 # can't do this in reposetup because it needs to have happened before | 187 # can't do this in reposetup because it needs to have happened before |
181 # wirerepo.__init__ is called | 188 # wirerepo.__init__ is called |
182 proto.ssholdcallstream = sshpeer.sshv1peer._callstream | 189 proto.ssholdcallstream = sshpeer.sshv1peer._callstream |
186 | 193 |
187 # override some extensions' stuff as well | 194 # override some extensions' stuff as well |
188 for name, module in extensions.extensions(): | 195 for name, module in extensions.extensions(): |
189 if name == 'rebase': | 196 if name == 'rebase': |
190 # TODO: teach exthelper to handle this | 197 # TODO: teach exthelper to handle this |
191 extensions.wrapfunction(module, 'rebase', | 198 extensions.wrapfunction(module, 'rebase', overrides.overriderebase) |
192 overrides.overriderebase) | 199 |
193 | 200 |
194 revsetpredicate = eh.revsetpredicate | 201 revsetpredicate = eh.revsetpredicate |