Mercurial > hg
comparison hgext/narrow/narrowrepo.py @ 36159:0fe7e39dc683
hg: move share._getsrcrepo into core
The fact we were calling this from extensions was a sign that it
should live in core.
We were also able to remove some extra attribute aliases from the
share extension.
Differential Revision: https://phab.mercurial-scm.org/D2200
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 12 Feb 2018 16:15:34 -0800 |
parents | 0c104ee51918 |
children | 9fd8c2a3db5a |
comparison
equal
deleted
inserted
replaced
36158:802742769680 | 36159:0fe7e39dc683 |
---|---|
7 | 7 |
8 from __future__ import absolute_import | 8 from __future__ import absolute_import |
9 | 9 |
10 from mercurial import ( | 10 from mercurial import ( |
11 bundlerepo, | 11 bundlerepo, |
12 hg, | |
12 localrepo, | 13 localrepo, |
13 match as matchmod, | 14 match as matchmod, |
14 scmutil, | 15 scmutil, |
15 ) | |
16 | |
17 from .. import ( | |
18 share, | |
19 ) | 16 ) |
20 | 17 |
21 from . import ( | 18 from . import ( |
22 narrowrevlog, | 19 narrowrevlog, |
23 narrowspec, | 20 narrowspec, |
35 fp.write(narrowspec.FILENAME + '\n') | 32 fp.write(narrowspec.FILENAME + '\n') |
36 | 33 |
37 def unsharenarrowspec(orig, ui, repo, repopath): | 34 def unsharenarrowspec(orig, ui, repo, repopath): |
38 if (REQUIREMENT in repo.requirements | 35 if (REQUIREMENT in repo.requirements |
39 and repo.path == repopath and repo.shared()): | 36 and repo.path == repopath and repo.shared()): |
40 srcrepo = share._getsrcrepo(repo) | 37 srcrepo = hg.sharedreposource(repo) |
41 with srcrepo.vfs(narrowspec.FILENAME) as f: | 38 with srcrepo.vfs(narrowspec.FILENAME) as f: |
42 spec = f.read() | 39 spec = f.read() |
43 with repo.vfs(narrowspec.FILENAME, 'w') as f: | 40 with repo.vfs(narrowspec.FILENAME, 'w') as f: |
44 f.write(spec) | 41 f.write(spec) |
45 return orig(ui, repo, repopath) | 42 return orig(ui, repo, repopath) |