##// END OF EJS Templates
basectx: copy localrepo.status method...
Sean Farley -
r21594:9e456782 default
parent child Browse files
Show More
@@ -269,6 +269,66 b' class basectx(object):'
269 def dirty(self):
269 def dirty(self):
270 return False
270 return False
271
271
272 def status(self, other=None, match=None, listignored=False,
273 listclean=False, listunknown=False, listsubrepos=False):
274 """return status of files between two nodes or node and working
275 directory.
276
277 If other is None, compare this node with working directory.
278 """
279
280 ctx1 = self
281 ctx2 = self._repo[other]
282
283 # This next code block is, admittedly, fragile logic that tests for
284 # reversing the contexts and wouldn't need to exist if it weren't for
285 # the fast (and common) code path of comparing the working directory
286 # with its first parent.
287 #
288 # What we're aiming for here is the ability to call:
289 #
290 # workingctx.status(parentctx)
291 #
292 # If we always built the manifest for each context and compared those,
293 # then we'd be done. But the special case of the above call means we
294 # just copy the manifest of the parent.
295 reversed = False
296 if (not isinstance(ctx1, changectx)
297 and isinstance(ctx2, changectx)):
298 reversed = True
299 ctx1, ctx2 = ctx2, ctx1
300
301 r = [[], [], [], [], [], [], []]
302 match = ctx2._matchstatus(ctx1, r, match, listignored, listclean,
303 listunknown)
304 r = ctx2._prestatus(ctx1, r, match, listignored, listclean, listunknown)
305 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean,
306 listunknown)
307 r = ctx2._poststatus(ctx1, r, match, listignored, listclean,
308 listunknown)
309
310 if reversed:
311 r[1], r[2], r[3], r[4] = r[2], r[1], r[4], r[3]
312
313 if listsubrepos:
314 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2):
315 rev2 = ctx2.subrev(subpath)
316 try:
317 submatch = matchmod.narrowmatcher(subpath, match)
318 s = sub.status(rev2, match=submatch, ignored=listignored,
319 clean=listclean, unknown=listunknown,
320 listsubrepos=True)
321 for rfiles, sfiles in zip(r, s):
322 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles)
323 except error.LookupError:
324 self._repo.ui.status(_("skipping missing "
325 "subrepository: %s\n") % subpath)
326
327 for l in r:
328 l.sort()
329 return r
330
331
272 def makememctx(repo, parents, text, user, date, branch, files, store,
332 def makememctx(repo, parents, text, user, date, branch, files, store,
273 editor=None):
333 editor=None):
274 def getfilectx(repo, memctx, path):
334 def getfilectx(repo, memctx, path):
General Comments 0
You need to be logged in to leave comments. Login now