equal
deleted
inserted
replaced
94 # pager =""", |
94 # pager =""", |
95 } |
95 } |
96 |
96 |
97 class ui(object): |
97 class ui(object): |
98 def __init__(self, src=None): |
98 def __init__(self, src=None): |
|
99 """Create a fresh new ui object if no src given |
|
100 |
|
101 Use uimod.ui.load() to create a ui which knows global and user configs. |
|
102 In most cases, you should use ui.copy() to create a copy of an existing |
|
103 ui object. |
|
104 """ |
99 # _buffers: used for temporary capture of output |
105 # _buffers: used for temporary capture of output |
100 self._buffers = [] |
106 self._buffers = [] |
101 # 3-tuple describing how each buffer in the stack behaves. |
107 # 3-tuple describing how each buffer in the stack behaves. |
102 # Values are (capture stderr, capture subprocesses, apply labels). |
108 # Values are (capture stderr, capture subprocesses, apply labels). |
103 self._bufferstates = [] |
109 self._bufferstates = [] |
136 self.ferr = util.stderr |
142 self.ferr = util.stderr |
137 self.fin = util.stdin |
143 self.fin = util.stdin |
138 |
144 |
139 # shared read-only environment |
145 # shared read-only environment |
140 self.environ = os.environ |
146 self.environ = os.environ |
141 # we always trust global config files |
|
142 for f in scmutil.rcpath(): |
|
143 self.readconfig(f, trust=True) |
|
144 |
147 |
145 self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm() |
148 self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm() |
|
149 |
|
150 @classmethod |
|
151 def load(cls): |
|
152 """Create a ui and load global and user configs""" |
|
153 u = cls() |
|
154 # we always trust global config files |
|
155 for f in scmutil.rcpath(): |
|
156 u.readconfig(f, trust=True) |
|
157 return u |
146 |
158 |
147 def copy(self): |
159 def copy(self): |
148 return self.__class__(self) |
160 return self.__class__(self) |
149 |
161 |
150 def resetstate(self): |
162 def resetstate(self): |