HGBot: Check Parent Changeset
completed by: Chris Stankus
mentors: Jon Neal, Arc Riley, Terri Oda, David Czech, AJ Williams, Amaury Medeiros
HGBot is a Python program that automates our Mercurial repository management, handles Mercurial authentication, and provides user interfaces such as IRC.
Now legendary, a student in Google Code-in 2012 downloaded one of our repositories as a zipfile from Mercurial's web interface, unzipped it, and managed to commit/push the entire repository history (thousands of changesets) a second time, with the final commit a branch merge. While the server-side fix was trivial, by the time we realized what had happened several other students and developers had cloned the doubled repository and would then, themselves, re-push the duplicated changesets.
To avoid something like this happening in the future, add a check to HGBot to ensure each changeset in the changegroup has a valid parent (either a previous changeset in the changegroup or a changeset in the existing Mercurial database). Try to duplicate the above described nightmare scenario and ensure the check fails.
The failure message should clearly explain what happened and how they need to fix it. This can include a URL, such as a Mercurial tutorial or a page on our wiki, but should also directly provide hg command suggestions without requiring them to read documentation.
While working on this task you should join and remain in #CopyleftGames on Freenode to get help, feedback, and guidance from mentors and other developers. Code updates which may affect your work are also announced here as they happen.
When you've done, commit your work and post the resulting changeset url to this task.