~didrocks/tarmac/use-description-message-as-commit

« back to all changes in this revision

Viewing changes to tarmac/branch.py

  • Committer: Tarmac
  • Author(s): Rodney Dawes
  • Date: 2010-10-22 19:17:37 UTC
  • mfrom: (375.1.2 clean-ignored)
  • Revision ID: paul@eventuallyanyway.com-20101022191737-vpr3ynkw8fikke3a
Add new property method unmanaged_files for getting unknown and ignored files
Use the unmanaged_files property in cleanup, rather than only using unknowns

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        '''Remove the working tree from the temp dir.'''
89
89
        assert self.tree
90
90
        self.tree.revert()
91
 
        for unknown in [self.tree.abspath(f) for f in self.tree.unknowns()]:
92
 
            if os.path.isdir(unknown):
93
 
                shutil.rmtree(unknown)
 
91
        for filename in [self.tree.abspath(f) for f in self.unmanaged_files]:
 
92
            if os.path.isdir(filename) and not os.path.islink(filename):
 
93
                shutil.rmtree(filename)
94
94
            else:
95
 
                os.remove(unknown)
 
95
                os.remove(filename)
96
96
 
97
97
        self.tree.update()
98
98
 
111
111
            raise BranchHasConflicts(message, lp_comment)
112
112
 
113
113
    @property
 
114
    def unmanaged_files(self):
 
115
        """Get the list of ignored and unknown files in the tree."""
 
116
        self.tree.lock_read()
 
117
        unmanaged = [x for x in self.tree.unknowns()]
 
118
        unmanaged.extend([x[0] for x in self.tree.ignored_files()])
 
119
        self.tree.unlock()
 
120
        return unmanaged
 
121
 
 
122
    @property
114
123
    def conflicts(self):
115
124
        '''Print the conflicts.'''
116
125
        assert self.tree.conflicts()