Audit trail

Audit trails for graphs and graph hierarchies.

This module containes a collection of utils for audit trails that provide version control for transformations of graphs and graph hierarchies:

  • Versioning, abstract class for in-memory versioning of objects;

  • VersionedGraph, wrapper around graph objects in ReGraph that allows to track their audit trail;

  • VersionedHierarchy, wrapper around hierarchy objects in ReGraph that allows to track their audit trail;

class regraph.audit.VersionedGraph(graph, init_branch='master', current_branch=None, deltas=None, heads=None, revision_graph=None)[source]

Class for versioned hierarchies.

Methods

from_json(graph, json_data)

Retrieve versioning object from JSON.

rewrite(self, rule[, instance, message])

Rewrite the versioned graph and commit.

classmethod from_json(graph, json_data)[source]

Retrieve versioning object from JSON.

rewrite(self, rule, instance=None, message=None)[source]

Rewrite the versioned graph and commit.

class regraph.audit.VersionedHierarchy(hierarchy, init_branch='master', current_branch=None, deltas=None, heads=None, revision_graph=None)[source]

Class for versioned hierarchies.

Methods

from_json(hierarchy, json_data)

Retrieve versioning object from JSON.

rewrite(self, graph_id, rule[, instance, …])

Rewrite the versioned hierarchy and commit.

classmethod from_json(hierarchy, json_data)[source]

Retrieve versioning object from JSON.

rewrite(self, graph_id, rule, instance=None, p_typing=None, rhs_typing=None, strict=False, message='')[source]

Rewrite the versioned hierarchy and commit.

class regraph.audit.Versioning(init_branch='master', current_branch=None, deltas=None, heads=None, revision_graph=None)[source]

Class for version control.

Attributes
_current_branch

Name of the current branch

_deltasdict

Dictionary with delta’s to all other branches

_headsdict
_revision_graphnetworkx.DiGraph

Methods

_compose_deltas(self, delta1, delta2)

Abstract method for composing deltas.

_invert_delta(self, delta1)

Abstract method for inverting deltas.

_merge_into_current_branch(self, delta)

Abstract method for merging a branch into the current one.

_create_identity_delta(self)

Abstract method for creating an identity-delta.

branches()

current_branch()

commit(graph, rule, instance)

branch(new_branch)

switch_branch(branch)

merge(branch1, branch2)

_compose_delta_path

branch(self, new_branch, message=None)[source]

Create a new branch with identity commit.

branches(self)[source]

Return list of branches.

commit(self, delta, message=None, previous_commit=None)[source]

Add a commit.

current_branch(self)[source]

Return the name of the current branch.

from_json(self, json_data)[source]

Retrieve versioning object from JSON.

initial_commit(self)[source]

Return the id of the initial commit.

merge_with(self, branch, message=None)[source]

Merge the current branch with the specified one.

print_history(self)[source]

Print the history of commits.

rollback(self, rollback_commit, message=None)[source]

Rollback the current branch to a specific commit.

switch_branch(self, branch)[source]

Switch branches.

to_json(self)[source]

Convert versioning object to JSON.