/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: Aaron Bentley
  • Date: 2007-08-20 20:50:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2765.
  • Revision ID: abentley@panoramicfeedback.com-20070820205037-z3yvwisr73r8jqff
Implement FileMover, to support TreeTransform rollback

Show diffs side-by-side

added added

removed removed

Lines of Context:
1741
1741
                                   file_id=modified_id, 
1742
1742
                                   conflict_path=conflicting_path,
1743
1743
                                   conflict_file_id=conflicting_id)
 
1744
 
 
1745
 
 
1746
class _FileMover(object):
 
1747
 
 
1748
    def __init__(self):
 
1749
        self.past_renames = []
 
1750
 
 
1751
    def rename(self, from_, to):
 
1752
        os.rename(from_, to)
 
1753
        self.past_renames.append((from_, to))
 
1754
 
 
1755
    def rollback(self):
 
1756
        for from_, to in reversed(self.past_renames):
 
1757
            os.rename(to, from_)