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
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)
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
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)
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
def do_end(self): raise errors.NoSuchFile('xyzzy')
def do_chunk(self, bytes): raise errors.NoSuchFile('xyzzy')
def test_NoSuchFile(self): self.assertTranslationEqual( (b'NoSuchFile', b'path'), errors.NoSuchFile('path'))