Package gbp :: Module patch_series :: Class Patch

[hide private]
[frames] | no frames]

# Class Patch

    object --+
             |
            Patch

A patch in a PatchSeries

Instance Methods | [hide private]

__init__(self, path, topic=None, strip=None) x.__init__(...) initializes x; see help(type(x)) for signature |

__repr__(self) repr(x) |

_read_info(self) Read patch information into a structured form |

`str`

_get_subject_from_filename(self) Determine the patch's subject based on the its filename |

_get_info_field(self, key, get_val=None) Return the key key from the info `dict` or use val if key is not a valid key. |

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]

| patch_exts = ``[``'``diff``'``,` `'``patch``'``]``

Instance Variables | [hide private]

`dict` with `str` keys and values | info Information retrieved from a RFC822 style patch header
| long_desc the long description of the patch
string | path path to the patch
integer | strip path components to strip (think patch -p<strip>)
string | topic the topic of the patch (the directory component)

Properties | [hide private]

| subject The patch's subject, either from the patch header or from the filename.
| author The patch's author
| email The patch author's email address
| date The patch's modification time
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, path, topic=None, strip=None)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### __repr__(self)
(Representation operator)

repr(x)

Overrides: object.__repr__
  (inherited documentation)

### _read_info(self)

Read patch information into a structured form

using git mailinfo

### _get_subject_from_filename(self)

Determine the patch's subject based on the its filename

    >>> p = Patch('debian/patches/foo.patch')
    >>> p._get_subject_from_filename()
    'foo'
    >>> Patch('foo.patch')._get_subject_from_filename()
    'foo'
    >>> Patch('debian/patches/foo.bar')._get_subject_from_filename()
    'foo.bar'
    >>> p = Patch('debian/patches/foo')
    >>> p._get_subject_from_filename()
    'foo'
    >>> Patch('0123-foo.patch')._get_subject_from_filename()
    'foo'
    >>> Patch('0123.patch')._get_subject_from_filename()
    '0123'
    >>> Patch('0123-foo-0123.patch')._get_subject_from_filename()
    'foo-0123'

Returns: `str`
  the patch's subject

### _get_info_field(self, key, get_val=None)

Return the key key from the info `dict` or use val if key is not a valid key.

Fill self.info if not already done.

Parameters:
  - `key` (`str`) - key to fetch
  - `get_val` (`str`) - alternate value if key is not in info dict

Property Details | [hide private]

### subject

The patch's subject, either from the patch header or from the filename.

Get Method:
  unreachable.subject(self) - The patch's subject, either from the patch header or from the filename.

### author

The patch's author

Get Method:
  unreachable.author(self) - The patch's author

### email

The patch author's email address

Get Method:
  unreachable.email(self) - The patch author's email address

### date

The patch's modification time

Get Method:
  unreachable.date(self) - The patch's modification time