Skip to content

Commit 6e4ddd3

Browse files
committed
---
yaml --- r: 28586 b: refs/heads/try c: e17a3b3 h: refs/heads/master v: v3
1 parent 5d9abbc commit 6e4ddd3

File tree

2 files changed

+35
-33
lines changed

2 files changed

+35
-33
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 2906f2de31d3a4709a2e028c5cefe3274df1edd2
5+
refs/heads/try: e17a3b3194cc5dc213d13ff6499c93482215c223
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/cargo/cargo.rs

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ fn load_one_source_package(src: source, p: map::HashMap<~str, json::Json>) {
572572
log(debug, ~" loaded package: " + src.name + ~"/" + name);
573573
}
574574
575-
fn load_source_info(c: cargo, src: source) {
575+
fn load_source_info(c: &cargo, src: source) {
576576
let dir = c.sourcedir.push(src.name);
577577
let srcfile = dir.push("source.json");
578578
if !os::path_exists(&srcfile) { return; }
@@ -593,7 +593,7 @@ fn load_source_info(c: cargo, src: source) {
593593
}
594594
};
595595
}
596-
fn load_source_packages(c: cargo, src: source) {
596+
fn load_source_packages(c: &cargo, src: source) {
597597
log(debug, ~"loading source: " + src.name);
598598
let dir = c.sourcedir.push(src.name);
599599
let pkgfile = dir.push("packages.json");
@@ -697,7 +697,7 @@ fn configure(opts: options) -> cargo {
697697

698698
for sources.each_key |k| {
699699
let mut s = sources.get(k);
700-
load_source_packages(c, s);
700+
load_source_packages(&c, s);
701701
sources.insert(k, s);
702702
}
703703

@@ -712,7 +712,7 @@ fn configure(opts: options) -> cargo {
712712
c
713713
}
714714

715-
fn for_each_package(c: cargo, b: fn(source, package)) {
715+
fn for_each_package(c: &cargo, b: fn(source, package)) {
716716
for c.sources.each_value |v| {
717717
for v.packages.each |p| {
718718
b(v, p);
@@ -746,7 +746,7 @@ fn run_in_buildpath(what: &str, path: &Path, subdir: &Path, cf: &Path,
746746
Some(buildpath)
747747
}
748748

749-
fn test_one_crate(_c: cargo, path: &Path, cf: &Path) {
749+
fn test_one_crate(_c: &cargo, path: &Path, cf: &Path) {
750750
let buildpath = match run_in_buildpath(~"testing", path,
751751
&Path("test"),
752752
cf,
@@ -757,7 +757,7 @@ fn test_one_crate(_c: cargo, path: &Path, cf: &Path) {
757757
run_programs(&buildpath);
758758
}
759759

760-
fn install_one_crate(c: cargo, path: &Path, cf: &Path) {
760+
fn install_one_crate(c: &cargo, path: &Path, cf: &Path) {
761761
let buildpath = match run_in_buildpath(~"installing", path,
762762
&Path("build"),
763763
cf, ~[]) {
@@ -798,7 +798,7 @@ fn rustc_sysroot() -> ~str {
798798
}
799799
}
800800

801-
fn install_source(c: cargo, path: &Path) {
801+
fn install_source(c: &cargo, path: &Path) {
802802
debug!("source: %s", path.to_str());
803803
os::change_dir(path);
804804

@@ -837,7 +837,7 @@ fn install_source(c: cargo, path: &Path) {
837837
}
838838
}
839839

840-
fn install_git(c: cargo, wd: &Path, url: ~str, reference: Option<~str>) {
840+
fn install_git(c: &cargo, wd: &Path, url: ~str, reference: Option<~str>) {
841841
run::program_output(~"git", ~[~"clone", url, wd.to_str()]);
842842
if option::is_some(reference) {
843843
let r = option::get(reference);
@@ -848,7 +848,7 @@ fn install_git(c: cargo, wd: &Path, url: ~str, reference: Option<~str>) {
848848
install_source(c, wd);
849849
}
850850

851-
fn install_curl(c: cargo, wd: &Path, url: ~str) {
851+
fn install_curl(c: &cargo, wd: &Path, url: ~str) {
852852
let tarpath = wd.push("pkg.tar");
853853
let p = run::program_output(~"curl", ~[~"-f", ~"-s", ~"-o",
854854
tarpath.to_str(), url]);
@@ -861,14 +861,14 @@ fn install_curl(c: cargo, wd: &Path, url: ~str) {
861861
install_source(c, wd);
862862
}
863863

864-
fn install_file(c: cargo, wd: &Path, path: &Path) {
864+
fn install_file(c: &cargo, wd: &Path, path: &Path) {
865865
run::program_output(~"tar", ~[~"-x", ~"--strip-components=1",
866866
~"-C", wd.to_str(),
867867
~"-f", path.to_str()]);
868868
install_source(c, wd);
869869
}
870870

871-
fn install_package(c: cargo, src: ~str, wd: &Path, pkg: package) {
871+
fn install_package(c: &cargo, src: ~str, wd: &Path, pkg: package) {
872872
let url = copy pkg.url;
873873
let method = match pkg.method {
874874
~"git" => ~"git",
@@ -886,7 +886,7 @@ fn install_package(c: cargo, src: ~str, wd: &Path, pkg: package) {
886886
}
887887
}
888888

889-
fn cargo_suggestion(c: cargo, fallback: fn())
889+
fn cargo_suggestion(c: &cargo, fallback: fn())
890890
{
891891
if c.sources.size() == 0u {
892892
error(~"no sources defined - you may wish to run " +
@@ -896,7 +896,7 @@ fn cargo_suggestion(c: cargo, fallback: fn())
896896
fallback();
897897
}
898898

899-
fn install_uuid(c: cargo, wd: &Path, uuid: ~str) {
899+
fn install_uuid(c: &cargo, wd: &Path, uuid: ~str) {
900900
let mut ps = ~[];
901901
for_each_package(c, |s, p| {
902902
if p.uuid == uuid {
@@ -920,7 +920,7 @@ fn install_uuid(c: cargo, wd: &Path, uuid: ~str) {
920920
}
921921
}
922922

923-
fn install_named(c: cargo, wd: &Path, name: ~str) {
923+
fn install_named(c: &cargo, wd: &Path, name: ~str) {
924924
let mut ps = ~[];
925925
for_each_package(c, |s, p| {
926926
if p.name == name {
@@ -944,7 +944,7 @@ fn install_named(c: cargo, wd: &Path, name: ~str) {
944944
}
945945
}
946946

947-
fn install_uuid_specific(c: cargo, wd: &Path, src: ~str, uuid: ~str) {
947+
fn install_uuid_specific(c: &cargo, wd: &Path, src: ~str, uuid: ~str) {
948948
match c.sources.find(src) {
949949
Some(s) => {
950950
for s.packages.each |p| {
@@ -959,7 +959,7 @@ fn install_uuid_specific(c: cargo, wd: &Path, src: ~str, uuid: ~str) {
959959
error(~"can't find package: " + src + ~"/" + uuid);
960960
}
961961

962-
fn install_named_specific(c: cargo, wd: &Path, src: ~str, name: ~str) {
962+
fn install_named_specific(c: &cargo, wd: &Path, src: ~str, name: ~str) {
963963
match c.sources.find(src) {
964964
Some(s) => {
965965
for s.packages.each |p| {
@@ -974,7 +974,7 @@ fn install_named_specific(c: cargo, wd: &Path, src: ~str, name: ~str) {
974974
error(~"can't find package: " + src + ~"/" + name);
975975
}
976976

977-
fn cmd_uninstall(c: cargo) {
977+
fn cmd_uninstall(c: &cargo) {
978978
if vec::len(c.opts.free) < 3u {
979979
cmd_usage();
980980
return;
@@ -1026,7 +1026,7 @@ fn cmd_uninstall(c: cargo) {
10261026
}
10271027
}
10281028
1029-
fn install_query(c: cargo, wd: &Path, target: ~str) {
1029+
fn install_query(c: &cargo, wd: &Path, target: ~str) {
10301030
match c.dep_cache.find(target) {
10311031
Some(inst) => {
10321032
if inst {
@@ -1086,15 +1086,15 @@ fn install_query(c: cargo, wd: &Path, target: ~str) {
10861086
}
10871087
}
10881088

1089-
fn get_temp_workdir(c: cargo) -> Path {
1089+
fn get_temp_workdir(c: &cargo) -> Path {
10901090
match tempfile::mkdtemp(&c.workdir, "cargo") {
10911091
Some(wd) => wd,
10921092
None => fail fmt!("needed temp dir: %s",
10931093
c.workdir.to_str())
10941094
}
10951095
}
10961096

1097-
fn cmd_install(c: cargo) unsafe {
1097+
fn cmd_install(c: &cargo) unsafe {
10981098
let wd = get_temp_workdir(c);
10991099

11001100
if vec::len(c.opts.free) == 2u {
@@ -1118,15 +1118,15 @@ fn cmd_install(c: cargo) unsafe {
11181118
install_query(c, &wd, query);
11191119
}
11201120

1121-
fn sync(c: cargo) {
1121+
fn sync(c: &cargo) {
11221122
for c.sources.each_key |k| {
11231123
let mut s = c.sources.get(k);
11241124
sync_one(c, s);
11251125
c.sources.insert(k, s);
11261126
}
11271127
}
11281128

1129-
fn sync_one_file(c: cargo, dir: &Path, src: source) -> bool {
1129+
fn sync_one_file(c: &cargo, dir: &Path, src: source) -> bool {
11301130
let name = src.name;
11311131
let srcfile = dir.push("source.json.new");
11321132
let destsrcfile = dir.push("source.json");
@@ -1204,7 +1204,7 @@ fn sync_one_file(c: cargo, dir: &Path, src: source) -> bool {
12041204
return true;
12051205
}
12061206

1207-
fn sync_one_git(c: cargo, dir: &Path, src: source) -> bool {
1207+
fn sync_one_git(c: &cargo, dir: &Path, src: source) -> bool {
12081208
let name = src.name;
12091209
let srcfile = dir.push("source.json");
12101210
let pkgfile = dir.push("packages.json");
@@ -1307,7 +1307,7 @@ fn sync_one_git(c: cargo, dir: &Path, src: source) -> bool {
13071307
return true;
13081308
}
13091309

1310-
fn sync_one_curl(c: cargo, dir: &Path, src: source) -> bool {
1310+
fn sync_one_curl(c: &cargo, dir: &Path, src: source) -> bool {
13111311
let name = src.name;
13121312
let srcfile = dir.push("source.json.new");
13131313
let destsrcfile = dir.push("source.json");
@@ -1423,7 +1423,7 @@ fn sync_one_curl(c: cargo, dir: &Path, src: source) -> bool {
14231423
return true;
14241424
}
14251425

1426-
fn sync_one(c: cargo, src: source) {
1426+
fn sync_one(c: &cargo, src: source) {
14271427
let name = src.name;
14281428
let dir = c.sourcedir.push(name);
14291429

@@ -1443,7 +1443,7 @@ fn sync_one(c: cargo, src: source) {
14431443
}
14441444
}
14451445

1446-
fn cmd_init(c: cargo) {
1446+
fn cmd_init(c: &cargo) {
14471447
let srcurl = ~"http://www.rust-lang.org/cargo/sources.json";
14481448
let sigurl = ~"http://www.rust-lang.org/cargo/sources.json.sig";
14491449

@@ -1514,7 +1514,7 @@ fn print_source(s: source) {
15141514
}));
15151515
}
15161516
1517-
fn cmd_list(c: cargo) {
1517+
fn cmd_list(c: &cargo) {
15181518
sync(c);
15191519
15201520
if vec::len(c.opts.free) >= 3u {
@@ -1539,7 +1539,7 @@ fn cmd_list(c: cargo) {
15391539
}
15401540
}
15411541

1542-
fn cmd_search(c: cargo) {
1542+
fn cmd_search(c: &cargo) {
15431543
if vec::len(c.opts.free) < 3u {
15441544
cmd_usage();
15451545
return;
@@ -1572,7 +1572,7 @@ fn install_to_dir(srcfile: &Path, destdir: &Path) {
15721572
}
15731573
}
15741574

1575-
fn dump_cache(c: cargo) {
1575+
fn dump_cache(c: &cargo) {
15761576
need_dir(&c.root);
15771577

15781578
let out = c.root.push("cache.json");
@@ -1582,7 +1582,7 @@ fn dump_cache(c: cargo) {
15821582
copy_warn(&out, &c.root.push("cache.json.old"));
15831583
}
15841584
}
1585-
fn dump_sources(c: cargo) {
1585+
fn dump_sources(c: &cargo) {
15861586
if c.sources.size() < 1u {
15871587
return;
15881588
}
@@ -1638,7 +1638,7 @@ fn copy_warn(srcfile: &Path, destfile: &Path) {
16381638
}
16391639
}
16401640

1641-
fn cmd_sources(c: cargo) {
1641+
fn cmd_sources(c: &cargo) {
16421642
if vec::len(c.opts.free) < 3u {
16431643
for c.sources.each_value |v| {
16441644
info(fmt!("%s (%s) via %s",
@@ -1923,12 +1923,14 @@ fn main(argv: ~[~str]) {
19231923
let first_time = os::path_exists(&home.push("sources.json"));
19241924

19251925
if !first_time && o.free[1] != ~"init" {
1926-
cmd_init(c);
1926+
cmd_init(&c);
19271927

19281928
// FIXME (#2662): shouldn't need to reconfigure
19291929
c = configure(o);
19301930
}
19311931

1932+
let c = &move c;
1933+
19321934
match o.free[1] {
19331935
~"init" => cmd_init(c),
19341936
~"install" => cmd_install(c),

0 commit comments

Comments
 (0)