Reputation: 3690
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?
Upvotes: 6
Views: 155
Reputation: 36431
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]>
Upvotes: 8
Reputation: 55402
If you don't have any merge changesets, then you could try using the graft
command in Mercurial 2.0 to graft your repository to a new repository while changing the recorded user name.
If you do have merge changesets, then it might be possible to use the transplant
extension in Mercurial 2.2, although changing the recorded user name appears to be harder.
Upvotes: 1