HOW IT WORKSWhen a developer attempts to connect to a repository via ssh, the SSHdaemon searches for a match for that user's key in~hg/.ssh/authorized_keys. If the developer is authorised to connect to therepository they will have an entry in this file. The entry includes a"command" prefix which specifies that the restricted shell"/usr/local/share/mercurial-server/hg-ssh" should be used; this shell ispassed an argument identifying the developer. The shell parses the commandthe developer is trying to execute, and consults a rules file to see ifthat developer is allowed to perform that action on that repository.The file ~hg/.ssh/authorized_keys is generated by "refresh-auth", whichrecurses through two directories of files containing SSH keys and generatesan entry in authorized_keys for each one, using the name of the key file asthe identifier for the developer. These keys will live in the "keys"subdirectory "/etc/mercurial-server" and the "keys" subdirectory of arepository called "hgadmin". A hook in this repository re-runs"refresh-auth" on the most recent version after every push.When users try to commit new changesets, a hook is run which consults therules file to decide whether to allow the changeset into the repository.This can depend not only on the user and the repository, but also thebranch and files in the changeset.