Package gbp :: Module patch_series :: Class PatchSeries

[hide private]
[frames] | no frames]

# Class PatchSeries

    object --+
             |
          list --+
                 |
                PatchSeries

A series of Patches as read from a quilt series file).

Instance Methods | [hide private]

Inherited from `list`: `__add__`, `__contains__`, `__delitem__`, `__delslice__`, `__eq__`, `__ge__`, `__getattribute__`, `__getitem__`, `__getslice__`, `__gt__`, `__iadd__`, `__imul__`, `__init__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__mul__`, `__ne__`, `__new__`, `__repr__`, `__reversed__`, `__rmul__`, `__setitem__`, `__setslice__`, `__sizeof__`, `append`, `count`, `extend`, `index`, `insert`, `pop`, `remove`, `reverse`, `sort`

Inherited from `object`: `__delattr__`, `__format__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__str__`, `__subclasshook__`

Class Methods | [hide private]

read_series_file(klass, seriesfile) Read a series file into Patch objects |

_read_series(klass, series, patch_dir) Read patch series |

_parse_line(klass, line, patch_dir) Parse a single line from a series file |

Static Methods | [hide private]

_get_topic(line) Get the topic from the patch's path |

_split_strip(line) Separate the -p<num> option from the patch name |

Class Variables | [hide private]

Inherited from `list`: `__hash__`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### _read_series(klass, series, patch_dir)
Class Method

Read patch series

    >>> PatchSeries._read_series(['a/b',                             'a -p1',                             'a/b -p2'], '.') # doctest:+NORMALIZE_WHITESPACE
    [<gbp.patch_series.Patch path='./a/b' topic='a' >,
     <gbp.patch_series.Patch path='./a' strip=1 >,
     <gbp.patch_series.Patch path='./a/b' topic='a' strip=2 >]

    >>> PatchSeries._read_series(['# foo', 'a/b', '', '# bar'], '.')
    [<gbp.patch_series.Patch path='./a/b' topic='a' >]

Parameters:
  - `series` (iterable of strings) - series of patches in quilt format
  - `patch_dir` (string) - path prefix to prepend to each patch path

### _get_topic(line)
Static Method

Get the topic from the patch's path

    >>> PatchSeries._get_topic("a/b c")
    'a'
    >>> PatchSeries._get_topic("asdf")
    >>> PatchSeries._get_topic("/asdf")

### _split_strip(line)
Static Method

Separate the -p<num> option from the patch name

    >>> PatchSeries._split_strip("asdf -p1")
    ('asdf', 1)
    >>> PatchSeries._split_strip("a/nice/patch")
    ('a/nice/patch', None)
    >>> PatchSeries._split_strip("asdf foo")
    ('asdf foo', None)

### _parse_line(klass, line, patch_dir)
Class Method

Parse a single line from a series file

    >>> PatchSeries._parse_line("a/b -p1", '/tmp/patches')
    <gbp.patch_series.Patch path='/tmp/patches/a/b' topic='a' strip=1 >
    >>> PatchSeries._parse_line("a/b", '.')
    <gbp.patch_series.Patch path='./a/b' topic='a' >