Changeset 1499 in tailor for vcpx/repository/darcs/source.py


Ignore:
Timestamp:
05/18/08 01:56:34 (5 years ago)
Author:
lele@…
Hash name:
20080517235634-97f81-6ec8fd33b4a2d0706fca42e0fa0579da0254d9bb
Message:

Reduce "rename A B"+"add B" to "add B"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vcpx/repository/darcs/source.py

    r1498 r1499  
    4545 
    4646        - collapse "add A; rename A B" into "add B" 
     47        - collapse "rename A B; add B" into "add B" 
    4748        - annihilate "add A; remove A" 
    4849        - collapse "rename A B; remove B" into "remove A" 
     
    9192                        return e 
    9293 
     94                # The "rename A B; add B" into "add B" 
     95                if e.action_kind == e.RENAMED and e.name == entry.name: 
     96                    del self.entries[i] 
     97 
    9398                # Assert also that add_dir events must preceeds any 
    9499                # add_file and ren_file that have that dir as target, 
     
    129134        # The "rename A B; rename B C" to "rename A C" part 
    130135        elif entry.action_kind == entry.RENAMED: 
    131             for i in self.entries: 
    132                 if i.action_kind == i.RENAMED and i.name == entry.old_name: 
    133                     i.name = entry.name 
    134                     return i 
     136            for e in self.entries: 
     137                if e.action_kind == e.RENAMED and e.name == entry.old_name: 
     138                    e.name = entry.name 
     139                    return e 
     140 
     141            # The "rename A B; add B" into "add B", part two 
     142            for i,e in enumerate(self.entries): 
     143                if e.action_kind == e.ADDED and e.name == entry.name: 
     144                    return None 
    135145 
    136146        # Ok, it must be either an edit or a rename: the former goes 
Note: See TracChangeset for help on using the changeset viewer.