comparison hgext/largefiles/uisetup.py @ 19779:fb6e87d93948

largefiles: setup "largefiles" feature in each repositories individually Before this patch, if largefiles extension is enabled once in any of target repositories, commands handling multiple repositories at a time like below misunderstand that "largefiles" feature is supported also in all other local repositories: - clone/pull from or push to localhost - recursive execution in subrepo tree This patch registers "featuresetup()" into "featuresetupfuncs" of "localrepository" to support "largefiles" features only in repositories enabling largefiles extension, instead of adding "largefiles" feature to class variable "_basesupported" of "localrepository". This patch also adds checking below to the largefiles specific class derived from "localrepository": - push to localhost: whether features supported in the local(= dst) repository satisfies ones required in the remote(= src) This can prevent useless looking up in the remote repository, when supported and required features are mismatched: "push()" of "localrepository" also checks it, but it is executed after looking up in the remote.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 21 Sep 2013 21:33:29 +0900
parents 55ef79031009
children b228ad1f79d7
comparison
equal deleted inserted replaced
19778:55ef79031009 19779:fb6e87d93948
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 '''setup for largefiles extension: uisetup''' 9 '''setup for largefiles extension: uisetup'''
10 10
11 from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \ 11 from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \
12 httppeer, localrepo, merge, scmutil, sshpeer, wireproto, revset 12 httppeer, merge, scmutil, sshpeer, wireproto, revset
13 from mercurial.i18n import _ 13 from mercurial.i18n import _
14 from mercurial.hgweb import hgweb_mod, webcommands 14 from mercurial.hgweb import hgweb_mod, webcommands
15 from mercurial.subrepo import hgsubrepo 15 from mercurial.subrepo import hgsubrepo
16 16
17 import overrides 17 import overrides
150 proto.ssholdcallstream = sshpeer.sshpeer._callstream 150 proto.ssholdcallstream = sshpeer.sshpeer._callstream
151 proto.httpoldcallstream = httppeer.httppeer._callstream 151 proto.httpoldcallstream = httppeer.httppeer._callstream
152 sshpeer.sshpeer._callstream = proto.sshrepocallstream 152 sshpeer.sshpeer._callstream = proto.sshrepocallstream
153 httppeer.httppeer._callstream = proto.httprepocallstream 153 httppeer.httppeer._callstream = proto.httprepocallstream
154 154
155 # don't die on seeing a repo with the largefiles requirement
156 localrepo.localrepository._basesupported |= set(['largefiles'])
157
158 # override some extensions' stuff as well 155 # override some extensions' stuff as well
159 for name, module in extensions.extensions(): 156 for name, module in extensions.extensions():
160 if name == 'fetch': 157 if name == 'fetch':
161 extensions.wrapcommand(getattr(module, 'cmdtable'), 'fetch', 158 extensions.wrapcommand(getattr(module, 'cmdtable'), 'fetch',
162 overrides.overridefetch) 159 overrides.overridefetch)