gbp.patch_series.PatchSeries(list) class documentationgbp.patch_series
(View In Hierarchy)
A series of L{Patch}es as read from a quilt series file).
| Class Method | read_series_file | Read a series file into L{Patch} objects |
| Class Method | _read_series | Read patch series |
| Static Method | _get_topic | Get the topic from the patch's path |
| Class Method | _strip_comment | Strip a comment from a series file line |
| Class Method | _split_strip | Separate the -p<num> option from the patch name |
| Class Method | _parse_line | Parse a single line from a series file |
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' >] @param series: series of patches in quilt format @type series: iterable of strings @param patch_dir: path prefix to prepend to each patch path @type patch_dir: string
Get the topic from the patch's path
>>> PatchSeries._get_topic("a/b c")
'a'
>>> PatchSeries._get_topic("asdf")
>>> PatchSeries._get_topic("/asdf")
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'
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 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' >