mercurial/metadata.py
changeset 45623 d31483377673
parent 45622 42bb6c4f8106
child 45634 9a6b409b8ebc
equal deleted inserted replaced
45622:42bb6c4f8106 45623:d31483377673
    67             and self.touched == other.touched
    67             and self.touched == other.touched
    68             and self.copied_from_p1 == other.copied_from_p1
    68             and self.copied_from_p1 == other.copied_from_p1
    69             and self.copied_from_p2 == other.copied_from_p2
    69             and self.copied_from_p2 == other.copied_from_p2
    70         )
    70         )
    71 
    71 
    72     @property
    72     @util.propertycache
    73     def added(self):
    73     def added(self):
    74         """files actively added in the changeset
    74         """files actively added in the changeset
    75 
    75 
    76         Any file present in that revision that was absent in all the changeset's
    76         Any file present in that revision that was absent in all the changeset's
    77         parents.
    77         parents.
    81         added by an ancestor)
    81         added by an ancestor)
    82         """
    82         """
    83         return frozenset(self._added)
    83         return frozenset(self._added)
    84 
    84 
    85     def mark_added(self, filename):
    85     def mark_added(self, filename):
       
    86         if 'added' in vars(self):
       
    87             del self.added
    86         self._added.add(filename)
    88         self._added.add(filename)
    87         self.mark_touched(filename)
    89         self.mark_touched(filename)
    88 
    90 
    89     def update_added(self, filenames):
    91     def update_added(self, filenames):
    90         for f in filenames:
    92         for f in filenames:
    91             self.mark_added(f)
    93             self.mark_added(f)
    92 
    94 
    93     @property
    95     @util.propertycache
    94     def merged(self):
    96     def merged(self):
    95         """files actively merged during a merge
    97         """files actively merged during a merge
    96 
    98 
    97         Any modified files which had modification on both size that needed merging.
    99         Any modified files which had modification on both size that needed merging.
    98 
   100 
    99         In this case a new filenode was created and it has two parents.
   101         In this case a new filenode was created and it has two parents.
   100         """
   102         """
   101         return frozenset(self._merged)
   103         return frozenset(self._merged)
   102 
   104 
   103     def mark_merged(self, filename):
   105     def mark_merged(self, filename):
       
   106         if 'merged' in vars(self):
       
   107             del self.merged
   104         self._merged.add(filename)
   108         self._merged.add(filename)
   105         self.mark_touched(filename)
   109         self.mark_touched(filename)
   106 
   110 
   107     def update_merged(self, filenames):
   111     def update_merged(self, filenames):
   108         for f in filenames:
   112         for f in filenames:
   109             self.mark_merged(f)
   113             self.mark_merged(f)
   110 
   114 
   111     @property
   115     @util.propertycache
   112     def removed(self):
   116     def removed(self):
   113         """files actively removed by the changeset
   117         """files actively removed by the changeset
   114 
   118 
   115         In case of merge this will only contain the set of files removing "new"
   119         In case of merge this will only contain the set of files removing "new"
   116         content. For any file absent in the current changeset:
   120         content. For any file absent in the current changeset:
   143          (d) |       one         |  new filenode ||   yes
   147          (d) |       one         |  new filenode ||   yes
   144         """
   148         """
   145         return frozenset(self._removed)
   149         return frozenset(self._removed)
   146 
   150 
   147     def mark_removed(self, filename):
   151     def mark_removed(self, filename):
       
   152         if 'removed' in vars(self):
       
   153             del self.removed
   148         self._removed.add(filename)
   154         self._removed.add(filename)
   149         self.mark_touched(filename)
   155         self.mark_touched(filename)
   150 
   156 
   151     def update_removed(self, filenames):
   157     def update_removed(self, filenames):
   152         for f in filenames:
   158         for f in filenames:
   153             self.mark_removed(f)
   159             self.mark_removed(f)
   154 
   160 
   155     @property
   161     @util.propertycache
   156     def touched(self):
   162     def touched(self):
   157         """files either actively modified, added or removed"""
   163         """files either actively modified, added or removed"""
   158         return frozenset(self._touched)
   164         return frozenset(self._touched)
   159 
   165 
   160     def mark_touched(self, filename):
   166     def mark_touched(self, filename):
       
   167         if 'touched' in vars(self):
       
   168             del self.touched
   161         self._touched.add(filename)
   169         self._touched.add(filename)
   162 
   170 
   163     def update_touched(self, filenames):
   171     def update_touched(self, filenames):
   164         for f in filenames:
   172         for f in filenames:
   165             self.mark_touched(f)
   173             self.mark_touched(f)
   166 
   174 
   167     @property
   175     @util.propertycache
   168     def copied_from_p1(self):
   176     def copied_from_p1(self):
   169         return self._p1_copies.copy()
   177         return self._p1_copies.copy()
   170 
   178 
   171     def mark_copied_from_p1(self, source, dest):
   179     def mark_copied_from_p1(self, source, dest):
       
   180         if 'copied_from_p1' in vars(self):
       
   181             del self.copied_from_p1
   172         self._p1_copies[dest] = source
   182         self._p1_copies[dest] = source
   173 
   183 
   174     def update_copies_from_p1(self, copies):
   184     def update_copies_from_p1(self, copies):
   175         for dest, source in copies.items():
   185         for dest, source in copies.items():
   176             self.mark_copied_from_p1(source, dest)
   186             self.mark_copied_from_p1(source, dest)
   177 
   187 
   178     @property
   188     @util.propertycache
   179     def copied_from_p2(self):
   189     def copied_from_p2(self):
   180         return self._p2_copies.copy()
   190         return self._p2_copies.copy()
   181 
   191 
   182     def mark_copied_from_p2(self, source, dest):
   192     def mark_copied_from_p2(self, source, dest):
       
   193         if 'copied_from_p2' in vars(self):
       
   194             del self.copied_from_p2
   183         self._p2_copies[dest] = source
   195         self._p2_copies[dest] = source
   184 
   196 
   185     def update_copies_from_p2(self, copies):
   197     def update_copies_from_p2(self, copies):
   186         for dest, source in copies.items():
   198         for dest, source in copies.items():
   187             self.mark_copied_from_p2(source, dest)
   199             self.mark_copied_from_p2(source, dest)