Show More
@@ -105,16 +105,26 b' explicitly do so with the --large flag p' | |||||
105 | command. |
|
105 | command. | |
106 | ''' |
|
106 | ''' | |
107 |
|
107 | |||
108 | from mercurial import commands |
|
108 | from mercurial import commands, localrepo, extensions | |
109 |
|
109 | |||
110 | import lfcommands |
|
110 | import lfcommands | |
111 | import reposetup |
|
111 | import reposetup | |
112 | import uisetup |
|
112 | import uisetup as uisetupmod | |
113 |
|
113 | |||
114 | testedwith = 'internal' |
|
114 | testedwith = 'internal' | |
115 |
|
115 | |||
116 | reposetup = reposetup.reposetup |
|
116 | reposetup = reposetup.reposetup | |
117 | uisetup = uisetup.uisetup |
|
117 | ||
|
118 | def featuresetup(ui, supported): | |||
|
119 | for name, module in extensions.extensions(ui): | |||
|
120 | if __name__ == module.__name__: | |||
|
121 | # don't die on seeing a repo with the largefiles requirement | |||
|
122 | supported |= set(['largefiles']) | |||
|
123 | return | |||
|
124 | ||||
|
125 | def uisetup(ui): | |||
|
126 | localrepo.localrepository.featuresetupfuncs.add(featuresetup) | |||
|
127 | uisetupmod.uisetup(ui) | |||
118 |
|
128 | |||
119 | commands.norepo += " lfconvert" |
|
129 | commands.norepo += " lfconvert" | |
120 |
|
130 |
@@ -407,6 +407,14 b' def reposetup(ui, repo):' | |||||
407 | wlock.release() |
|
407 | wlock.release() | |
408 |
|
408 | |||
409 | def push(self, remote, force=False, revs=None, newbranch=False): |
|
409 | def push(self, remote, force=False, revs=None, newbranch=False): | |
|
410 | if remote.local(): | |||
|
411 | missing = set(self.requirements) - remote.local().supported | |||
|
412 | if missing: | |||
|
413 | msg = _("required features are not" | |||
|
414 | " supported in the destination:" | |||
|
415 | " %s") % (', '.join(sorted(missing))) | |||
|
416 | raise util.Abort(msg) | |||
|
417 | ||||
410 | outgoing = discovery.findcommonoutgoing(repo, remote.peer(), |
|
418 | outgoing = discovery.findcommonoutgoing(repo, remote.peer(), | |
411 | force=force) |
|
419 | force=force) | |
412 | if outgoing.missing: |
|
420 | if outgoing.missing: |
@@ -9,7 +9,7 b'' | |||||
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 |
|
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 | |
@@ -152,9 +152,6 b' def uisetup(ui):' | |||||
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': |
@@ -2191,3 +2191,64 b' check messages when there are files to u' | |||||
2191 |
|
2191 | |||
2192 |
|
2192 | |||
2193 | $ cd .. |
|
2193 | $ cd .. | |
|
2194 | ||||
|
2195 | Check whether "largefiles" feature is supported only in repositories | |||
|
2196 | enabling largefiles extension. | |||
|
2197 | ||||
|
2198 | $ mkdir individualenabling | |||
|
2199 | $ cd individualenabling | |||
|
2200 | ||||
|
2201 | $ hg init enabledlocally | |||
|
2202 | $ echo large > enabledlocally/large | |||
|
2203 | $ hg -R enabledlocally add --large enabledlocally/large | |||
|
2204 | $ hg -R enabledlocally commit -m '#0' | |||
|
2205 | Invoking status precommit hook | |||
|
2206 | A large | |||
|
2207 | ||||
|
2208 | $ hg init notenabledlocally | |||
|
2209 | $ echo large > notenabledlocally/large | |||
|
2210 | $ hg -R notenabledlocally add --large notenabledlocally/large | |||
|
2211 | $ hg -R notenabledlocally commit -m '#0' | |||
|
2212 | Invoking status precommit hook | |||
|
2213 | A large | |||
|
2214 | ||||
|
2215 | $ cat >> $HGRCPATH <<EOF | |||
|
2216 | > [extensions] | |||
|
2217 | > # disable globally | |||
|
2218 | > largefiles=! | |||
|
2219 | > EOF | |||
|
2220 | $ cat >> enabledlocally/.hg/hgrc <<EOF | |||
|
2221 | > [extensions] | |||
|
2222 | > # enable locally | |||
|
2223 | > largefiles= | |||
|
2224 | > EOF | |||
|
2225 | $ hg -R enabledlocally root | |||
|
2226 | $TESTTMP/individualenabling/enabledlocally | |||
|
2227 | $ hg -R notenabledlocally root | |||
|
2228 | abort: unknown repository format: requires features 'largefiles' (upgrade Mercurial)! | |||
|
2229 | [255] | |||
|
2230 | ||||
|
2231 | $ hg init push-dst | |||
|
2232 | $ hg -R enabledlocally push push-dst | |||
|
2233 | pushing to push-dst | |||
|
2234 | abort: required features are not supported in the destination: largefiles | |||
|
2235 | [255] | |||
|
2236 | ||||
|
2237 | $ hg init pull-src | |||
|
2238 | $ hg -R pull-src pull enabledlocally | |||
|
2239 | pulling from enabledlocally | |||
|
2240 | abort: required features are not supported in the destination: largefiles | |||
|
2241 | [255] | |||
|
2242 | ||||
|
2243 | $ hg clone enabledlocally clone-dst | |||
|
2244 | abort: unknown repository format: requires features 'largefiles' (upgrade Mercurial)! | |||
|
2245 | [255] | |||
|
2246 | $ test -d clone-dst | |||
|
2247 | [1] | |||
|
2248 | $ hg clone --pull enabledlocally clone-pull-dst | |||
|
2249 | abort: required features are not supported in the destination: largefiles | |||
|
2250 | [255] | |||
|
2251 | $ test -d clone-pull-dst | |||
|
2252 | [1] | |||
|
2253 | ||||
|
2254 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now