Hi Anatoly,

On 08/01/2019 16:33, anatoly techtonik wrote:

> Over the years I had to type my email and name at least 260 times
> judging from amount of repository clones in my public accounts.

I, too, have some repos for work, and some personal repositories. The solution I settled on is to make it as easy as possible to configure a repository as work or personal.

- I don't set my name or e-mail in the hgrc in my home directory
- I have aliases `hg work` and `hg personal` to set my name and e-mail in the repo hgrc - I have a post-clone hook that reminds me to run `hg work` or `hg personal`.


    # /home/sietse/.hgrc
    [ui]
    askusername = True  # get a reminder if repo has no username set

    [hooks]
    post-init.username_reminder = echo '[run hg personal / hg work]'
    post-clone.username_reminder = echo '[run hg personal / hg work]'

    [alias]
    personal = !
        echo '[ui]' >> $(hg root)/.hg/hgrc;
echo 'username = Sietse Brouwer <[email protected]>' >> $(hg root)/.hg/hgrc

    work = !
        echo '[ui]' >> $(hg root)/.hg/hgrc;
echo 'username = Sietse Brouwer <[email protected]>' >> $(hg root)/.hg/hgrc


Example of usage:

    $ hg clone git+https://github.com/pomp/circumstance
    $ cd circumstance
    $ hg personal

I realise you were asking about adding a parameter to the original init/clone command, but perhaps a dedicated username-setting alias could also work.

Cheers,

Sietse




_______________________________________________
Mercurial mailing list
[email protected]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

Reply via email to