예제 #1
0
 def find_previous_path(from_tree, to_tree, path):
     file_id = from_tree.path2id(path)
     if file_id is None:
         raise errors.NoSuchFile(path)
     try:
         return to_tree.id2path(file_id)
     except errors.NoSuchId:
         return None
예제 #2
0
 def get_file_revision(self, path):
     utf8_path = path.encode("utf-8")
     if utf8_path in self._manifest:
         # it's a file
         return self._get_file_last_modified_cl(utf8_path)
     elif self._has_directory(utf8_path):
         return self._get_dir_last_modified(utf8_path)
     else:
         raise errors.NoSuchFile(path)
예제 #3
0
def get_recipe_from_launchpad(username, recipe_name, location):
    """Load a recipe from Launchpad.

    :param username: The launchpad user name
    :param recipe_name: Recipe name
    :param location: Original location (used for error reporting)
    :return: Text of the recipe
    """
    from launchpadlib.launchpad import Launchpad
    lp = Launchpad.login_with("bzr-builder", "production")
    try:
        person = lp.people[username]
    except KeyError:
        raise errors.NoSuchFile(location,
                                "No such Launchpad user %s" % username)
    recipe = person.getRecipe(name=recipe_name)
    if recipe is None:
        raise errors.NoSuchFile(
            location,
            "Launchpad user %s has no recipe %s" % (username, recipe_name))
    return recipe.recipe_text
예제 #4
0
 def get_file_text(self, path):
     revlog = self._repository._hgrepo.file(path)
     try:
         return revlog.read(self._manifest[path.encode("utf-8")])
     except KeyError:
         raise errors.NoSuchFile(path)
예제 #5
0
파일: tree.py 프로젝트: jelmer/breezy-svn
 def kind(self, path, file_id=None):
     if file_id is None:
         file_id = self.path2id(path)
     if file_id is None:
         raise errors.NoSuchFile(path, self)
     return self.root_inventory.get_entry(file_id).kind
예제 #6
0
 def do_end(self):
     raise errors.NoSuchFile('xyzzy')
예제 #7
0
 def do_chunk(self, bytes):
     raise errors.NoSuchFile('xyzzy')
예제 #8
0
 def test_NoSuchFile(self):
     self.assertTranslationEqual(
         (b'NoSuchFile', b'path'), errors.NoSuchFile('path'))