-=[ Mr. Bumblebee ]=-
_Indonesia_
ó
î:ïNc @@ s¨ d Z d d l m Z d d l Z d d l m Z m Z e j d ƒ Z d Z d e
f d „ ƒ YZ d e f d
„ ƒ YZ d e f d „ ƒ YZ
d d
„ Z d „ Z d S( s« View management.
Views are contained within a working tree and normally constructed
when first accessed. Clients should do, for example, ...
tree.views.lookup_view()
i ( t absolute_importN( t errorst osutilss Bazaar views format (\d+)s Bazaar views format 1
t _Viewsc B@ s e Z d Z d „ Z RS( s Base class for View managers.c C@ s t | j ƒ ‚ d S( N( t NotImplementedErrort supports_views( t self( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyR * s ( t __name__t
__module__t __doc__R ( ( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyR ' s t PathBasedViewsc B@ sw e Z d Z d „ Z d „ Z d „ Z d „ Z d d „ Z e d „ Z
d „ Z d „ Z d „ Z
d
„ Z d „ Z RS(
sÔ View storage in an unversioned tree control file.
Views are stored in terms of paths relative to the tree root.
The top line of the control file is a format marker in the format:
Bazaar views format X
where X is an integer number. After this top line, version 1 format is
stored as follows:
* optional name-values pairs in the format 'name=value'
* optional view definitions, one per line in the format
views:
name file1 file2 ...
name file1 file2 ...
where the fields are separated by a nul character ( ). The views file
is encoded in utf-8. The only supported keyword in version 1 is
'current' which stores the name of the current view, if any.
c C@ s( | | _ t | _ d | _ i | _ d S( N( t treet Falset _loadedt Nonet _currentt _views( R R ( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyt __init__G s c C@ s t S( N( t True( R ( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyR M s c C@ s | j ƒ | j | j f S( sð Get the current view and dictionary of views.
:return: current, views where
current = the name of the current view or None if no view is enabled
views = a map from view name to list of files/directories
( t _load_view_infoR R ( R ( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyt
get_view_infoP s
c C@ sl | d k r* | | k r* t j | ƒ ‚ n | j j ƒ z | | _ | | _ | j ƒ Wd | j j ƒ Xd S( sÜ Set the current view and dictionary of views.
:param current: the name of the current view or None if no view is
enabled
:param views: a map from view name to list of files/directories
N( R R t
NoSuchViewR t
lock_writeR R t _save_view_infot unlock( R t currentt views( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyt
set_view_infoZ s
c C@ sh | j ƒ y7 | d k r5 | j r. | j } q5 g Sn | j | SWn t k
rc t j | ƒ ‚ n Xd S( s» Return the contents of a view.
:param view_Name: name of the view or None to lookup the current view
:return: the list of files/directories in the requested view
N( R R R R t KeyErrorR R ( R t view_name( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyt lookup_viewk s
c C@ sY | j j ƒ z7 | j ƒ | | j | <| r9 | | _ n | j ƒ Wd | j j ƒ Xd S( sá Add or update a view definition.
:param view_name: the name of the view
:param view_files: the list of files/directories in the view
:param make_current: make this view the current one or not
N( R R R R R R R ( R R t
view_filest make_current( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyt set_view| s
c C@ s† | j j ƒ zd | j ƒ y | j | =Wn t k
rJ t j | ƒ ‚ n X| | j k rf d | _ n | j ƒ Wd | j j
ƒ Xd S( sn Delete a view definition.
If the view deleted is the current one, the current view is reset.
N( R R R R R R R R R R R ( R R ( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyt delete_view s
c C@ ss | j j ƒ zQ | j d k r( i } n i | j d 6} | j j j d | j | | j ƒ ƒ Wd | j j ƒ Xd S( sŸ Save the current view and all view definitions.
Be sure to have initialised self._current and self._views before
calling this method.
R R N( R R R R t
_transportt put_bytest _serialize_view_contentR R ( R t keywords( ( s0 /usr/lib/python2.7/dist-packages/bzrlib/views.pyR Ÿ s
c C@ sª | j s¦ | j j ƒ zs y | j j j d ƒ } Wn) t j k
r] } d i | _ | _ n+ X| j
| ƒ \ } | _ | j d ƒ | _ Wd | j j ƒ Xt
| _ n d S( s9 Load the current view and dictionary of view definitions.R R N( R
R t lock_readR# t get_bytesR t
NoSuchFileR R R t _deserialize_view_contentt getR R ( R t view_contentt eR&