def integration_setup(self):
     self.cli = CliRunner()
     with self.cli.isolated_filesystem():
         self.tree_dir = entry.Tree('12', '1000')
         self.diff_dir = entry.Diff('12', '1000')
         (self.tree_dir / 'v1').write(Node(text='V1V1V1', label=['1000']))
         (self.tree_dir / 'v2').write(Node(text='V2V2V2', label=['1000']))
         yield
 def add_diffs(self):
     """Adds an uneven assortment of diffs between trees"""
     entry.Diff('12', '1000', 'v1', 'v2').write({'1': 2})
     entry.Diff('12', '1000', 'v2', 'v2').write({'2': 2})
     entry.Diff('12', '1000', 'v2', 'v1').write({'2': 1})
     entry.Diff('12', '1000', 'v0', 'v1').write({'0': 1})
     entry.Diff('11', '1000', 'v3', 'v1').write({'3': 1})
     entry.Diff('12', '1001', 'v3', 'v1').write({'3': 1})
示例#3
0
def diffs(cfr_title, cfr_part):
    """Construct diffs between known trees."""
    logger.info("Build diffs - %s Part %s", cfr_title, cfr_part)
    tree_dir = entry.FrozenTree(cfr_title, cfr_part)
    diff_dir = entry.Diff(cfr_title, cfr_part)
    pairs = [(lhs, rhs) for lhs in tree_dir for rhs in tree_dir]
    deps = dependency.Graph()
    for lhs_id, rhs_id in pairs:
        deps.add(diff_dir / lhs_id / rhs_id, tree_dir / lhs_id)
        deps.add(diff_dir / lhs_id / rhs_id, tree_dir / rhs_id)

    trees = {}
    for lhs_id, rhs_id in pairs:
        path = diff_dir / lhs_id / rhs_id
        deps.validate_for(path)
        if deps.is_stale(path):
            if lhs_id not in trees:
                trees[lhs_id] = (tree_dir / lhs_id).read()
            if rhs_id not in trees:
                trees[rhs_id] = (tree_dir / rhs_id).read()

            path.write(dict(changes_between(trees[lhs_id], trees[rhs_id])))
示例#4
0
def write_diffs(client, only_title, only_part):
    for diff_entry in utils.relevant_paths(entry.Diff(), only_title,
                                           only_part):
        _, cfr_part, lhs_id, rhs_id = diff_entry.path
        diff = diff_entry.read()
        client.diff(cfr_part, lhs_id, rhs_id).write(diff)
def write_diffs(client, only_title, only_part):
    for diff_dir in utils.relevant_paths(entry.Diff(), only_title, only_part):
        cfr_title, cfr_part, lhs_id = diff_dir.path
        for rhs_id in diff_dir:
            diff = (diff_dir / rhs_id).read()
            client.diff(cfr_part, lhs_id, rhs_id).write(diff)