I’m starting to use Mercurial on Bitbucket to manage shared projects, and I’m recording the problems I run into and their solutions.
Problem: hg commit yields “no username supplied”
Mercurial apparently doesn’t record which user checked out the repository in the metadata. (I’d love to know why.) I fixed this by creating an .hgrc file in my Linux home directory and dropping in it the following:
[ui] username = FirstName LastName <email@example.com>
Problem: *.pyc files committed
When adding directories recursively to my repository, nested *.pyc files were included. (Subversion ignores these files by default when adding a directory.) I don’t want compiled Python files to be version controlled, so I can ignore them with an .hgignore file at the top level of my repository:
syntax: glob *.pyc
Problem: can’t commit an empty directory
Mercurial only recognizes directories as paths to the things it really cares about: regular old files. If a directory contains no files, one can’t commit it. The fix? Put a file in the directory.