How does 'git log --graph' or 'hg graphlog' work?

后端 未结 4 1819
一向
一向 2020-12-04 23:57

I know that the history in Git is stored in a data structure called a DAG. I\'ve heard about DFS and know it\'s somewhat related.

I\'m curious, how do programs such

4条回答
  •  情歌与酒
    2020-12-05 00:24

    I tried looking around Git or hg's code but it's very hard to follow and get a general idea of what's going on.

    For hg, did you try to follow the code in hg itself, or in graphlog?

    Because the code of graphlog is pretty short. You can find it in hgext/graphlog.py, and really the important part is the top ~200 lines, the rest is the extension's bootstrapping and finding the revision graph selected. The code generation function is ascii, with its last parameter being the result of a call to asciiedge (the call itself is performed on the last line of generate, the function being provided to generate by graphlog)

提交回复
热议问题