def __init__(self, path, verify_format=True, **kwargs): """Constructs a new project object. path is the path to the working copy. Raises a ValueError exception if path is no valid project working copy. Raises a WCInconsistentError if the wc's metadata is corrupt. Keyword arguments: verify_format -- verify working copy format (default: True) kwargs -- see class WorkingCopy for the details """ if verify_format: wc_verify_format(path) meta, xml_data, pkg_data = self.wc_check(path) if meta or xml_data or pkg_data: raise WCInconsistentError(path, meta, xml_data, pkg_data) self.apiurl = wc_read_apiurl(path) self.name = wc_read_project(path) with wc_lock(path): self._packages = wc_read_packages(path) super(Project, self).__init__(path, ProjectUpdateState, ProjectCommitState, **kwargs)
def __init__(self, path, skip_handlers=None, commit_policies=None, merge_class=Merge, verify_format=True, **kwargs): """Constructs a new package object. path is the path to the working copy. Raises a ValueError exception if path is no valid package working copy. Raises a WCInconsistentError if the wc's metadata is corrupt. Keyword arguments: skip_handlers -- list of FileSkipHandler objects (default: []) commit_policies -- list of FileCommitPolicy objects (default: None) merge_class -- class which is used for a file merge (default: Merge) verify_format -- verify working copy format (default: True) **kwargs -- see class WorkingCopy for the details """ if verify_format: wc_verify_format(path) (meta, xml_data, pkg_data) = self.wc_check(path) if meta or xml_data or pkg_data: raise WCInconsistentError(path, meta, xml_data, pkg_data) self.apiurl = wc_read_apiurl(path) self.project = wc_read_project(path) self.name = wc_read_package(path) self.skip_handlers = skip_handlers or [] self.commit_policies = commit_policies or [] self.merge_class = merge_class with wc_lock(path): self._files = wc_read_files(path) # call super at the end due to finish_pending_transaction super(Package, self).__init__(path, PackageUpdateState, PackageCommitState, **kwargs)