~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-06-06 05:00:06 UTC
  • mfrom: (2502.1.14 fast-checkout)
  • Revision ID: pqm@pqm.ubuntu.com-20070606050006-o4yiw7jnwytgf561
Update style of TreeTransform._rename_in_limbo

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
        these files later by creating them with their final names in their
205
205
        final parents.  But now the previous name or parent is no longer
206
206
        suitable, so we have to rename them.
 
207
 
 
208
        Even for trans_ids that have no new contents, we must remove their
 
209
        entries from _limbo_files, because they are now stale.
207
210
        """
208
211
        for trans_id in trans_ids:
 
212
            old_path = self._limbo_files.pop(trans_id)
209
213
            if trans_id not in self._new_contents:
210
 
                del self._limbo_files[trans_id]
211
214
                continue
212
 
            old_path = self._limbo_files[trans_id]
213
 
            new_path = self._limbo_name(trans_id, from_scratch=True)
 
215
            new_path = self._limbo_name(trans_id)
214
216
            os.rename(old_path, new_path)
215
217
 
216
218
    def adjust_root_path(self, name, parent):
807
809
        self.finalize()
808
810
        return _TransformResults(modified_paths, self.rename_count)
809
811
 
810
 
    def _limbo_name(self, trans_id, from_scratch=False):
 
812
    def _limbo_name(self, trans_id):
811
813
        """Generate the limbo name of a file"""
812
 
        if not from_scratch:
813
 
            limbo_name = self._limbo_files.get(trans_id)
814
 
            if limbo_name is not None:
815
 
                return limbo_name
 
814
        limbo_name = self._limbo_files.get(trans_id)
 
815
        if limbo_name is not None:
 
816
            return limbo_name
816
817
        parent = self._new_parent.get(trans_id)
817
818
        # if the parent directory is already in limbo (e.g. when building a
818
819
        # tree), choose a limbo name inside the parent, to reduce further