Changeset 1046 in tailor


Ignore:
Timestamp:
12/26/05 10:43:27 (7 years ago)
Author:
marienz@…
Hash name:
20051226094327-3d093-20754283c1cdcddd53276f880937d963abb790a5
Message:

Do not use bzr's smart_add_tree as it ignores entries
Also, do not add rename targets as they are already considered by bzr.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/bzr.py

    r1033 r1046  
    123123        # is already versioned, since there is no need to add them.  A 
    124124        # file can also already have been marked to be added in this 
    125         # changeset. Remove those files too. Do not try to catch any 
    126         # errors from Branch.add, since the they are _real_ errors. 
    127         new_entries = [] 
    128         inv = self._b.get_inventory(self._b.last_revision()) 
    129         added = [new[0] for new in compare_trees(self._b.revision_tree(self._b.last_revision()), self._b.working_tree()).added] 
    130         for e in entries: 
    131             if not inv.has_filename(e) and not e in added: 
    132                 new_entries.extend([e]) 
    133             else: 
    134                 self.log.debug('"%s" already in inventory, skipping', e) 
     125        # changeset, or may be a target of a rename operation. Remove 
     126        # those files too. Do not try to catch any errors from 
     127        # Branch.add, since the they are _real_ errors. 
     128        last_revision = self._b.last_revision() 
     129        if last_revision is None: 
     130            # initial revision 
     131            new_entries = entries 
     132        else: 
     133            new_entries = [] 
     134            inv = self._b.get_inventory(self._b.last_revision()) 
     135            diff = compare_trees(self._b.revision_tree(last_revision), 
     136                                 self._b.working_tree()) 
     137            added = ([new[0] for new in diff.added] + 
     138                     [renamed[1] for renamed in diff.renamed]) 
     139            for e in entries: 
     140                if not inv.has_filename(e) and not e in added: 
     141                    new_entries.extend([e]) 
     142                else: 
     143                    self.log.debug('"%s" already in inventory, skipping', e) 
    135144 
    136145        if len(new_entries) == 0: 
    137146            return 
    138147 
    139         from bzrlib.add import smart_add_tree 
    140         import os.path 
    141148        self.log.info('Adding %s...', ', '.join(new_entries)) 
    142         smart_add_tree(self._b.working_tree(),[os.path.join(self.basedir,e) for e in new_entries],recurse=False) 
    143  
    144     def _addSubtree(self, subdir): 
    145         """ 
    146         Add a whole subtree. 
    147  
    148         Use smart_add_branch() to add a whole new subtree to the 
    149         repository. 
    150         """ 
    151  
    152         from os.path import join 
    153         from bzrlib.add import smart_add_tree 
    154  
    155         self.log.info('Recursively adding directory "%s"...', subdir) 
    156         smart_add_tree(self._b.working_tree(), [join(self.basedir, subdir)], recurse=True) 
     149        self._b.working_tree().add(new_entries) 
    157150 
    158151    def _commit(self, date, author, patchname, changelog=None, entries=None): 
Note: See TracChangeset for help on using the changeset viewer.