Exemplo n.º 1
0
 def refresh_view(self):
     """Update the data in the view."""
     plugins = mod_plugin.plugins()
     summary_data = []
     locations_data = []
     for name in sorted(plugins):
         plugin = plugins[name]
         version = format_plugin_version(plugin)
         description = format_plugin_description(plugin)
         directory = osutils.dirname(plugin.path())
         summary_data.append((name, version, description))
         locations_data.append((name, directory))
     self._summary_viewer.setData(summary_data)
     self._locations_viewer.setData(locations_data)
Exemplo n.º 2
0
 def _entries_to_incorporate(self):
     """Yields pairs of (inventory_entry, new_parent)."""
     other_inv = self.other_tree.inventory
     subdir_id = other_inv.path2id(self._source_subpath)
     if subdir_id is None:
         # XXX: The error would be clearer if it gave the URL of the source
         # branch, but we don't have a reference to that here.
         raise PathNotInTree(self._source_subpath, "Source tree")
     subdir = other_inv[subdir_id]
     parent_in_target = osutils.dirname(self._target_subdir)
     target_id = self.this_tree.inventory.path2id(parent_in_target)
     if target_id is None:
         raise PathNotInTree(self._target_subdir, "Target tree")
     name_in_target = osutils.basename(self._target_subdir)
     merge_into_root = subdir.copy()
     merge_into_root.name = name_in_target
     if merge_into_root.file_id in self.this_tree.inventory:
         # Give the root a new file-id.
         # This can happen fairly easily if the directory we are
         # incorporating is the root, and both trees have 'TREE_ROOT' as
         # their root_id.  Users will expect this to Just Work, so we
         # change the file-id here.
         # Non-root file-ids could potentially conflict too.  That's really
         # an edge case, so we don't do anything special for those.  We let
         # them cause conflicts.
         merge_into_root.file_id = generate_ids.gen_file_id(name_in_target)
     yield (merge_into_root, target_id)
     if subdir.kind != 'directory':
         # No children, so we are done.
         return
     for ignored_path, entry in other_inv.iter_entries_by_dir(subdir_id):
         parent_id = entry.parent_id
         if parent_id == subdir.file_id:
             # The root's parent ID has changed, so make sure children of
             # the root refer to the new ID.
             parent_id = merge_into_root.file_id
         yield (entry, parent_id)
Exemplo n.º 3
0
# Copyright (C) 2007-2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""ssl_certs -- provides access to ssl keys and certificates needed by tests"""

from breezy import (
    osutils, )

# Directory containing all ssl files, keys or certificates
base_dir = osutils.dirname(osutils.realpath(__file__))


def build_path(name):
    """Build and return a path in ssl_certs directory for name"""
    return osutils.pathjoin(base_dir, name)
Exemplo n.º 4
0
 def test_break_lock(self):
     self.run_bzr('break-lock --config %s' %
                  osutils.dirname(self.config_file_name),
                  stdin="y\n")
     self.assertRaises(errors.LockBroken, self.config.unlock)