Changeset 1501 in tailor
- Timestamp:
- 05/18/08 19:55:31 (5 years ago)
- Hash name:
- 20080518175531-97f81-1ddbf126ce022be13c58d17c875cb0ef09e4e4e7
- Location:
- vcpx
- Files:
-
- 1 added
- 2 edited
-
tests/darcs.py (modified) (1 diff)
-
repository/darcs/source.py (modified) (2 diffs)
-
tests/data/darcs-rename_and_add_dir_test.log (added)
Legend:
- Unmodified
- Added
- Removed
-
vcpx/tests/darcs.py
r1499 r1501 186 186 self.assertEqual(entry.name, 'darcs_cgi.lhs') 187 187 self.assertEqual(entry.action_kind, entry.UPDATED) 188 189 def testRenameAndAddDir(self): 190 """Verify that the parser reduce rename A B+add B to rename A B""" 191 192 log = self.getDarcsOutput('darcs-rename_and_add_dir_test') 193 csets = changesets_from_darcschanges(log) 194 195 cset = csets.next() 196 self.assertEqual(len(cset.entries), 7) 197 198 entry = cset.entries[0] 199 self.assertEqual(entry.name, 'logos/plain_logo.png') 200 self.assertEqual(entry.action_kind, entry.RENAMED) 201 self.assertEqual(entry.old_name, 'logo.png') 202 203 entry = cset.entries[1] 204 self.assertEqual(entry.name, 'logos') 205 self.assertEqual(entry.action_kind, entry.ADDED) 206 207 entry = cset.entries[2] 208 self.assertEqual(entry.name, 'logos/large_logo.png') 209 self.assertEqual(entry.action_kind, entry.ADDED) 188 210 189 211 def testBadOrderedXML(self): -
vcpx/repository/darcs/source.py
r1499 r1501 71 71 # to an addition instead, and don't insert any other entry 72 72 73 dirname = entry.name+'/' # darcs hopefully use forward slashes also under win 73 # darcs hopefully use forward slashes also under win 74 dirname = entry.name+'/' 74 75 75 76 for i,e in enumerate(self.entries): 76 if e.action_kind == e.RENAMED and e.old_name == entry.name: 77 # Unfortunately we have to check if the order if 78 # messed up, in that case we should not do anything. 79 # Example: mv a a2; mkdir a; mv a2 a/b 80 skip = False 81 for j in self.entries: 82 if j.action_kind == j.RENAMED and j.name.startswith(dirname): 83 skip = True 84 break 85 # Luckily enough (since removes are the first entries 86 # in the list, that is) by anticipating the add we 87 # cure also the case below, when addition follows 88 # edit. 89 if not skip: 90 e.action_kind = e.ADDED 91 e.old_name = None 92 return e 93 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] 77 if e.action_kind == e.RENAMED: 78 if e.old_name == entry.name: 79 # Unfortunately we have to check if the order if 80 # messed up, in that case we should not do anything. 81 # Example: mv a a2; mkdir a; mv a2 a/b 82 skip = False 83 for j in self.entries: 84 if j.action_kind == j.RENAMED and j.name.startswith(dirname): 85 skip = True 86 break 87 # Luckily enough (since removes are the first entries 88 # in the list, that is) by anticipating the add we 89 # cure also the case below, when addition follows 90 # edit. 91 if not skip: 92 e.action_kind = e.ADDED 93 e.old_name = None 94 return e 95 96 # The "rename A B; add B" into "add B" 97 if e.name == entry.name: 98 del self.entries[i] 97 99 98 100 # Assert also that add_dir events must preceeds any … … 134 136 # The "rename A B; rename B C" to "rename A C" part 135 137 elif entry.action_kind == entry.RENAMED: 138 # Adjust previous renames 139 olddirname = entry.old_name+'/' 140 for e in self.entries: 141 if e.action_kind == e.RENAMED and e.name.startswith(olddirname): 142 e.name = entry.name + '/' + e.name[len(olddirname):] 143 136 144 for e in self.entries: 137 145 if e.action_kind == e.RENAMED and e.name == entry.old_name:
Note: See TracChangeset
for help on using the changeset viewer.
