Skip to content

astarinmymind/topo_order_commits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git repository organization

Given a git repository, the commits can be thought of as having the structure of a directed acyclic graph (DAG) with the commits being the vertices. There is a directed edge from each child commit to each of its parent commits, and a directed edge from each parent to each of its children.

The shell script:

  1. Discovers the .git directory.
  2. Gets the list of local branch names.
  3. Builds the commit graph. Each commit can be represented as an instance of the CommitNode class, which is defined as follows:
class CommitNode:
    def __init__(self, commit_hash):
        """
        :type commit_hash: str
        """
        self.commit_hash = commit_hash
        self.parents = set()
        self.children = set()
  1. Generates a topological ordering of the commits in the graph.
  2. Prints the commit hashes in order.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages