Show More
@@ -86,175 +86,174 b' def reposetup(ui, repo):' | |||||
86 | if not self.lfstatus: |
|
86 | if not self.lfstatus: | |
87 | return super(lfilesrepo, self).status(node1, node2, match, |
|
87 | return super(lfilesrepo, self).status(node1, node2, match, | |
88 | listignored, listclean, listunknown, listsubrepos) |
|
88 | listignored, listclean, listunknown, listsubrepos) | |
89 | else: |
|
89 | ||
90 |
|
|
90 | # some calls in this function rely on the old version of status | |
91 |
|
|
91 | self.lfstatus = False | |
92 |
|
|
92 | ctx1 = self[node1] | |
93 |
|
|
93 | ctx2 = self[node2] | |
94 |
|
|
94 | working = ctx2.rev() is None | |
95 |
|
|
95 | parentworking = working and ctx1 == self['.'] | |
96 |
|
96 | |||
97 |
|
|
97 | def inctx(file, ctx): | |
98 |
|
|
98 | try: | |
99 |
|
|
99 | if ctx.rev() is None: | |
100 |
|
|
100 | return file in ctx.manifest() | |
101 |
|
|
101 | ctx[file] | |
102 |
|
|
102 | return True | |
103 |
|
|
103 | except KeyError: | |
104 |
|
|
104 | return False | |
105 |
|
105 | |||
106 |
|
|
106 | if match is None: | |
107 |
|
|
107 | match = match_.always(self.root, self.getcwd()) | |
108 |
|
108 | |||
109 |
|
|
109 | wlock = None | |
|
110 | try: | |||
110 | try: |
|
111 | try: | |
111 | try: |
|
112 | # updating the dirstate is optional | |
112 | # updating the dirstate is optional |
|
113 | # so we don't wait on the lock | |
113 | # so we don't wait on the lock |
|
114 | wlock = self.wlock(False) | |
114 | wlock = self.wlock(False) |
|
115 | except error.LockError: | |
115 |
|
|
116 | pass | |
116 | pass |
|
|||
117 |
|
117 | |||
118 |
|
|
118 | # First check if there were files specified on the | |
119 |
|
|
119 | # command line. If there were, and none of them were | |
120 |
|
|
120 | # largefiles, we should just bail here and let super | |
121 |
|
|
121 | # handle it -- thus gaining a big performance boost. | |
122 |
|
|
122 | lfdirstate = lfutil.openlfdirstate(ui, self) | |
123 |
|
|
123 | if match.files() and not match.anypats(): | |
124 |
|
|
124 | for f in lfdirstate: | |
125 |
|
|
125 | if match(f): | |
126 |
|
|
126 | break | |
127 |
|
|
127 | else: | |
128 |
|
|
128 | return super(lfilesrepo, self).status(node1, node2, | |
129 |
|
|
129 | match, listignored, listclean, | |
130 |
|
|
130 | listunknown, listsubrepos) | |
131 |
|
131 | |||
132 |
|
|
132 | # Create a copy of match that matches standins instead | |
133 |
|
|
133 | # of largefiles. | |
134 |
|
|
134 | def tostandins(files): | |
135 |
|
|
135 | if not working: | |
136 |
|
|
136 | return files | |
137 |
|
|
137 | newfiles = [] | |
138 |
|
|
138 | dirstate = self.dirstate | |
139 |
|
|
139 | for f in files: | |
140 |
|
|
140 | sf = lfutil.standin(f) | |
141 |
|
|
141 | if sf in dirstate: | |
142 |
|
|
142 | newfiles.append(sf) | |
143 |
|
|
143 | elif sf in dirstate.dirs(): | |
144 |
|
|
144 | # Directory entries could be regular or | |
145 |
|
|
145 | # standin, check both | |
146 |
|
|
146 | newfiles.extend((f, sf)) | |
147 |
|
|
147 | else: | |
148 |
|
|
148 | newfiles.append(f) | |
149 |
|
|
149 | return newfiles | |
150 |
|
150 | |||
151 |
|
|
151 | m = copy.copy(match) | |
152 |
|
|
152 | m._files = tostandins(m._files) | |
|
153 | ||||
|
154 | result = super(lfilesrepo, self).status(node1, node2, m, | |||
|
155 | ignored, clean, unknown, listsubrepos) | |||
|
156 | if working: | |||
153 |
|
157 | |||
154 | result = super(lfilesrepo, self).status(node1, node2, m, |
|
158 | def sfindirstate(f): | |
155 | ignored, clean, unknown, listsubrepos) |
|
159 | sf = lfutil.standin(f) | |
156 | if working: |
|
160 | dirstate = self.dirstate | |
157 |
|
161 | return sf in dirstate or sf in dirstate.dirs() | ||
158 | def sfindirstate(f): |
|
|||
159 | sf = lfutil.standin(f) |
|
|||
160 | dirstate = self.dirstate |
|
|||
161 | return sf in dirstate or sf in dirstate.dirs() |
|
|||
162 |
|
162 | |||
163 |
|
|
163 | match._files = [f for f in match._files | |
164 |
|
|
164 | if sfindirstate(f)] | |
165 |
|
|
165 | # Don't waste time getting the ignored and unknown | |
166 |
|
|
166 | # files from lfdirstate | |
167 |
|
|
167 | s = lfdirstate.status(match, [], False, | |
168 |
|
|
168 | listclean, False) | |
169 |
|
|
169 | (unsure, modified, added, removed, missing, _unknown, | |
170 |
|
|
170 | _ignored, clean) = s | |
171 |
|
|
171 | if parentworking: | |
172 |
|
|
172 | for lfile in unsure: | |
173 |
|
|
173 | standin = lfutil.standin(lfile) | |
174 |
|
|
174 | if standin not in ctx1: | |
175 |
|
|
175 | # from second parent | |
176 |
|
|
176 | modified.append(lfile) | |
177 |
|
|
177 | elif ctx1[standin].data().strip() \ | |
178 |
|
|
178 | != lfutil.hashfile(self.wjoin(lfile)): | |
|
179 | modified.append(lfile) | |||
|
180 | else: | |||
|
181 | clean.append(lfile) | |||
|
182 | lfdirstate.normal(lfile) | |||
|
183 | else: | |||
|
184 | tocheck = unsure + modified + added + clean | |||
|
185 | modified, added, clean = [], [], [] | |||
|
186 | ||||
|
187 | for lfile in tocheck: | |||
|
188 | standin = lfutil.standin(lfile) | |||
|
189 | if inctx(standin, ctx1): | |||
|
190 | if ctx1[standin].data().strip() != \ | |||
|
191 | lfutil.hashfile(self.wjoin(lfile)): | |||
179 | modified.append(lfile) |
|
192 | modified.append(lfile) | |
180 | else: |
|
193 | else: | |
181 | clean.append(lfile) |
|
194 | clean.append(lfile) | |
182 |
|
|
195 | else: | |
183 |
|
|
196 | added.append(lfile) | |
184 | tocheck = unsure + modified + added + clean |
|
|||
185 | modified, added, clean = [], [], [] |
|
|||
186 |
|
197 | |||
187 | for lfile in tocheck: |
|
198 | # Standins no longer found in lfdirstate has been | |
188 | standin = lfutil.standin(lfile) |
|
199 | # removed | |
189 |
|
|
200 | for standin in ctx1.manifest(): | |
190 | if ctx1[standin].data().strip() != \ |
|
201 | if not lfutil.isstandin(standin): | |
191 | lfutil.hashfile(self.wjoin(lfile)): |
|
202 | continue | |
192 | modified.append(lfile) |
|
203 | lfile = lfutil.splitstandin(standin) | |
193 |
|
|
204 | if not match(lfile): | |
194 |
|
|
205 | continue | |
195 |
|
|
206 | if lfile not in lfdirstate: | |
196 |
|
|
207 | removed.append(lfile) | |
197 |
|
208 | |||
198 | # Standins no longer found in lfdirstate has been |
|
209 | # Filter result lists | |
199 |
|
|
210 | result = list(result) | |
200 | for standin in ctx1.manifest(): |
|
|||
201 | if not lfutil.isstandin(standin): |
|
|||
202 | continue |
|
|||
203 | lfile = lfutil.splitstandin(standin) |
|
|||
204 | if not match(lfile): |
|
|||
205 | continue |
|
|||
206 | if lfile not in lfdirstate: |
|
|||
207 | removed.append(lfile) |
|
|||
208 |
|
211 | |||
209 | # Filter result lists |
|
212 | # Largefiles are not really removed when they're | |
210 | result = list(result) |
|
213 | # still in the normal dirstate. Likewise, normal | |
|
214 | # files are not really removed if they are still in | |||
|
215 | # lfdirstate. This happens in merges where files | |||
|
216 | # change type. | |||
|
217 | removed = [f for f in removed | |||
|
218 | if f not in self.dirstate] | |||
|
219 | result[2] = [f for f in result[2] | |||
|
220 | if f not in lfdirstate] | |||
211 |
|
221 | |||
212 | # Largefiles are not really removed when they're |
|
222 | lfiles = set(lfdirstate._map) | |
213 | # still in the normal dirstate. Likewise, normal |
|
223 | # Unknown files | |
214 | # files are not really removed if they are still in |
|
224 | result[4] = set(result[4]).difference(lfiles) | |
215 | # lfdirstate. This happens in merges where files |
|
225 | # Ignored files | |
216 | # change type. |
|
226 | result[5] = set(result[5]).difference(lfiles) | |
217 | removed = [f for f in removed |
|
227 | # combine normal files and largefiles | |
218 |
|
|
228 | normals = [[fn for fn in filelist | |
219 | result[2] = [f for f in result[2] |
|
229 | if not lfutil.isstandin(fn)] | |
220 |
|
|
230 | for filelist in result] | |
|
231 | lfiles = (modified, added, removed, missing, [], [], clean) | |||
|
232 | result = [sorted(list1 + list2) | |||
|
233 | for (list1, list2) in zip(normals, lfiles)] | |||
|
234 | else: | |||
|
235 | def toname(f): | |||
|
236 | if lfutil.isstandin(f): | |||
|
237 | return lfutil.splitstandin(f) | |||
|
238 | return f | |||
|
239 | result = [[toname(f) for f in items] | |||
|
240 | for items in result] | |||
221 |
|
241 | |||
222 | lfiles = set(lfdirstate._map) |
|
242 | if wlock: | |
223 | # Unknown files |
|
243 | lfdirstate.write() | |
224 | result[4] = set(result[4]).difference(lfiles) |
|
244 | ||
225 | # Ignored files |
|
245 | finally: | |
226 | result[5] = set(result[5]).difference(lfiles) |
|
246 | if wlock: | |
227 | # combine normal files and largefiles |
|
247 | wlock.release() | |
228 | normals = [[fn for fn in filelist |
|
|||
229 | if not lfutil.isstandin(fn)] |
|
|||
230 | for filelist in result] |
|
|||
231 | lfiles = (modified, added, removed, missing, [], [], |
|
|||
232 | clean) |
|
|||
233 | result = [sorted(list1 + list2) |
|
|||
234 | for (list1, list2) in zip(normals, lfiles)] |
|
|||
235 | else: |
|
|||
236 | def toname(f): |
|
|||
237 | if lfutil.isstandin(f): |
|
|||
238 | return lfutil.splitstandin(f) |
|
|||
239 | return f |
|
|||
240 | result = [[toname(f) for f in items] |
|
|||
241 | for items in result] |
|
|||
242 |
|
248 | |||
243 | if wlock: |
|
249 | if not listunknown: | |
244 | lfdirstate.write() |
|
250 | result[4] = [] | |
245 |
|
251 | if not listignored: | ||
246 |
|
|
252 | result[5] = [] | |
247 |
|
|
253 | if not listclean: | |
248 | wlock.release() |
|
254 | result[6] = [] | |
249 |
|
255 | self.lfstatus = True | ||
250 | if not listunknown: |
|
256 | return result | |
251 | result[4] = [] |
|
|||
252 | if not listignored: |
|
|||
253 | result[5] = [] |
|
|||
254 | if not listclean: |
|
|||
255 | result[6] = [] |
|
|||
256 | self.lfstatus = True |
|
|||
257 | return result |
|
|||
258 |
|
257 | |||
259 | # As part of committing, copy all of the largefiles into the |
|
258 | # As part of committing, copy all of the largefiles into the | |
260 | # cache. |
|
259 | # cache. |
General Comments 0
You need to be logged in to leave comments.
Login now