1502 return self[node].walk(match) |
1502 return self[node].walk(match) |
1503 |
1503 |
1504 def status(self, node1='.', node2=None, match=None, |
1504 def status(self, node1='.', node2=None, match=None, |
1505 ignored=False, clean=False, unknown=False, |
1505 ignored=False, clean=False, unknown=False, |
1506 listsubrepos=False): |
1506 listsubrepos=False): |
1507 """return status of files between two nodes or node and working |
1507 '''a convenience method that calls node1.status(node2)''' |
1508 directory. |
1508 return self[node1].status(node2, match, ignored, clean, unknown, |
1509 |
1509 listsubrepos) |
1510 If node1 is None, use the first dirstate parent instead. |
|
1511 If node2 is None, compare node1 with working directory. |
|
1512 """ |
|
1513 |
|
1514 ctx1 = self[node1] |
|
1515 ctx2 = self[node2] |
|
1516 |
|
1517 # This next code block is, admittedly, fragile logic that tests for |
|
1518 # reversing the contexts and wouldn't need to exist if it weren't for |
|
1519 # the fast (and common) code path of comparing the working directory |
|
1520 # with its first parent. |
|
1521 # |
|
1522 # What we're aiming for here is the ability to call: |
|
1523 # |
|
1524 # workingctx.status(parentctx) |
|
1525 # |
|
1526 # If we always built the manifest for each context and compared those, |
|
1527 # then we'd be done. But the special case of the above call means we |
|
1528 # just copy the manifest of the parent. |
|
1529 reversed = False |
|
1530 if (not isinstance(ctx1, context.changectx) |
|
1531 and isinstance(ctx2, context.changectx)): |
|
1532 reversed = True |
|
1533 ctx1, ctx2 = ctx2, ctx1 |
|
1534 |
|
1535 listignored, listclean, listunknown = ignored, clean, unknown |
|
1536 |
|
1537 r = [[], [], [], [], [], [], []] |
|
1538 match = ctx2._matchstatus(ctx1, r, match, listignored, listclean, |
|
1539 listunknown) |
|
1540 r = ctx2._prestatus(ctx1, r, match, listignored, listclean, listunknown) |
|
1541 r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, |
|
1542 listunknown) |
|
1543 r = ctx2._poststatus(ctx1, r, match, listignored, listclean, |
|
1544 listunknown) |
|
1545 |
|
1546 if reversed: |
|
1547 # since we are maintaining whether we reversed ctx1 and ctx2 (due |
|
1548 # to comparing the workingctx with its parent), we need to switch |
|
1549 # back added files (r[1]) and removed files (r[2]) |
|
1550 r[1], r[2] = r[2], r[1] |
|
1551 |
|
1552 if listsubrepos: |
|
1553 for subpath, sub in scmutil.itersubrepos(ctx1, ctx2): |
|
1554 rev2 = ctx2.subrev(subpath) |
|
1555 try: |
|
1556 submatch = matchmod.narrowmatcher(subpath, match) |
|
1557 s = sub.status(rev2, match=submatch, ignored=listignored, |
|
1558 clean=listclean, unknown=listunknown, |
|
1559 listsubrepos=True) |
|
1560 for rfiles, sfiles in zip(r, s): |
|
1561 rfiles.extend("%s/%s" % (subpath, f) for f in sfiles) |
|
1562 except error.LookupError: |
|
1563 self.ui.status(_("skipping missing subrepository: %s\n") |
|
1564 % subpath) |
|
1565 |
|
1566 for l in r: |
|
1567 l.sort() |
|
1568 return r |
|
1569 |
1510 |
1570 def heads(self, start=None): |
1511 def heads(self, start=None): |
1571 heads = self.changelog.heads(start) |
1512 heads = self.changelog.heads(start) |
1572 # sort the output in rev descending order |
1513 # sort the output in rev descending order |
1573 return sorted(heads, key=self.changelog.rev, reverse=True) |
1514 return sorted(heads, key=self.changelog.rev, reverse=True) |