Package gbp :: Module pq :: Class PatchQueue
[hide private]
[frames] | no frames]

Class PatchQueue

object --+    
         |    
      list --+
             |
            PatchQueue

A series of Patches (e.g. 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 patch file
Static Methods [hide private]
 
_get_topic(line)
Get the topic from the path'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

>>> PatchQueue._read_series(['a/b',                             'a -p1',                             'a/b -p2'], '.') # doctest:+NORMALIZE_WHITESPACE
[<gbp.pq.Patch path='./a/b' topic='a' >,
 <gbp.pq.Patch path='./a' strip=1 >,
 <gbp.pq.Patch path='./a/b' topic='a' strip=2 >]
>>> PatchQueue._read_series(['# foo', 'a/b', '', '# bar'], '.')
[<gbp.pq.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 path's path

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

_split_strip(line)
Static Method

 

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

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

_parse_line(klass, line, patch_dir)
Class Method

 

Parse a single line from a patch file

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