Understandability of git, mercurial, bazaar source code bases

喜欢而已 提交于 2019-12-05 11:27:45

If you read C well (and some Perl and bash too), adymitruk is right. Git is a good choice.

However, if you're more comfortable with Python, read Mercurial's source. Many of the WTFs/min are going to come from your familiarity with the language and style that the DVCS is written in. Git is written in C, Perl, and Bourne shell, Mercurial is Python (with a bit of C IIRC), and Bzr is written in Python, Pyrex, and C.

You'll also want to take into account what your tool of choice is. If you use Git, you'll understand what each file is implementing. Likewise with Mercurial or Bzr.

Basically, when choosing what tool or language to use (or study), a good axiom is this: go with what you know. You're trying to learn how to implement a DVCS, not how to use a particular system or language :)

What can be much better than Python in the context of understandable and beautiful code?

Go for Mercurial. I have done it and It's absolutely lovely :)

Git is your best option because it is layered. Commands are based on lower level commands. This will allow you to understand what I'd going on conceptually. You can re implement commands yourself from the lower level ones. Finally, implement the low level ones to manipulate the files themselves.

Git was designed with a lot of thought put into it and will give you the best learning avenue.

Also, take a look at Scott Chacon's git internals posts and screen casts.

Before diving into the code it is useful to first get a architectural overview to know where to dive in. For bazaar the following might help: http://doc.bazaar.canonical.com/bzr.2.3/en/user-guide/core_concepts.html http://doc.bazaar.canonical.com/bzr.2.3/developers/overview.html

I found the bazaar code base well organised, clean and readable, probably because it is python and each code change gets reviewed so code documentation is normally amended as per review which in general makes things a lot clearer. If you get stuck you can always ask on IRC or the mailinglist, but I have not needed to do that much at all.

I wonder how much value there is in looking at bad examples, to get an idea of what not to do, rather than just looking at good examples. I've never looked at the source of Subversion or CVS but it might be worth looking through them and understanding why they don't work as well as the DVCSes you mentioned.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!