mercurial-dynamic-username


Namemercurial-dynamic-username JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://foss.heptapod.net/mercurial/mercurial-dynamic_username
SummaryMercurial Dynamic Username Extension
upload_time2024-09-25 07:01:07
maintainerNone
docs_urlNone
authorMarcin Kasperski
requires_pythonNone
licenseBSD
keywords mercurial hg username extension
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. -*- mode: rst -*-

====================================
Mercurial Dynamic Username
====================================

Use different commit username per directory tree.

With this extension you may commit as ``John Smith
<john.smith@serious.com>`` in repositories below ``~/work``, and as ``Johny
<fastjohny@fantasy.net>`` in code under ``~/hobby`` - and set this
rule once, in ``~/.hgrc``.

.. contents::
   :local:
   :depth: 2

.. sectnum::

Example
=====================

Install the extension as described below.

Write in your ``~/.hgrc``::

    [extensions]
    mercurial_dynamic_username =

    [dynamic_username]
    work.location = ~/work
    work.username = John Smith <john.smith@serious.com>
    hobby.location = ~/hobby ~/blogging
    hobby.username = Johny <fastjohny@fantasy.net>

and just commit. In any repository placed below ``~/work`` you will commit as
``John Smith``, in repos below ``~/hobby`` as ``Johny``, elsewhere default
setting (``username`` from ``[ui]``) will be used.

Configuration syntax
=====================

All settings are defined in ``[dynamic_username]`` section, and have
the following form::

    «somelabel».location = «list of directory names»
    «somelabel».username = «username used there»

Labels are used only to join pairs of those settings together.

Directory names specified in ``.location`` are space or colon
separated, and can be quoted. Repository matches the rule if it
belongs to the directory tree(s) specified here. Tildas (``~/..`` and
``~john/...``) are properly expanded.

Usernames have the same syntax as standard ``username``.

Defining ``.location`` without paired ``.username`` asks extension to
revert to standard username, for example::

    [ui]
    username = Jake <jake@loose.net>

    [dynamic_username]
    work.location = ~/work
    work.username = John Smith <john.smith@serious.com>
    open.location = ~/work/open-source

will commit as ``John Smith`` in ``~/work/libs/veryimportant``, but
will revert to default ``Jake`` in ``~/work/open-source/libshared``.

Match priority
==================================================

If more than one location matches repository, longest one is used
(like in the ``open-source`` example above). *Longest* is selected
using actual canonical path after tilda expansion (``~/work/sth`` is
longer than ``/home/littlejohny/work``).

Dynamic usernames currently always win against ``[ui]``-section
``username``, even if the latter is defined in per-repository
``.hg/hgrc``. I would gladly give priority to the latter, but I have
no idea how to detect that without re-parsing the configuration.

Testing configuration
==================================================

You can test your configuration by callling::

    hg showconfig ui.username

(results should vary depending on the current working directory).
Handy way to compare::

    hg --cwd ~/work/libs/acme  showconfig ui.username
    hg --cwd ~/hobby/blogging  showconfig ui.username

Installation
=================================================

Linux/Unix (from PyPI)
~~~~~~~~~~~~~~~~~~~~~~

If you have working ``pip`` or ``easy_install``::

    pip install --user mercurial_dynamic_username

or maybe::

    sudo pip install mercurial_dynamic_username

(or use ``easy_install`` instead of ``pip``). Then activate by::

    [extensions]
    mercurial_dynamic_username =

To upgrade, repeat the same command with ``--upgrade`` option, for
example::

    pip install --user --upgrade mercurial_dynamic_username

Linux/Unix (from source)
~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you don't have ``pip``, or wish to follow development more closely:

- clone both this repository and `mercurial_extension_utils`_ and put
  them in the same directory, for example::

    cd ~/sources
    hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/
    hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/

- update to newest tags,

- activate by::

    [extensions]
    mercurial_dynamic_username = ~/sources/mercurial-dynamic_username/mercurial_dynamic_username.py

To upgrade, pull and update.

Note that directory names matter. See `mercurial_extension_utils`_ for
longer description of this kind of installation.

Windows
~~~~~~~~~~~~~~~~~~~~~~~

If you have any Python installed, you may install with ``pip``::

    pip install mercurial_dynamic_username

Still, as Mercurial (whether taken from TortoiseHg_, or own package)
uses it's own bundled Python, you must activate by specifying the path::

    [extensions]
    mercurial_dynamic_username = C:/Python27/Lib/site-packages/mercurial_dynamic_username.py
    ;; Or wherever pip installed it

To upgrade to new version::

    pip --upgrade mercurial_dynamic_username

If you don't have any Python, clone repositories::

    cd c:\hgplugins
    hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/
    hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/

update to tagged versions and activate by path::

    [extensions]
    mercurial_dynamic_username = C:/hgplugins/mercurial-dynamic_username/mercurial_dynamic_username.py
    ;; Or wherever you cloned

See `mercurial_extension_utils`_ documentation for more details on
Windows installation. 

.. note::

   Directory names matter. If ``mercurial_dynamic_username.py`` can't find
   ``mercurial_extension_utils.py`` in system path, it looks for it in
   its own directory, in ``../mercurial_extension_utils``, and in
   ``../extension_utils``.


History
==================================================

See `HISTORY.rst`_

Repository, bug reports, enhancement suggestions
===================================================

Development is tracked on HeptaPod, see 
https://foss.heptapod.net/mercurial/mercurial-dynamic_username/

Use issue tracker there for bug reports and enhancement
suggestions.

Thanks to Octobus_ and `Clever Cloud`_ for hosting this service.

Additional notes
================

Information about this extension is also available
on Mercurial Wiki: http://mercurial.selenic.com/wiki/DynamicUsernameExtension

Check also `other Mercurial extensions I wrote`_.

.. _Octobus: https://octobus.net/
.. _Clever Cloud: https://www.clever-cloud.com/

.. _other Mercurial extensions I wrote: http://code.mekk.waw.pl/mercurial.html

.. _Mercurial: http://mercurial.selenic.com
.. _HISTORY.rst: https://foss.heptapod.net/mercurial/mercurial-dynamic_username/src/tip/HISTORY.rst
.. _mercurial_extension_utils: https://foss.heptapod.net/mercurial/mercurial-extension_utils/
.. _TortoiseHg: http://tortoisehg.bitbucket.org/

.. |drone-badge| 
    image:: https://drone.io/bitbucket.org/Mekk/mercurial-dynamic_username/status.png
     :target: https://drone.io/bitbucket.org/Mekk/mercurial-dynamic_username/latest
     :align: middle

            

Raw data

            {
    "_id": null,
    "home_page": "https://foss.heptapod.net/mercurial/mercurial-dynamic_username",
    "name": "mercurial-dynamic-username",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "mercurial hg username extension",
    "author": "Marcin Kasperski",
    "author_email": "Marcin.Kasperski@mekk.waw.pl",
    "download_url": "https://files.pythonhosted.org/packages/d6/cd/c19f822c946f34d459965a184bc467a8bb6fcb7e2b8bdb865c57de1ebb15/mercurial_dynamic_username-1.1.2.tar.gz",
    "platform": null,
    "description": ".. -*- mode: rst -*-\n\n====================================\nMercurial Dynamic Username\n====================================\n\nUse different commit username per directory tree.\n\nWith this extension you may commit as ``John Smith\n<john.smith@serious.com>`` in repositories below ``~/work``, and as ``Johny\n<fastjohny@fantasy.net>`` in code under ``~/hobby`` - and set this\nrule once, in ``~/.hgrc``.\n\n.. contents::\n   :local:\n   :depth: 2\n\n.. sectnum::\n\nExample\n=====================\n\nInstall the extension as described below.\n\nWrite in your ``~/.hgrc``::\n\n    [extensions]\n    mercurial_dynamic_username =\n\n    [dynamic_username]\n    work.location = ~/work\n    work.username = John Smith <john.smith@serious.com>\n    hobby.location = ~/hobby ~/blogging\n    hobby.username = Johny <fastjohny@fantasy.net>\n\nand just commit. In any repository placed below ``~/work`` you will commit as\n``John Smith``, in repos below ``~/hobby`` as ``Johny``, elsewhere default\nsetting (``username`` from ``[ui]``) will be used.\n\nConfiguration syntax\n=====================\n\nAll settings are defined in ``[dynamic_username]`` section, and have\nthe following form::\n\n    \u00absomelabel\u00bb.location = \u00ablist of directory names\u00bb\n    \u00absomelabel\u00bb.username = \u00abusername used there\u00bb\n\nLabels are used only to join pairs of those settings together.\n\nDirectory names specified in ``.location`` are space or colon\nseparated, and can be quoted. Repository matches the rule if it\nbelongs to the directory tree(s) specified here. Tildas (``~/..`` and\n``~john/...``) are properly expanded.\n\nUsernames have the same syntax as standard ``username``.\n\nDefining ``.location`` without paired ``.username`` asks extension to\nrevert to standard username, for example::\n\n    [ui]\n    username = Jake <jake@loose.net>\n\n    [dynamic_username]\n    work.location = ~/work\n    work.username = John Smith <john.smith@serious.com>\n    open.location = ~/work/open-source\n\nwill commit as ``John Smith`` in ``~/work/libs/veryimportant``, but\nwill revert to default ``Jake`` in ``~/work/open-source/libshared``.\n\nMatch priority\n==================================================\n\nIf more than one location matches repository, longest one is used\n(like in the ``open-source`` example above). *Longest* is selected\nusing actual canonical path after tilda expansion (``~/work/sth`` is\nlonger than ``/home/littlejohny/work``).\n\nDynamic usernames currently always win against ``[ui]``-section\n``username``, even if the latter is defined in per-repository\n``.hg/hgrc``. I would gladly give priority to the latter, but I have\nno idea how to detect that without re-parsing the configuration.\n\nTesting configuration\n==================================================\n\nYou can test your configuration by callling::\n\n    hg showconfig ui.username\n\n(results should vary depending on the current working directory).\nHandy way to compare::\n\n    hg --cwd ~/work/libs/acme  showconfig ui.username\n    hg --cwd ~/hobby/blogging  showconfig ui.username\n\nInstallation\n=================================================\n\nLinux/Unix (from PyPI)\n~~~~~~~~~~~~~~~~~~~~~~\n\nIf you have working ``pip`` or ``easy_install``::\n\n    pip install --user mercurial_dynamic_username\n\nor maybe::\n\n    sudo pip install mercurial_dynamic_username\n\n(or use ``easy_install`` instead of ``pip``). Then activate by::\n\n    [extensions]\n    mercurial_dynamic_username =\n\nTo upgrade, repeat the same command with ``--upgrade`` option, for\nexample::\n\n    pip install --user --upgrade mercurial_dynamic_username\n\nLinux/Unix (from source)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you don't have ``pip``, or wish to follow development more closely:\n\n- clone both this repository and `mercurial_extension_utils`_ and put\n  them in the same directory, for example::\n\n    cd ~/sources\n    hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/\n    hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/\n\n- update to newest tags,\n\n- activate by::\n\n    [extensions]\n    mercurial_dynamic_username = ~/sources/mercurial-dynamic_username/mercurial_dynamic_username.py\n\nTo upgrade, pull and update.\n\nNote that directory names matter. See `mercurial_extension_utils`_ for\nlonger description of this kind of installation.\n\nWindows\n~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you have any Python installed, you may install with ``pip``::\n\n    pip install mercurial_dynamic_username\n\nStill, as Mercurial (whether taken from TortoiseHg_, or own package)\nuses it's own bundled Python, you must activate by specifying the path::\n\n    [extensions]\n    mercurial_dynamic_username = C:/Python27/Lib/site-packages/mercurial_dynamic_username.py\n    ;; Or wherever pip installed it\n\nTo upgrade to new version::\n\n    pip --upgrade mercurial_dynamic_username\n\nIf you don't have any Python, clone repositories::\n\n    cd c:\\hgplugins\n    hg clone https://foss.heptapod.net/mercurial/mercurial-extension_utils/\n    hg clone https://foss.heptapod.net/mercurial/mercurial-dynamic_username/\n\nupdate to tagged versions and activate by path::\n\n    [extensions]\n    mercurial_dynamic_username = C:/hgplugins/mercurial-dynamic_username/mercurial_dynamic_username.py\n    ;; Or wherever you cloned\n\nSee `mercurial_extension_utils`_ documentation for more details on\nWindows installation. \n\n.. note::\n\n   Directory names matter. If ``mercurial_dynamic_username.py`` can't find\n   ``mercurial_extension_utils.py`` in system path, it looks for it in\n   its own directory, in ``../mercurial_extension_utils``, and in\n   ``../extension_utils``.\n\n\nHistory\n==================================================\n\nSee `HISTORY.rst`_\n\nRepository, bug reports, enhancement suggestions\n===================================================\n\nDevelopment is tracked on HeptaPod, see \nhttps://foss.heptapod.net/mercurial/mercurial-dynamic_username/\n\nUse issue tracker there for bug reports and enhancement\nsuggestions.\n\nThanks to Octobus_ and `Clever Cloud`_ for hosting this service.\n\nAdditional notes\n================\n\nInformation about this extension is also available\non Mercurial Wiki: http://mercurial.selenic.com/wiki/DynamicUsernameExtension\n\nCheck also `other Mercurial extensions I wrote`_.\n\n.. _Octobus: https://octobus.net/\n.. _Clever Cloud: https://www.clever-cloud.com/\n\n.. _other Mercurial extensions I wrote: http://code.mekk.waw.pl/mercurial.html\n\n.. _Mercurial: http://mercurial.selenic.com\n.. _HISTORY.rst: https://foss.heptapod.net/mercurial/mercurial-dynamic_username/src/tip/HISTORY.rst\n.. _mercurial_extension_utils: https://foss.heptapod.net/mercurial/mercurial-extension_utils/\n.. _TortoiseHg: http://tortoisehg.bitbucket.org/\n\n.. |drone-badge| \n    image:: https://drone.io/bitbucket.org/Mekk/mercurial-dynamic_username/status.png\n     :target: https://drone.io/bitbucket.org/Mekk/mercurial-dynamic_username/latest\n     :align: middle\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Mercurial Dynamic Username Extension",
    "version": "1.1.2",
    "project_urls": {
        "Homepage": "https://foss.heptapod.net/mercurial/mercurial-dynamic_username"
    },
    "split_keywords": [
        "mercurial",
        "hg",
        "username",
        "extension"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d6cdc19f822c946f34d459965a184bc467a8bb6fcb7e2b8bdb865c57de1ebb15",
                "md5": "9c408610d104da8a5c3f630a2022ef80",
                "sha256": "1449ce6878e826e77352b96b2b8b407287ddf2b075e77a4a490cd9671aed7962"
            },
            "downloads": -1,
            "filename": "mercurial_dynamic_username-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9c408610d104da8a5c3f630a2022ef80",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8774,
            "upload_time": "2024-09-25T07:01:07",
            "upload_time_iso_8601": "2024-09-25T07:01:07.921876Z",
            "url": "https://files.pythonhosted.org/packages/d6/cd/c19f822c946f34d459965a184bc467a8bb6fcb7e2b8bdb865c57de1ebb15/mercurial_dynamic_username-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-25 07:01:07",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mercurial-dynamic-username"
}
        
Elapsed time: 0.35844s