Show More
@@ -37,6 +37,7 b' from mercurial import (' | |||
|
37 | 37 | exchange, |
|
38 | 38 | extensions, |
|
39 | 39 | filelog, |
|
40 | hg, | |
|
40 | 41 | localrepo, |
|
41 | 42 | registrar, |
|
42 | 43 | revlog, |
@@ -151,6 +152,8 b' def extsetup(ui):' | |||
|
151 | 152 | ), |
|
152 | 153 | ) |
|
153 | 154 | |
|
155 | wrapfunction(hg, 'clone', wrapper.hgclone) | |
|
156 | ||
|
154 | 157 | # Make bundle choose changegroup3 instead of changegroup2. This affects |
|
155 | 158 | # "hg bundle" command. Note: it does not cover all bundle formats like |
|
156 | 159 | # "packed1". Using "packed1" with lfs will likely cause trouble. |
@@ -202,6 +202,25 b' def vfsinit(orig, self, othervfs):' | |||
|
202 | 202 | if util.safehasattr(othervfs, name): |
|
203 | 203 | setattr(self, name, getattr(othervfs, name)) |
|
204 | 204 | |
|
205 | def hgclone(orig, ui, opts, *args, **kwargs): | |
|
206 | result = orig(ui, opts, *args, **kwargs) | |
|
207 | ||
|
208 | if result is not None: | |
|
209 | sourcerepo, destrepo = result | |
|
210 | repo = destrepo.local() | |
|
211 | ||
|
212 | # When cloning to a remote repo (like through SSH), no repo is available | |
|
213 | # from the peer. Therefore the hgrc can't be updated. | |
|
214 | if not repo: | |
|
215 | return result | |
|
216 | ||
|
217 | # If lfs is required for this repo, permanently enable it locally | |
|
218 | if 'lfs' in repo.requirements: | |
|
219 | with repo.vfs('hgrc', 'a', text=True) as fp: | |
|
220 | fp.write('\n[extensions]\nlfs=\n') | |
|
221 | ||
|
222 | return result | |
|
223 | ||
|
205 | 224 | def _canskipupload(repo): |
|
206 | 225 | # if remotestore is a null store, upload is a no-op and can be skipped |
|
207 | 226 | return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote) |
@@ -199,6 +199,8 b'' | |||
|
199 | 199 | updating to branch default |
|
200 | 200 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
201 | 201 | $ cd repo7 |
|
202 | $ hg config extensions --debug | grep lfs | |
|
203 | $TESTTMP/repo7/.hg/hgrc:*: extensions.lfs= (glob) | |
|
202 | 204 | $ cat large |
|
203 | 205 | LARGE-BECAUSE-IT-IS-MORE-THAN-30-BYTES |
|
204 | 206 | $ cat small |
General Comments 0
You need to be logged in to leave comments.
Login now