mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Source::update takes mutable self
This commit is contained in:
parent
bcf9028749
commit
c665938dcc
@ -33,7 +33,7 @@ fn execute(options: Options) -> CLIResult<Option<()>> {
|
|||||||
|
|
||||||
let source_id = SourceId::for_git(&url, reference.as_slice());
|
let source_id = SourceId::for_git(&url, reference.as_slice());
|
||||||
|
|
||||||
let source = GitSource::new(&source_id, &try!(Config::new().to_cli(1)));
|
let mut source = GitSource::new(&source_id, &try!(Config::new().to_cli(1)));
|
||||||
|
|
||||||
try!(source.update().map_err(|e| {
|
try!(source.update().map_err(|e| {
|
||||||
CLIError::new(format!("Couldn't update {}: {}", source, e), None::<&str>, 1)
|
CLIError::new(format!("Couldn't update {}: {}", source, e), None::<&str>, 1)
|
||||||
|
@ -72,7 +72,7 @@ impl PackageRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn load(&mut self, namespace: &SourceId, override: bool) -> CargoResult<()> {
|
fn load(&mut self, namespace: &SourceId, override: bool) -> CargoResult<()> {
|
||||||
let source = namespace.load(&try!(Config::new()));
|
let mut source = namespace.load(&try!(Config::new()));
|
||||||
let dst = if override { &mut self.overrides } else { &mut self.summaries };
|
let dst = if override { &mut self.overrides } else { &mut self.summaries };
|
||||||
|
|
||||||
// Ensure the source has fetched all necessary remote data.
|
// Ensure the source has fetched all necessary remote data.
|
||||||
|
@ -14,7 +14,7 @@ pub trait Source {
|
|||||||
* get the entire list of all names, versions and dependencies of
|
* get the entire list of all names, versions and dependencies of
|
||||||
* packages managed by the Source.
|
* packages managed by the Source.
|
||||||
*/
|
*/
|
||||||
fn update(&self) -> CargoResult<()>;
|
fn update(&mut self) -> CargoResult<()>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list method lists all names, versions and dependencies of
|
* The list method lists all names, versions and dependencies of
|
||||||
@ -111,8 +111,8 @@ impl SourceSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Source for SourceSet {
|
impl Source for SourceSet {
|
||||||
fn update(&self) -> CargoResult<()> {
|
fn update(&mut self) -> CargoResult<()> {
|
||||||
for source in self.sources.iter() {
|
for source in self.sources.mut_iter() {
|
||||||
try!(source.update());
|
try!(source.update());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ impl Show for GitSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Source for GitSource {
|
impl Source for GitSource {
|
||||||
fn update(&self) -> CargoResult<()> {
|
fn update(&mut self) -> CargoResult<()> {
|
||||||
println!("Updating git repository `{}`", self.remote.get_url());
|
println!("Updating git repository `{}`", self.remote.get_url());
|
||||||
log!(5, "updating git source `{}`", self.remote);
|
log!(5, "updating git source `{}`", self.remote);
|
||||||
let repo = try!(self.remote.checkout(&self.db_path));
|
let repo = try!(self.remote.checkout(&self.db_path));
|
||||||
|
@ -53,7 +53,7 @@ impl Show for PathSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Source for PathSource {
|
impl Source for PathSource {
|
||||||
fn update(&self) -> CargoResult<()> {
|
fn update(&mut self) -> CargoResult<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user