class documentation

class PatchSeries(list):

View In Hierarchy

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

Class Method read_series_file Read a series file into Patch objects
Class Variable comment_re Undocumented
Class Variable level_re Undocumented
Class Method _parse_line Parse a single line from a series file
Class Method _read_series Read patch series
Class Method _split_strip Separate the -p<num> option from the patch name
Class Method _strip_comment Strip a comment from a series file line
Static Method _get_topic Get the topic from the patch's path
@classmethod
def read_series_file(cls, seriesfile):

Read a series file into Patch objects

comment_re =

Undocumented

level_re =

Undocumented

@classmethod
def _parse_line(cls, line, patch_dir):

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' >
@classmethod
def _read_series(cls, series, patch_dir):

Read patch series

>>> PatchSeries._read_series(['a/b',
...                           'a -p1 # comment',
...                           '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 stringsseries of patches in quilt format
patch_dir:stringpath prefix to prepend to each patch path
@classmethod
def _split_strip(cls, line):

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)
@classmethod
def _strip_comment(cls, line):

Strip a comment from a series file line

>>> PatchSeries._strip_comment("does/not matter")
'does/not matter'
>>> PatchSeries._strip_comment("remove/the  # comment # text")
'remove/the'
>>> PatchSeries._strip_comment("leave/level/intact -p1 # comment # text")
'leave/level/intact -p1'
@staticmethod
def _get_topic(line):

Get the topic from the patch's path

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