mirror of
https://github.com/rust-lang/cargo
synced 2024-07-21 01:54:35 +00:00
Remove the update_remotes flag entirely
This will inadvertently fix #337 as no lockfile will imply that all dependencies are not precise, and will hence be fetched.
This commit is contained in:
parent
e219167738
commit
f51a2f9234
|
@ -34,6 +34,6 @@ fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
|
|||
shell.set_verbose(options.flag_verbose);
|
||||
let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
|
||||
|
||||
ops::generate_lockfile(&root, shell, true)
|
||||
ops::generate_lockfile(&root, shell)
|
||||
.map(|_| None).map_err(|err| CliError::from_boxed(err, 101))
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
|
|||
|
||||
let source_id = SourceId::for_git(&url, reference.as_slice(), None);
|
||||
|
||||
let mut config = try!(Config::new(shell, true, None, None).map_err(|e| {
|
||||
let mut config = try!(Config::new(shell, None, None).map_err(|e| {
|
||||
CliError::from_boxed(e, 1)
|
||||
}));
|
||||
let mut source = GitSource::new(&source_id, &mut config);
|
||||
|
|
|
@ -52,7 +52,7 @@ pub fn compile(manifest_path: &Path,
|
|||
|
||||
log!(4, "compile; manifest-path={}", manifest_path.display());
|
||||
|
||||
if options.update {
|
||||
if update {
|
||||
return Err(human("The -u flag has been deprecated, please use the \
|
||||
`cargo update` command instead"));
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ pub fn compile(manifest_path: &Path,
|
|||
let lockfile = manifest_path.dir_path().join("Cargo.lock");
|
||||
let source_id = package.get_package_id().get_source_id();
|
||||
|
||||
let mut config = try!(Config::new(*shell, update, jobs, target.clone()));
|
||||
let mut config = try!(Config::new(*shell, jobs, target.clone()));
|
||||
let mut registry = PackageRegistry::new(&mut config);
|
||||
|
||||
match try!(ops::load_lockfile(&lockfile, source_id)) {
|
||||
|
@ -117,7 +117,7 @@ pub fn compile(manifest_path: &Path,
|
|||
|
||||
let ret = {
|
||||
let _p = profile::start("compiling");
|
||||
let mut config = try!(Config::new(*shell, update, jobs, target));
|
||||
let mut config = try!(Config::new(*shell, jobs, target));
|
||||
try!(scrape_target_config(&mut config, &user_configs));
|
||||
|
||||
try!(ops::compile_targets(env.as_slice(), targets.as_slice(), &package,
|
||||
|
|
|
@ -15,8 +15,7 @@ use util::{CargoResult, human};
|
|||
use cargo_toml = util::toml;
|
||||
|
||||
pub fn generate_lockfile(manifest_path: &Path,
|
||||
shell: &mut MultiShell,
|
||||
update: bool)
|
||||
shell: &mut MultiShell)
|
||||
-> CargoResult<()> {
|
||||
|
||||
log!(4, "compile; manifest-path={}", manifest_path.display());
|
||||
|
@ -31,7 +30,7 @@ pub fn generate_lockfile(manifest_path: &Path,
|
|||
let source_ids = package.get_source_ids();
|
||||
|
||||
let resolve = {
|
||||
let mut config = try!(Config::new(shell, update, None, None));
|
||||
let mut config = try!(Config::new(shell, None, None));
|
||||
|
||||
let mut registry = PackageRegistry::new(&mut config);
|
||||
try!(registry.add_sources(source_ids));
|
||||
|
@ -58,7 +57,7 @@ pub fn update_lockfile(manifest_path: &Path,
|
|||
None => return Err(human("A Cargo.lock must exist before it is updated"))
|
||||
};
|
||||
|
||||
let mut config = try!(Config::new(shell, true, None, None));
|
||||
let mut config = try!(Config::new(shell, None, None));
|
||||
let mut registry = PackageRegistry::new(&mut config);
|
||||
|
||||
let sources = match to_update {
|
||||
|
|
|
@ -159,7 +159,8 @@ impl<'a, 'b> Source for GitSource<'a, 'b> {
|
|||
fn update(&mut self) -> CargoResult<()> {
|
||||
let actual_rev = self.remote.rev_for(&self.db_path,
|
||||
self.reference.as_slice());
|
||||
let should_update = self.config.update_remotes() || actual_rev.is_err();
|
||||
let should_update = actual_rev.is_err() ||
|
||||
self.source_id.precise.is_none();
|
||||
|
||||
let (repo, actual_rev) = if should_update {
|
||||
try!(self.config.shell().status("Updating",
|
||||
|
|
|
@ -9,7 +9,6 @@ use cargo_toml = util::toml;
|
|||
|
||||
pub struct Config<'a> {
|
||||
home_path: Path,
|
||||
update_remotes: bool,
|
||||
shell: &'a mut MultiShell,
|
||||
jobs: uint,
|
||||
target: Option<String>,
|
||||
|
@ -19,7 +18,6 @@ pub struct Config<'a> {
|
|||
|
||||
impl<'a> Config<'a> {
|
||||
pub fn new<'a>(shell: &'a mut MultiShell,
|
||||
update_remotes: bool,
|
||||
jobs: Option<uint>,
|
||||
target: Option<String>) -> CargoResult<Config<'a>> {
|
||||
if jobs == Some(0) {
|
||||
|
@ -30,7 +28,6 @@ impl<'a> Config<'a> {
|
|||
human("Cargo couldn't find your home directory. \
|
||||
This probably means that $HOME was not set.")
|
||||
})),
|
||||
update_remotes: update_remotes,
|
||||
shell: shell,
|
||||
jobs: jobs.unwrap_or(os::num_cpus()),
|
||||
target: target,
|
||||
|
@ -53,10 +50,6 @@ impl<'a> Config<'a> {
|
|||
&mut *self.shell
|
||||
}
|
||||
|
||||
pub fn update_remotes(&mut self) -> bool {
|
||||
self.update_remotes
|
||||
}
|
||||
|
||||
pub fn jobs(&self) -> uint {
|
||||
self.jobs
|
||||
}
|
||||
|
|
|
@ -665,7 +665,7 @@ test!(update_with_shared_deps {
|
|||
git_project.url())));
|
||||
|
||||
// Make sure we still only compile one version of the git repo
|
||||
assert_that(p.cargo_process("cargo-build"),
|
||||
assert_that(p.process(cargo_dir().join("cargo-build")),
|
||||
execs().with_stdout(format!("\
|
||||
{compiling} bar v0.5.0 ({git}#[..])
|
||||
{compiling} [..] v0.5.0 ({dir})
|
||||
|
@ -727,3 +727,69 @@ test!(dep_with_submodule {
|
|||
COMPILING, root))
|
||||
.with_stderr(""));
|
||||
})
|
||||
|
||||
test!(two_deps_only_update_one {
|
||||
let project = project("foo");
|
||||
let git1 = git_repo("dep1", |project| {
|
||||
project
|
||||
.file("Cargo.toml", r#"
|
||||
[package]
|
||||
name = "dep1"
|
||||
version = "0.5.0"
|
||||
authors = ["carlhuda@example.com"]
|
||||
"#)
|
||||
.file("src/lib.rs", "")
|
||||
}).assert();
|
||||
let git2 = git_repo("dep2", |project| {
|
||||
project
|
||||
.file("Cargo.toml", r#"
|
||||
[package]
|
||||
name = "dep2"
|
||||
version = "0.5.0"
|
||||
authors = ["carlhuda@example.com"]
|
||||
"#)
|
||||
.file("src/lib.rs", "")
|
||||
}).assert();
|
||||
|
||||
let project = project
|
||||
.file("Cargo.toml", format!(r#"
|
||||
[project]
|
||||
|
||||
name = "foo"
|
||||
version = "0.5.0"
|
||||
authors = ["wycats@example.com"]
|
||||
|
||||
[dependencies.dep1]
|
||||
git = '{}'
|
||||
[dependencies.dep2]
|
||||
git = '{}'
|
||||
"#, git1.url(), git2.url()))
|
||||
.file("src/main.rs", "fn main() {}");
|
||||
|
||||
assert_that(project.cargo_process("cargo-build"),
|
||||
execs()
|
||||
.with_stdout(format!("{} git repository `[..]`\n\
|
||||
{} git repository `[..]`\n\
|
||||
{} [..] v0.5.0 ([..])\n\
|
||||
{} [..] v0.5.0 ([..])\n\
|
||||
{} foo v0.5.0 ({})\n",
|
||||
UPDATING,
|
||||
UPDATING,
|
||||
COMPILING,
|
||||
COMPILING,
|
||||
COMPILING, project.url()))
|
||||
.with_stderr(""));
|
||||
|
||||
File::create(&git1.root().join("src/lib.rs")).write_str(r#"
|
||||
pub fn foo() {}
|
||||
"#).assert();
|
||||
git1.process("git").args(["add", "."]).exec_with_output().assert();
|
||||
git1.process("git").args(["commit", "-m", "test"]).exec_with_output()
|
||||
.assert();
|
||||
|
||||
assert_that(project.process(cargo_dir().join("cargo-update")).arg("dep1"),
|
||||
execs()
|
||||
.with_stdout(format!("{} git repository `{}`\n",
|
||||
UPDATING, git1.url()))
|
||||
.with_stderr(""));
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue