Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I anonymise a mercurial repository?

Tags:

mercurial

I have a programming assignment I'm to hand in at my University for the end of this week and they have strict rules about anonymity of the assignments to maintain impartiality, so if my name (or any other obvious identifying info) appears anywhere in the work it may be automatically disqualified.

While preparing to burn everything to disc, I've just noticed/remembered that my HG repo is full of copies of my name. The code is all clean, but the author of every changeset is either my full name and email or my university login ID and the hostname of a lab computer (depends where I was working).

I need to create an anonymised version of the repo (or swap out all names for my student ID number) without losing any of the other information it holds.

So, as the headline says, how do I anonymise a mercurial repository?

like image 587
DMA57361 Avatar asked May 02 '12 19:05

DMA57361


1 Answers

You can use Mercurial's Convert extension with the --authors option to "convert" your repository into a new Mercurial repository, changing the authors' names during the conversion.

Quote from the second link:

Convert can also remap author names during conversion, if the --authors option is provided. The argument should be a simple text file maps each source commit author to a destination commit author. It is handy for source SCMs that use UNIX logins to identify authors (eg: CVS). Example:

john=John Smith <[email protected]>
tom=Tom Johnson <[email protected]>
like image 200
Christian Specht Avatar answered Nov 15 '22 12:11

Christian Specht