             diagnostics.emit(error)
         }
     }
-    
-    /// Throwing version of edit
-    private func _edit(
-        dependency: ManagedDependency,
-        packageName: String,
-        diagnostics: DiagnosticsEngine,
-        path: AbsolutePath? = nil,
-        revision: Revision? = nil,
-        checkoutBranch: String? = nil
-    ) throws {
-        // Check if we can edit this dependency.
-        guard case .checkout(let checkoutState) = dependency.state else {
-            throw WorkspaceDiagnostics.DependencyAlreadyInEditMode(dependencyURL: dependency.repository.url)
-        }
-
-        // If a path is provided then we use it as destination. If not, we
-        // use the folder with packageName inside editablesPath.
-        let destination = path ?? editablesPath.appending(component: packageName)
-
-        // If there is something present at the destination, we confirm it has
-        // a valid manifest with name same as the package we are trying to edit.
-        if fileSystem.exists(destination) {
-            let manifest = try loadManifest(packagePath: destination, url: dependency.repository.url, version: nil)
-            
-            guard manifest.name == packageName else {
-                throw WorkspaceDiagnostics.MismatchingDestinationPackage(
-                    editPath: destination,
-                    expectedPackage: packageName,
-                    destinationPackage: manifest.name)
-            }
-
-            // Emit warnings for branch and revision, if they're present.
-            if let checkoutBranch = checkoutBranch {
-                delegate.warning(message: "not checking out branch '\(checkoutBranch)' for dependency '\(packageName)'")
-            }
-            if let revision = revision {
-                delegate.warning(message: "not using revsion '\(revision.identifier)' for dependency '\(packageName)'")
-            }
-        } else {
-            // Otherwise, create a checkout at the destination from our repository store.
-            //
-            // Get handle to the repository.
-            let handle = try repositoryManager.lookupSynchronously(repository: dependency.repository)
-            let repo = try handle.open()
-
-            // Do preliminary checks on branch and revision, if provided.
-            if let branch = checkoutBranch, repo.exists(revision: Revision(identifier: branch)) {
-                throw WorkspaceDiagnostics.BranchAlreadyExists(
-                    dependencyURL: dependency.repository.url,
-                    branch: branch)
-            }
-            if let revision = revision, !repo.exists(revision: revision) {
-                throw WorkspaceDiagnostics.RevisionDoesNotExist(
-                    dependencyURL: dependency.repository.url,
-                    revision: revision.identifier)
-            }
-
-            try handle.cloneCheckout(to: destination, editable: true)
-            let workingRepo = try repositoryManager.provider.openCheckout(at: destination)
-            try workingRepo.checkout(revision: revision ?? checkoutState.revision)
-
-            // Checkout to the new branch if provided.
-            if let branch = checkoutBranch {
-                try workingRepo.checkout(newBranch: branch)
-            }
-        }
-
-        // For unmanaged dependencies, create the symlink under editables dir.
-        if let path = path {
-            try fileSystem.createDirectory(editablesPath)
-            // FIXME: We need this to work with InMem file system too.
-            try createSymlink(
-                editablesPath.appending(component: packageName),
-                pointingAt: path,
-                relative: false)
-        }
-
-        // Save the new state.
-        managedDependencies[dependency.repository] = dependency.editedDependency(
-            subpath: RelativePath(packageName), unmanagedPath: path)
-        try managedDependencies.saveState()
-    }
 
     /// Ends the edit mode of a dependency which is in edit mode.
     ///

        // Save the state.
        try managedDependencies.saveState()
    }

    /// Loads and returns manifests at the given paths.
    public func loadRootManifests(
        packages: [AbsolutePath],
        diagnostics: DiagnosticsEngine
    ) -> [Manifest] {

        func load(_ package: AbsolutePath) throws -> Manifest {
            let toolsVersion = try toolsVersionLoader.load(at: package, fileSystem: fileSystem)
            guard currentToolsVersion >= toolsVersion else {
                throw WorkspaceDiagnostics.IncompatibleToolsVersion(
                    rootPackagePath: package,
                    requiredToolsVersion: toolsVersion,
                    currentToolsVersion: currentToolsVersion)
            }
            return try manifestLoader.load(
                package: package, baseURL: package.asString, manifestVersion: toolsVersion.manifestVersion)
        }

        var manifests = [Manifest]()
        for package in packages {
            do {
                try manifests.append(load(package))
            } catch {
                diagnostics.emit(error)
            }
        }
        return manifests
    }

    /// Loads the given manifest, if it is present in the managed dependencies.
    private func loadManifest(forDependencyURL url: String) -> Manifest? {
        // Check if this dependency is available.
        guard let managedDependency = managedDependencies[url] else {
            return nil
        }

        // The version, if known.
        let version: Version?
        switch managedDependency.state {
        case .checkout(let checkoutState):
            version = checkoutState.version
        case .edited:
            version = nil
        }

        // Get the path of the package.
        let packagePath = path(for: managedDependency)

        // FIXME: We need to emit errors if this fails (SR-4262).
        return try! loadManifest(
            packagePath: packagePath,
            url: url,
            version: version
        )
    }

    /// Load the manifest at a given path.
    ///
    /// This is just a helper wrapper to the manifest loader.
    private func loadManifest(
        packagePath: AbsolutePath,
        url: String,
        version: Version?
    ) throws -> Manifest {

        // Load the tools version for the package.
        let toolsVersion = try toolsVersionLoader.load(
            at: packagePath, fileSystem: localFileSystem)

        // Load the manifest.
        // FIXME: We should have a cache for this.
        let manifest: Manifest = try manifestLoader.load(
            package: packagePath,
            baseURL: url,
            version: version,
            manifestVersion: toolsVersion.manifestVersion)
        return manifest
    }
}

/// A result which can be loaded.

            return requiredURLs.subtracting(availableURLs)
        }

        /// Returns constraints of the dependencies.
        fileprivate func createDependencyConstraints() -> [RepositoryPackageConstraint] {
            var constraints = [RepositoryPackageConstraint]()
            // Iterate and add constraints from dependencies.
            for (externalManifest, managedDependency) in dependencies {
