HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/bugtracker.cpython-39.pyc
a

�*�^�:�@s�ddlmZddlmZmZddlmZee�d�dZGdd�dej�Z	Gd	d
�d
ej�Z
Gdd�dej�ZGd
d�dej�ZGdd�dej�Z
Gdd�dej�Zdd�ZGdd�dej�Ze�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Ze�ded d!��e�d"ed#d$��e�d%ed%d&��e�d'ed'd(��Gd)d*�d*e�ZGd+d,�d,ee�Ze�d-ed-d.��e�d/ed/d0��Gd1d2�d2e�Ze�d3e��d4Zd5ZeehZd6d7�Zd8d9�Z d:S);�)�absolute_import�)�errors�registry)�lazy_importz
from breezy import urlutils
a�When making a commit, metadata about bugs fixed by that change can be
recorded by using the ``--fixes`` option. For each bug marked as fixed, an
entry is included in the 'bugs' revision property stating '<url> <status>'.
(The only ``status`` value currently supported is ``fixed.``)

The ``--fixes`` option allows you to specify a bug tracker and a bug identifier
rather than a full URL. This looks like::

    bzr commit --fixes <tracker>:<id>

or::

    bzr commit --fixes <id>

where "<tracker>" is an identifier for the bug tracker, and "<id>" is the
identifier for that bug within the bugtracker, usually the bug number.
If "<tracker>" is not specified the ``bugtracker`` set in the branch
or global configuration is used.

Bazaar knows about a few bug trackers that have many users. If
you use one of these bug trackers then there is no setup required to
use this feature, you just need to know the tracker identifier to use.
These are the bugtrackers that are built in:

  ============================ ============ ============
  URL                          Abbreviation Example
  ============================ ============ ============
  https://bugs.launchpad.net/  lp           lp:12345
  http://bugs.debian.org/      deb          deb:12345
  http://bugzilla.gnome.org/   gnome        gnome:12345
  ============================ ============ ============

For the bug trackers not listed above configuration is required.
Support for generating the URLs for any project using Bugzilla or Trac
is built in, along with a template mechanism for other bugtrackers with
simple URL schemes. If your bug tracker can't be described by one
of the schemes described below then you can write a plugin to support
it.

If you use Bugzilla or Trac, then you only need to set a configuration
variable which contains the base URL of the bug tracker. These options
can go into ``breezy.conf``, ``branch.conf`` or into a branch-specific
configuration section in ``locations.conf``.  You can set up these values
for each of the projects you work on.

Note: As you provide a short name for each tracker, you can specify one or
more bugs in one or more trackers at commit time if you wish.

Launchpad
---------

Use ``bzr commit --fixes lp:2`` to record that this commit fixes bug 2.

bugzilla_<tracker>_url
----------------------

If present, the location of the Bugzilla bug tracker referred to by
<tracker>. This option can then be used together with ``bzr commit
--fixes`` to mark bugs in that tracker as being fixed by that commit. For
example::

    bugzilla_squid_url = http://bugs.squid-cache.org

would allow ``bzr commit --fixes squid:1234`` to mark Squid's bug 1234 as
fixed.

trac_<tracker>_url
------------------

If present, the location of the Trac instance referred to by
<tracker>. This option can then be used together with ``bzr commit
--fixes`` to mark bugs in that tracker as being fixed by that commit. For
example::

    trac_twisted_url = http://www.twistedmatrix.com/trac

would allow ``bzr commit --fixes twisted:1234`` to mark Twisted's bug 1234 as
fixed.

bugtracker_<tracker>_url
------------------------

If present, the location of a generic bug tracker instance referred to by
<tracker>. The location must contain an ``{id}`` placeholder,
which will be replaced by a specific bug ID. This option can then be used
together with ``bzr commit --fixes`` to mark bugs in that tracker as being
fixed by that commit. For example::

    bugtracker_python_url = http://bugs.python.org/issue{id}

would allow ``bzr commit --fixes python:1234`` to mark bug 1234 in Python's
Roundup bug tracker as fixed, or::

    bugtracker_cpan_url = http://rt.cpan.org/Public/Bug/Display.html?id={id}

would allow ``bzr commit --fixes cpan:1234`` to mark bug 1234 in CPAN's
RT bug tracker as fixed, or::

    bugtracker_hudson_url = http://issues.hudson-ci.org/browse/{id}

would allow ``bzr commit --fixes hudson:HUDSON-1234`` to mark bug HUDSON-1234
in Hudson's JIRA bug tracker as fixed.
c@seZdZdZdd�ZdS)�MalformedBugIdentifierzsDid not understand bug identifier %(bug_id)s: %(reason)s. See "brz help bugs" for more information on this feature.cCs||_||_dS�N)�bug_id�reason)�selfr	r
�r�3/usr/lib/python3/dist-packages/breezy/bugtracker.py�__init__�szMalformedBugIdentifier.__init__N��__name__�
__module__�__qualname__Z_fmtrrrrr
r�src@seZdZdZdd�ZdS)�InvalidBugTrackerURLzHThe URL for bug tracker "%(abbreviation)s" doesn't contain {id}: %(url)scCs||_||_dSr)�abbreviation�url)rrrrrr
r�szInvalidBugTrackerURL.__init__Nrrrrr
r�src@seZdZdZdd�ZdS)�UnknownBugTrackerAbbreviationzHCannot find registered bug tracker called %(abbreviation)s on %(branch)scCs||_||_dSr)r�branch�rrrrrr
r�sz&UnknownBugTrackerAbbreviation.__init__Nrrrrr
r�src@seZdZdZdd�ZdS)�InvalidLineInBugsPropertyz)Invalid line in bugs property: '%(line)s'cCs
||_dSr)�line)rrrrr
r�sz"InvalidLineInBugsProperty.__init__Nrrrrr
r�src@seZdZdZdd�ZdS)�
InvalidBugUrlzInvalid bug URL: %(url)scCs
||_dSr)r)rrrrr
r�szInvalidBugUrl.__init__Nrrrrr
r�src@seZdZdZdd�ZdS)�InvalidBugStatusz Invalid bug status: '%(status)s'cCs
||_dSr)�status)rrrrr
r�szInvalidBugStatus.__init__Nrrrrr
r�srcCst�||�}|�|�S)z[Return a URL pointing to the canonical web page of the bug identified by
    'bug_id'.
    )�tracker_registry�get_tracker�get_bug_url)�abbreviated_bugtracker_namerr	�trackerrrr
r �sr c@s eZdZdZdd�Zdd�ZdS)�TrackerRegistryzRegistry of bug tracker types.cCsB|��D]*}|�|�}|�||�}|dur|Sqt||��dS)z�Return the first registered tracker that understands
        'abbreviated_bugtracker_name'.

        If no such tracker is found, raise KeyError.
        N)�keys�getr)rr!rZtracker_nameZtracker_typer"rrr
r�s

�zTrackerRegistry.get_trackercCstSr)�
_bugs_help)rZtopicrrr
�
help_topic�szTrackerRegistry.help_topicN)rrr�__doc__rr'rrrr
r#�sr#c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
BugTrackerzBase class for bug trackers.cCsdS)zmCheck that the bug_id is valid.

        The base implementation assumes that all bug_ids are valid.
        Nr�rr	rrr
�check_bug_id�szBugTracker.check_bug_idcCs|�|�|�|�S)zAReturn the URL for bug_id. Raise an error if bug ID is malformed.)r+�_get_bug_urlr*rrr
r �s
zBugTracker.get_bug_urlcCsdS)�:Given a validated bug_id, return the bug's web page's URL.Nrr*rrr
r,�szBugTracker._get_bug_urlN)rrrr(r+r r,rrrr
r)�sr)c@seZdZdZdd�ZdS)�IntegerBugTrackerz/A bug tracker that only allows integer bug IDs.cCs.zt|�Wnty(t|d��Yn0dS)NzMust be an integer)�int�
ValueErrorrr*rrr
r+szIntegerBugTracker.check_bug_idN)rrrr(r+rrrr
r.sr.c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�UniqueIntegerBugTrackeraA style of bug tracker that exists in one place only, such as Launchpad.

    If you have one of these trackers then register an instance passing in an
    abbreviated name for the bug tracker and a base URL. The bug ids are
    appended directly to the URL.
    cCs||_||_dSr)r�base_url�rr!r2rrr
rsz UniqueIntegerBugTracker.__init__cCs||jkrdS|S�zMReturns the tracker if the abbreviation matches, otherwise ``None``.
        N�r�rr!rrrr
r%s
zUniqueIntegerBugTracker.getcCs|jt|�S)zReturn the URL for bug_id.)r2�strr*rrr
r,sz$UniqueIntegerBugTracker._get_bug_urlN)rrrr(rr%r,rrrr
r1
sr1c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�ProjectIntegerBugTrackeraA bug tracker that exists in one place only with per-project ids.

    If you have one of these trackers then register an instance passing in an
    abbreviated name for the bug tracker and a base URL. The bug ids are
    appended directly to the URL.
    cCs||_||_dSr)r�	_base_urlr3rrr
r*sz!ProjectIntegerBugTracker.__init__cCs||jkrdS|Sr4r5r6rrr
r%.s
zProjectIntegerBugTracker.getcCs`z|�dd�\}}Wnty0t|d��Yn0zt|�WntyZt|d��Yn0dS)N�/rzExpected format: project/idzBug id must be an integer)�rsplitr0rr/�rr	Zprojectrrr
r+5sz%ProjectIntegerBugTracker.check_bug_idcCsZ|�dd�\}}d|jvr(t|j|j��d|jvr@t|j|j��|j�d|��dt|��S)Nr:r�{id}z	{project})r;r9r�
_abbreviation�replacer7r<rrr
r,?s

��z%ProjectIntegerBugTracker._get_bug_urlN)rrrr(rr%r+r,rrrr
r8"s

r8Z	launchpadZlpzhttps://launchpad.net/bugs/ZdebianZdebzhttp://bugs.debian.org/Zgnomez*http://bugzilla.gnome.org/show_bug.cgi?id=Zgithubz(https://github.com/{project}/issues/{id}c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�URLParametrizedBugTrackeraFA type of bug tracker that can be found on a variety of different sites,
    and thus needs to have the base URL configured.

    Looks for a config setting in the form '<type_name>_<abbreviation>_url'.
    `type_name` is the name of the type of tracker and `abbreviation`
    is a short name for the particular instance.
    cCs6|��}|jd|j|fdd�}|dur,dS||_|S)Nz	%s_%s_urlF)�expand)Z
get_configZget_user_option�	type_namer9)rrrZconfigrrrr
r%es�zURLParametrizedBugTracker.getcCs||_||_dSr)rB�	_bug_area)rrBZbug_arearrr
rnsz"URLParametrizedBugTracker.__init__cCst�|j|j�t|�S)z-Return a URL for a bug on this Trac instance.)Zurlutils�joinr9rCr7r*rrr
r,rsz&URLParametrizedBugTracker._get_bug_urlN)rrrr(r%rr,rrrr
r@\s	r@c@seZdZdZdS)� URLParametrizedIntegerBugTrackera�A type of bug tracker that  only allows integer bug IDs.

    This can be found on a variety of different sites, and thus needs to have
    the base URL configured.

    Looks for a config setting in the form '<type_name>_<abbreviation>_url'.
    `type_name` is the name of the type of tracker (e.g. 'bugzilla' or 'trac')
    and `abbreviation` is a short name for the particular instance (e.g.
    'squid' or 'apache').
    N)rrrr(rrrr
rEwsrEZtraczticket/Zbugzillazshow_bug.cgi?id=cs4eZdZdZ�fdd�Z�fdd�Zdd�Z�ZS)�GenericBugTrackerz1Generic bug tracker specified by an URL template.cstt|��dd�dS)NZ
bugtracker)�superrFr)r��	__class__rr
r�szGenericBugTracker.__init__cs||_tt|��||�Sr)r>rGrFr%rrHrr
r%�szGenericBugTracker.getcCs*d|jvrt|j|j��|j�dt|��S)r-r=)r9rr>r?r7r*rrr
r,�s
zGenericBugTracker._get_bug_url)rrrr(rr%r,�
__classcell__rrrHr
rF�srFZgenericZfixedZrelatedcCs>g}|D]*\}}d|vr t|��|�d||f�qd�|�S)aGet the revision property value for a commit that fixes bugs.

    :param bug_urls: An iterable of (escaped URL, tag) tuples. These normally
        come from `get_bug_url`.
    :return: A string that will be set as the 'bugs' property of a revision
        as part of a commit.
    � z%s %s�
)r�appendrD)Zbug_urls�linesr�tagrrr
�encode_fixes_bug_urls�srPc	cs\|��D]N}z|�dd�\}}Wnty:t|��Yn0|tvrLt|��||fVqdS)z�Decode a bug property text.

    :param bug_text: Contents of a bugs property
    :return: iterator over (url, status) tuples
    N�)�
splitlines�splitr0r�ALLOWED_BUG_STATUSESr)Zbug_textrrrrrr
�decode_bug_urls�srUN)!Z
__future__r�rrr�globalsr&ZBzrErrorrrrrrrr ZRegistryr#r�objectr)r.r1r8�registerr@rErFZFIXEDZRELATEDrTrPrUrrrr
�<module>sfj



(
�
������
��