Mercurial (hg) also uses SHA1 hashes. It just also tries to get revision numbers out of the commit history. However, these revisions are only valid in one repository. If you watch another repo, these revisions are not guaranteed to match.
As to why git and mercurial use hashes: both have a non-linear commit history. because both are distributed, people can work on the same code basis in their local repositories without having to synchronize to a central authority (as required by SVN and CVS). Now if people commit their stuff locally and merge them later, you will have a hard time to come up with a consistent schema to form linearly increasing integer revisions. And even if you could, you would still get different result between different repos.
In the end, it's all because of the distributed nature. It is a simple way to come up with rather unique identifiers to commits. And as a side-product you can also encode the complete history towards a single commit into the hash. Which means, even if you have the same diff in a commit, you probably will get different SHA1 hashes.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…