Force specific usernames for Mercurial commits

Erik Zielke ez at aragost.com
Fri Feb 4 09:08:48 UTC 2011


On 04-02-2011 07:26, Sven Jacobs wrote:
> Hi,
>
> we're switching from Subversion to Mercurial in our corporate 
> environment. There will a central repository that is accessible via 
> HTTPS with basic HTTP authentication.
>
> Now I'm curious whether it's possible to force specific usernames for 
> commits? I'm talking about the usernames that can be set in .hgrc like 
> this
>
>     [ui]
>     username = John Doe <john.doe at mycompany.com 
> <mailto:john.doe at mycompany.com>>
>
> and that are visible in the log messages.
>
> Because this file is placed on each developer's machine it's outside 
> of the administrator's control.
>
> This wouldn't be a problem because we trust our internal developers 
> but externals (freelancers) will also have access to at least some 
> repositories. We definitively don't want them to checkin under 
> different names.
>
> It would be great if the username can be bound/forced to the HTTP 
> username. For example if John pushes his changes to the URL 
> https://john@mycompany.com/hg/project1 
> <http://mycompany.com/hg/project1> then the usernames of all commits 
> will be set to John Doe <john.doe at mycompany.com 
> <mailto:john.doe at mycompany.com>.
>
> Is this possible?

If the username was changed like that then hashes of the changesets 
would have to change too, therefore this is not possible.

I believe you should be able to get the http username from some 
environment variable from inside a hook, if so, a possibility is to 
write a hook to reject changesets if the username doesn't match the name 
in the committed changesets.


>
> I also posted this question on Server Fault 
> (http://serverfault.com/questions/230714/force-specific-usernames-for-mercurial-commits). 
> If you like you can answer there.
>
> -- 
> Many thanks for your help,
>
> Sven
>
>
> _______________________________________________
> Mercurial mailing list
> Mercurial at selenic.com
> http://selenic.com/mailman/listinfo/mercurial


-- 
Erik Zielke

aragost Trifork ag
Professional Mercurial Support
http://www.aragost.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20110204/8386f16b/attachment.html>


More information about the Mercurial mailing list