I (Julian Foad) wrote: >>> * input: a set of user-specified element matchings, each of the form >>> (src-left-path, src-right-path, target-path) >>> * assign EIDs (in memory) to the source-left, source-right and target >>> trees [...] > The UI input data structure from step 1 could represent the > transformation that I think you have in mind with your 'svnmucc' > example as: > > { 1: ("A/D/H", "A"), 2: (nil, "A/D"), 3: ("A", "A/D/H") } > > a Python dictionary of (EID : (initial path, final path)).
This script attempts to convert a list of (initial_path, final_path) pairs to a pair (initial_map, final_map) of element mappings: subversion/trunk/notes/move-tracking/path_pairs_to_eid_map.py Running it with Daniel's example as input: [[[ $ notes/move-tracking/path_pairs_to_eid_map.py Input: ('A/D/H', 'A') (None, 'A/D') ('A', 'A/D/H') Input, as (intial, final) mappings by (parent-path, name): (1, [('A/D', 'H'), ('', 'A')]) (2, [None, ('A', 'D')]) (3, [('', 'A'), ('A/D', 'H')]) # converting e1: ('A/D', 'H') -> (4, 'H') # converting e3: ('', 'A') -> (0, 'A') # converting e1: ('', 'A') -> (0, 'A') # converting e2: ('A', 'D') -> (1, 'D') # converting e3: ('A/D', 'H') -> (2, 'H') # converting e4: (3, 'D') already has a parent-eid Output, as (initial, final) mappings by (parent-eid, name): (1, [(4, 'H'), (0, 'A')]) (2, [None, (1, 'D')]) (3, [(0, 'A'), (2, 'H')]) (4, [(3, 'D'), (3, 'D')]) Output, as (initial, final) mappings by paths: 1 A/D/H A 2 None A/D 3 A A/D/H 4 A/D A/D/H/D ]]] - Julian