Show More
@@ -101,16 +101,15 b' class dirstate:' | |||||
101 | try: |
|
101 | try: | |
102 | return self.map[key] |
|
102 | return self.map[key] | |
103 | except TypeError: |
|
103 | except TypeError: | |
104 | self.read() |
|
104 | self.lazyread() | |
105 | return self[key] |
|
105 | return self[key] | |
106 |
|
106 | |||
107 | def __contains__(self, key): |
|
107 | def __contains__(self, key): | |
108 |
|
|
108 | self.lazyread() | |
109 | return key in self.map |
|
109 | return key in self.map | |
110 |
|
110 | |||
111 | def parents(self): |
|
111 | def parents(self): | |
112 |
|
|
112 | self.lazyread() | |
113 | self.read() |
|
|||
114 | return self.pl |
|
113 | return self.pl | |
115 |
|
114 | |||
116 | def markdirty(self): |
|
115 | def markdirty(self): | |
@@ -118,8 +117,7 b' class dirstate:' | |||||
118 | self.dirty = 1 |
|
117 | self.dirty = 1 | |
119 |
|
118 | |||
120 | def setparents(self, p1, p2=nullid): |
|
119 | def setparents(self, p1, p2=nullid): | |
121 |
|
|
120 | self.lazyread() | |
122 | self.read() |
|
|||
123 | self.markdirty() |
|
121 | self.markdirty() | |
124 | self.pl = p1, p2 |
|
122 | self.pl = p1, p2 | |
125 |
|
123 | |||
@@ -129,9 +127,11 b' class dirstate:' | |||||
129 | except KeyError: |
|
127 | except KeyError: | |
130 | return "?" |
|
128 | return "?" | |
131 |
|
129 | |||
|
130 | def lazyread(self): | |||
|
131 | if self.map is None: | |||
|
132 | self.read() | |||
|
133 | ||||
132 | def read(self): |
|
134 | def read(self): | |
133 | if self.map is not None: return self.map |
|
|||
134 |
|
||||
135 | self.map = {} |
|
135 | self.map = {} | |
136 | self.pl = [nullid, nullid] |
|
136 | self.pl = [nullid, nullid] | |
137 | try: |
|
137 | try: | |
@@ -154,7 +154,7 b' class dirstate:' | |||||
154 | pos += l |
|
154 | pos += l | |
155 |
|
155 | |||
156 | def copy(self, source, dest): |
|
156 | def copy(self, source, dest): | |
157 | self.read() |
|
157 | self.lazyread() | |
158 | self.markdirty() |
|
158 | self.markdirty() | |
159 | self.copies[dest] = source |
|
159 | self.copies[dest] = source | |
160 |
|
160 | |||
@@ -169,7 +169,7 b' class dirstate:' | |||||
169 | a marked for addition''' |
|
169 | a marked for addition''' | |
170 |
|
170 | |||
171 | if not files: return |
|
171 | if not files: return | |
172 | self.read() |
|
172 | self.lazyread() | |
173 | self.markdirty() |
|
173 | self.markdirty() | |
174 | for f in files: |
|
174 | for f in files: | |
175 | if state == "r": |
|
175 | if state == "r": | |
@@ -184,7 +184,7 b' class dirstate:' | |||||
184 |
|
184 | |||
185 | def forget(self, files): |
|
185 | def forget(self, files): | |
186 | if not files: return |
|
186 | if not files: return | |
187 | self.read() |
|
187 | self.lazyread() | |
188 | self.markdirty() |
|
188 | self.markdirty() | |
189 | for f in files: |
|
189 | for f in files: | |
190 | try: |
|
190 | try: | |
@@ -198,7 +198,7 b' class dirstate:' | |||||
198 | self.markdirty() |
|
198 | self.markdirty() | |
199 |
|
199 | |||
200 | def write(self): |
|
200 | def write(self): | |
201 | st = self.opener("dirstate", "w") |
|
201 | st = self.opener("dirstate", "w", atomic=True) | |
202 | st.write("".join(self.pl)) |
|
202 | st.write("".join(self.pl)) | |
203 | for f, e in self.map.items(): |
|
203 | for f, e in self.map.items(): | |
204 | c = self.copied(f) |
|
204 | c = self.copied(f) | |
@@ -258,7 +258,7 b' class dirstate:' | |||||
258 | return False |
|
258 | return False | |
259 |
|
259 | |||
260 | def statwalk(self, files=None, match=util.always, dc=None): |
|
260 | def statwalk(self, files=None, match=util.always, dc=None): | |
261 | self.read() |
|
261 | self.lazyread() | |
262 |
|
262 | |||
263 | # walk all files by default |
|
263 | # walk all files by default | |
264 | if not files: |
|
264 | if not files: |
General Comments 0
You need to be logged in to leave comments.
Login now