656 util.pathto(self.getcwd(), fn), short(node))) |
656 util.pathto(self.getcwd(), fn), short(node))) |
657 else: |
657 else: |
658 for src, fn in self.dirstate.walk(files, match, badmatch=badmatch): |
658 for src, fn in self.dirstate.walk(files, match, badmatch=badmatch): |
659 yield src, fn |
659 yield src, fn |
660 |
660 |
661 def changes(self, node1=None, node2=None, files=[], match=util.always, |
661 def status(self, node1=None, node2=None, files=[], match=util.always, |
662 wlock=None, show_ignored=None): |
662 wlock=None, list_ignored=False, list_clean=False): |
663 """return changes between two nodes or node and working directory |
663 """return status of files between two nodes or node and working directory |
664 |
664 |
665 If node1 is None, use the first dirstate parent instead. |
665 If node1 is None, use the first dirstate parent instead. |
666 If node2 is None, compare node1 with working directory. |
666 If node2 is None, compare node1 with working directory. |
667 """ |
667 """ |
668 |
668 |
677 for fn in mf.keys(): |
677 for fn in mf.keys(): |
678 if not match(fn): |
678 if not match(fn): |
679 del mf[fn] |
679 del mf[fn] |
680 return mf |
680 return mf |
681 |
681 |
682 modified, added, removed, deleted, unknown, ignored = [],[],[],[],[],[] |
682 modified, added, removed, deleted, unknown = [], [], [], [], [] |
|
683 ignored, clean = [], [] |
|
684 |
683 compareworking = False |
685 compareworking = False |
684 if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): |
686 if not node1 or (not node2 and node1 == self.dirstate.parents()[0]): |
685 compareworking = True |
687 compareworking = True |
686 |
688 |
687 if not compareworking: |
689 if not compareworking: |
695 if not wlock: |
697 if not wlock: |
696 try: |
698 try: |
697 wlock = self.wlock(wait=0) |
699 wlock = self.wlock(wait=0) |
698 except lock.LockException: |
700 except lock.LockException: |
699 wlock = None |
701 wlock = None |
700 lookup, modified, added, removed, deleted, unknown, ignored = ( |
702 (lookup, modified, added, removed, deleted, unknown, |
701 self.dirstate.changes(files, match, show_ignored)) |
703 ignored, clean) = self.dirstate.status(files, match, |
|
704 list_ignored, list_clean) |
702 |
705 |
703 # are we comparing working dir against its parent? |
706 # are we comparing working dir against its parent? |
704 if compareworking: |
707 if compareworking: |
705 if lookup: |
708 if lookup: |
706 # do a full compare of any files that might have changed |
709 # do a full compare of any files that might have changed |
719 for f in removed: |
722 for f in removed: |
720 if f in mf2: |
723 if f in mf2: |
721 del mf2[f] |
724 del mf2[f] |
722 else: |
725 else: |
723 # we are comparing two revisions |
726 # we are comparing two revisions |
724 deleted, unknown, ignored = [], [], [] |
|
725 mf2 = mfmatches(node2) |
727 mf2 = mfmatches(node2) |
726 |
728 |
727 if not compareworking: |
729 if not compareworking: |
728 # flush lists from dirstate before comparing manifests |
730 # flush lists from dirstate before comparing manifests |
729 modified, added = [], [] |
731 modified, added, clean = [], [], [] |
730 |
732 |
731 # make sure to sort the files so we talk to the disk in a |
733 # make sure to sort the files so we talk to the disk in a |
732 # reasonable order |
734 # reasonable order |
733 mf2keys = mf2.keys() |
735 mf2keys = mf2.keys() |
734 mf2keys.sort() |
736 mf2keys.sort() |
735 for fn in mf2keys: |
737 for fn in mf2keys: |
736 if mf1.has_key(fn): |
738 if mf1.has_key(fn): |
737 if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)): |
739 if mf1[fn] != mf2[fn] and (mf2[fn] != "" or fcmp(fn, mf1)): |
738 modified.append(fn) |
740 modified.append(fn) |
|
741 elif list_clean: |
|
742 clean.append(fn) |
739 del mf1[fn] |
743 del mf1[fn] |
740 else: |
744 else: |
741 added.append(fn) |
745 added.append(fn) |
742 |
746 |
743 removed = mf1.keys() |
747 removed = mf1.keys() |
744 |
748 |
745 # sort and return results: |
749 # sort and return results: |
746 for l in modified, added, removed, deleted, unknown, ignored: |
750 for l in modified, added, removed, deleted, unknown, ignored, clean: |
747 l.sort() |
751 l.sort() |
748 if show_ignored is None: |
752 return (modified, added, removed, deleted, unknown, ignored, clean) |
749 return (modified, added, removed, deleted, unknown) |
753 |
|
754 def changes(self, node1=None, node2=None, files=[], match=util.always, |
|
755 wlock=None, list_ignored=False, list_clean=False): |
|
756 '''DEPRECATED - use status instead''' |
|
757 marduit = self.status(node1, node2, files, match, wlock, |
|
758 list_ignored, list_clean) |
|
759 if list_ignored: |
|
760 return marduit[:-1] |
750 else: |
761 else: |
751 return (modified, added, removed, deleted, unknown, ignored) |
762 return marduit[:-2] |
752 |
763 |
753 def add(self, list, wlock=None): |
764 def add(self, list, wlock=None): |
754 if not wlock: |
765 if not wlock: |
755 wlock = self.wlock() |
766 wlock = self.wlock() |
756 for f in list: |
767 for f in list: |