Show More
@@ -100,10 +100,10 b' def loglimit(opts):' | |||||
100 |
|
100 | |||
101 | def remoteui(src, opts): |
|
101 | def remoteui(src, opts): | |
102 | 'build a remote ui from ui or repo and opts' |
|
102 | 'build a remote ui from ui or repo and opts' | |
103 | if hasattr(src, 'ui'): # looks like a repository |
|
103 | if hasattr(src, 'baseui'): # looks like a repository | |
104 |
dst = src. |
|
104 | dst = src.baseui # drop repo-specific config | |
105 | src = src.ui # copy target options from repo |
|
105 | src = src.ui # copy target options from repo | |
106 | else: # assume it's a ui object |
|
106 | else: # assume it's a global ui object | |
107 | dst = src # keep all global options |
|
107 | dst = src # keep all global options | |
108 |
|
108 | |||
109 | # copy ssh-specific options |
|
109 | # copy ssh-specific options |
@@ -2677,7 +2677,7 b' def serve(ui, repo, **opts):' | |||||
2677 | s = sshserver.sshserver(ui, repo) |
|
2677 | s = sshserver.sshserver(ui, repo) | |
2678 | s.serve_forever() |
|
2678 | s.serve_forever() | |
2679 |
|
2679 | |||
2680 |
parentui = |
|
2680 | parentui = repo and repo.baseui or ui | |
2681 | optlist = ("name templates style address port prefix ipv6" |
|
2681 | optlist = ("name templates style address port prefix ipv6" | |
2682 | " accesslog errorlog webdir_conf certificate") |
|
2682 | " accesslog errorlog webdir_conf certificate") | |
2683 | for o in optlist.split(): |
|
2683 | for o in optlist.split(): |
@@ -20,7 +20,7 b' class localrepository(repo.repository):' | |||||
20 | capabilities = set(('lookup', 'changegroupsubset')) |
|
20 | capabilities = set(('lookup', 'changegroupsubset')) | |
21 | supported = ('revlogv1', 'store', 'fncache') |
|
21 | supported = ('revlogv1', 'store', 'fncache') | |
22 |
|
22 | |||
23 |
def __init__(self, |
|
23 | def __init__(self, baseui, path=None, create=0): | |
24 | repo.repository.__init__(self) |
|
24 | repo.repository.__init__(self) | |
25 | self.root = os.path.realpath(path) |
|
25 | self.root = os.path.realpath(path) | |
26 | self.path = os.path.join(self.root, ".hg") |
|
26 | self.path = os.path.join(self.root, ".hg") | |
@@ -34,10 +34,10 b' class localrepository(repo.repository):' | |||||
34 | os.mkdir(path) |
|
34 | os.mkdir(path) | |
35 | os.mkdir(self.path) |
|
35 | os.mkdir(self.path) | |
36 | requirements = ["revlogv1"] |
|
36 | requirements = ["revlogv1"] | |
37 |
if |
|
37 | if baseui.configbool('format', 'usestore', True): | |
38 | os.mkdir(os.path.join(self.path, "store")) |
|
38 | os.mkdir(os.path.join(self.path, "store")) | |
39 | requirements.append("store") |
|
39 | requirements.append("store") | |
40 |
if |
|
40 | if baseui.configbool('format', 'usefncache', True): | |
41 | requirements.append("fncache") |
|
41 | requirements.append("fncache") | |
42 | # create an invalid changelog |
|
42 | # create an invalid changelog | |
43 | self.opener("00changelog.i", "a").write( |
|
43 | self.opener("00changelog.i", "a").write( | |
@@ -70,7 +70,8 b' class localrepository(repo.repository):' | |||||
70 | self.sjoin = self.store.join |
|
70 | self.sjoin = self.store.join | |
71 | self.opener.createmode = self.store.createmode |
|
71 | self.opener.createmode = self.store.createmode | |
72 |
|
72 | |||
73 | self.ui = ui.ui(parentui=parentui) |
|
73 | self.baseui = baseui | |
|
74 | self.ui = baseui.copy() | |||
74 | try: |
|
75 | try: | |
75 | self.ui.readconfig(self.join("hgrc"), self.root) |
|
76 | self.ui.readconfig(self.join("hgrc"), self.root) | |
76 | extensions.loadall(self.ui) |
|
77 | extensions.loadall(self.ui) |
@@ -20,23 +20,22 b' class ui(object):' | |||||
20 | self.overlay = config.config() |
|
20 | self.overlay = config.config() | |
21 | self.cdata = config.config() |
|
21 | self.cdata = config.config() | |
22 | self.ucdata = config.config() |
|
22 | self.ucdata = config.config() | |
23 | self.parentui = None |
|
|||
24 | self.trusted_users = {} |
|
23 | self.trusted_users = {} | |
25 | self.trusted_groups = {} |
|
24 | self.trusted_groups = {} | |
26 |
|
25 | |||
27 | if parentui: |
|
26 | if parentui: | |
28 |
self. |
|
27 | self.cdata = parentui.cdata.copy() | |
29 |
self.cdata = |
|
28 | self.ucdata = parentui.ucdata.copy() | |
30 | self.ucdata = self.parentui.ucdata.copy() |
|
|||
31 | self.overlay = parentui.overlay.copy() |
|
29 | self.overlay = parentui.overlay.copy() | |
32 | self.trusted_users = parentui.trusted_users.copy() |
|
30 | self.trusted_users = parentui.trusted_users.copy() | |
33 | self.trusted_groups = parentui.trusted_groups.copy() |
|
31 | self.trusted_groups = parentui.trusted_groups.copy() | |
34 | self.buffers = parentui.buffers |
|
|||
35 | self.fixconfig() |
|
32 | self.fixconfig() | |
36 | else: |
|
33 | else: | |
37 | # we always trust global config files |
|
34 | # we always trust global config files | |
38 | for f in util.rcpath(): |
|
35 | for f in util.rcpath(): | |
39 | self.readconfig(f, assumetrusted=True) |
|
36 | self.readconfig(f, assumetrusted=True) | |
|
37 | def copy(self): | |||
|
38 | return ui(self) | |||
40 |
|
39 | |||
41 | _isatty = None |
|
40 | _isatty = None | |
42 | def isatty(self): |
|
41 | def isatty(self): |
@@ -9,8 +9,6 b' from mercurial import commands' | |||||
9 |
|
9 | |||
10 | def uisetup(ui): |
|
10 | def uisetup(ui): | |
11 | ui.write("uisetup called\\n") |
|
11 | ui.write("uisetup called\\n") | |
12 | ui.write("ui.parentui is%s None\\n" % (ui.parentui is not None |
|
|||
13 | and "not" or "")) |
|
|||
14 |
|
12 | |||
15 | def reposetup(ui, repo): |
|
13 | def reposetup(ui, repo): | |
16 | ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
14 | ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
@@ -1,10 +1,8 b'' | |||||
1 | uisetup called |
|
1 | uisetup called | |
2 | ui.parentui isnot None |
|
|||
3 | reposetup called for a |
|
2 | reposetup called for a | |
4 | ui == repo.ui |
|
3 | ui == repo.ui | |
5 | Foo |
|
4 | Foo | |
6 | uisetup called |
|
5 | uisetup called | |
7 | ui.parentui is None |
|
|||
8 | reposetup called for a |
|
6 | reposetup called for a | |
9 | ui == repo.ui |
|
7 | ui == repo.ui | |
10 | reposetup called for b |
|
8 | reposetup called for b | |
@@ -12,11 +10,9 b' ui == repo.ui' | |||||
12 | updating working directory |
|
10 | updating working directory | |
13 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
11 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
14 | uisetup called |
|
12 | uisetup called | |
15 | ui.parentui is None |
|
|||
16 | Bar |
|
13 | Bar | |
17 | % module/__init__.py-style |
|
14 | % module/__init__.py-style | |
18 | uisetup called |
|
15 | uisetup called | |
19 | ui.parentui isnot None |
|
|||
20 | reposetup called for a |
|
16 | reposetup called for a | |
21 | ui == repo.ui |
|
17 | ui == repo.ui | |
22 | Foo |
|
18 | Foo |
General Comments 0
You need to be logged in to leave comments.
Login now