Skip to content

Commit 08b9837

Browse files
committed
---
yaml --- r: 64300 b: refs/heads/snap-stage3 c: 6b37b5b h: refs/heads/master v: v3
1 parent a55bf46 commit 08b9837

File tree

23 files changed

+144
-313
lines changed

23 files changed

+144
-313
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a1f4843895d1152527f94e73fc64bf744d97d255
4+
refs/heads/snap-stage3: 6b37b5bab74a87c4f05274e6a49d9e28a4c0f4e1
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/bitv.rs

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -718,38 +718,6 @@ impl Set<uint> for BitvSet {
718718
*value < self.bitv.storage.len() * uint::bits && self.bitv.get(*value)
719719
}
720720

721-
fn insert(&mut self, value: uint) -> bool {
722-
if self.contains(&value) {
723-
return false;
724-
}
725-
let nbits = self.capacity();
726-
if value >= nbits {
727-
let newsize = num::max(value, nbits * 2) / uint::bits + 1;
728-
assert!(newsize > self.bitv.storage.len());
729-
self.bitv.storage.grow(newsize, &0);
730-
}
731-
self.size += 1;
732-
self.bitv.set(value, true);
733-
return true;
734-
}
735-
736-
fn remove(&mut self, value: &uint) -> bool {
737-
if !self.contains(value) {
738-
return false;
739-
}
740-
self.size -= 1;
741-
self.bitv.set(*value, false);
742-
743-
// Attempt to truncate our storage
744-
let mut i = self.bitv.storage.len();
745-
while i > 1 && self.bitv.storage[i - 1] == 0 {
746-
i -= 1;
747-
}
748-
self.bitv.storage.truncate(i);
749-
750-
return true;
751-
}
752-
753721
fn is_disjoint(&self, other: &BitvSet) -> bool {
754722
for self.intersection(other) |_| {
755723
return false;
@@ -816,6 +784,40 @@ impl Set<uint> for BitvSet {
816784
}
817785
}
818786

787+
impl MutableSet<uint> for BitvSet {
788+
fn insert(&mut self, value: uint) -> bool {
789+
if self.contains(&value) {
790+
return false;
791+
}
792+
let nbits = self.capacity();
793+
if value >= nbits {
794+
let newsize = num::max(value, nbits * 2) / uint::bits + 1;
795+
assert!(newsize > self.bitv.storage.len());
796+
self.bitv.storage.grow(newsize, &0);
797+
}
798+
self.size += 1;
799+
self.bitv.set(value, true);
800+
return true;
801+
}
802+
803+
fn remove(&mut self, value: &uint) -> bool {
804+
if !self.contains(value) {
805+
return false;
806+
}
807+
self.size -= 1;
808+
self.bitv.set(*value, false);
809+
810+
// Attempt to truncate our storage
811+
let mut i = self.bitv.storage.len();
812+
while i > 1 && self.bitv.storage[i - 1] == 0 {
813+
i -= 1;
814+
}
815+
self.bitv.storage.truncate(i);
816+
817+
return true;
818+
}
819+
}
820+
819821
impl BitvSet {
820822
/// Visits each of the words that the two bit vectors (self and other)
821823
/// both have in common. The three yielded arguments are (bit location,

branches/snap-stage3/src/libextra/smallintmap.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818

1919
use std::cmp;
20-
use std::container::{Container, Mutable, Map, Set};
21-
use std::iterator::*;
20+
use std::iterator::{Iterator,IteratorUtil,ZipIterator,Counter,EnumerateIterator,FilterMapIterator};
2221
use std::uint;
2322
use std::util::replace;
2423
use std::vec::{VecIterator,VecMutIterator,VecRevIterator,VecMutRevIterator};
@@ -68,7 +67,9 @@ impl<V> Map<uint, V> for SmallIntMap<V> {
6867
None
6968
}
7069
}
70+
}
7171

72+
impl<V> MutableMap<uint, V> for SmallIntMap<V> {
7273
/// Return a mutable reference to the value corresponding to the key
7374
fn find_mut<'a>(&'a mut self, key: &uint) -> Option<&'a mut V> {
7475
if *key < self.v.len() {
@@ -349,14 +350,6 @@ impl Set<uint> for SmallIntSet {
349350
/// Return true if the set contains a value
350351
fn contains(&self, value: &uint) -> bool { self.map.contains_key(value) }
351352

352-
/// Add a value to the set. Return true if the value was not already
353-
/// present in the set.
354-
fn insert(&mut self, value: uint) -> bool { self.map.insert(value, ()) }
355-
356-
/// Remove a value from the set. Return true if the value was
357-
/// present in the set.
358-
fn remove(&mut self, value: &uint) -> bool { self.map.remove(value) }
359-
360353
/// Return true if the set has no elements in common with `other`.
361354
/// This is equivalent to checking for an empty uintersection.
362355
fn is_disjoint(&self, other: &SmallIntSet) -> bool {
@@ -412,6 +405,16 @@ impl Set<uint> for SmallIntSet {
412405
}
413406
}
414407

408+
impl MutableSet<uint> for SmallIntSet {
409+
/// Add a value to the set. Return true if the value was not already
410+
/// present in the set.
411+
fn insert(&mut self, value: uint) -> bool { self.map.insert(value, ()) }
412+
413+
/// Remove a value from the set. Return true if the value was
414+
/// present in the set.
415+
fn remove(&mut self, value: &uint) -> bool { self.map.remove(value) }
416+
}
417+
415418
impl SmallIntSet {
416419
/// Create an empty SmallIntSet
417420
pub fn new() -> SmallIntSet { SmallIntSet{map: SmallIntMap::new()} }

branches/snap-stage3/src/libextra/treemap.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ impl<K: TotalOrd, V> Map<K, V> for TreeMap<K, V> {
124124
}
125125
}
126126
}
127+
}
127128

129+
impl<K: TotalOrd, V> MutableMap<K, V> for TreeMap<K, V> {
128130
/// Return a mutable reference to the value corresponding to the key
129131
#[inline]
130132
fn find_mut<'a>(&'a mut self, key: &K) -> Option<&'a mut V> {
@@ -293,16 +295,6 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
293295
self.map.contains_key(value)
294296
}
295297

296-
/// Add a value to the set. Return true if the value was not already
297-
/// present in the set.
298-
#[inline]
299-
fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) }
300-
301-
/// Remove a value from the set. Return true if the value was
302-
/// present in the set.
303-
#[inline]
304-
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
305-
306298
/// Return true if the set has no elements in common with `other`.
307299
/// This is equivalent to checking for an empty intersection.
308300
fn is_disjoint(&self, other: &TreeSet<T>) -> bool {
@@ -475,6 +467,18 @@ impl<T: TotalOrd> Set<T> for TreeSet<T> {
475467
}
476468
}
477469

470+
impl<T: TotalOrd> MutableSet<T> for TreeSet<T> {
471+
/// Add a value to the set. Return true if the value was not already
472+
/// present in the set.
473+
#[inline]
474+
fn insert(&mut self, value: T) -> bool { self.map.insert(value, ()) }
475+
476+
/// Remove a value from the set. Return true if the value was
477+
/// present in the set.
478+
#[inline]
479+
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
480+
}
481+
478482
impl<T: TotalOrd> TreeSet<T> {
479483
/// Create an empty TreeSet
480484
#[inline]

branches/snap-stage3/src/librustpkg/conditions.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,3 @@ condition! {
3232
condition! {
3333
bad_pkg_id: (super::Path, ~str) -> super::PkgId;
3434
}
35-
36-
condition! {
37-
no_rust_path: (~str) -> super::Path;
38-
}

branches/snap-stage3/src/librustpkg/installed_packages.rs

Lines changed: 0 additions & 40 deletions
This file was deleted.

branches/snap-stage3/src/librustpkg/package_id.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@ pub struct PkgId {
3030
version: Version
3131
}
3232

33-
impl Eq for PkgId {
34-
fn eq(&self, p: &PkgId) -> bool {
35-
*p.local_path == *self.local_path && p.version == self.version
36-
}
37-
fn ne(&self, p: &PkgId) -> bool {
38-
!(self.eq(p))
39-
}
40-
}
41-
4233
impl PkgId {
4334
pub fn new(s: &str) -> PkgId {
4435
use conditions::bad_pkg_id::cond;

branches/snap-stage3/src/librustpkg/path_util.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,13 @@ static PATH_ENTRY_SEPARATOR: &'static str = ";";
3333
#[cfg(not(windows))]
3434
static PATH_ENTRY_SEPARATOR: &'static str = ":";
3535

36-
/// Returns RUST_PATH as a string, without default paths added
37-
pub fn get_rust_path() -> Option<~str> {
38-
os::getenv("RUST_PATH")
39-
}
40-
4136
/// Returns the value of RUST_PATH, as a list
4237
/// of Paths. Includes default entries for, if they exist:
4338
/// $HOME/.rust
4439
/// DIR/.rust for any DIR that's the current working directory
4540
/// or an ancestor of it
4641
pub fn rust_path() -> ~[Path] {
47-
let mut env_rust_path: ~[Path] = match get_rust_path() {
42+
let mut env_rust_path: ~[Path] = match os::getenv("RUST_PATH") {
4843
Some(env_path) => {
4944
let env_path_components: ~[&str] =
5045
env_path.split_str_iter(PATH_ENTRY_SEPARATOR).collect();
@@ -383,23 +378,3 @@ pub fn mk_output_path(what: OutputType, where: Target,
383378
debug!("mk_output_path: returning %s", output_path.to_str());
384379
output_path
385380
}
386-
387-
/// Removes files for the package `pkgid`, assuming it's installed in workspace `workspace`
388-
pub fn uninstall_package_from(workspace: &Path, pkgid: &PkgId) {
389-
let mut did_something = false;
390-
let installed_bin = target_executable_in_workspace(pkgid, workspace);
391-
if os::path_exists(&installed_bin) {
392-
os::remove_file(&installed_bin);
393-
did_something = true;
394-
}
395-
let installed_lib = target_library_in_workspace(pkgid, workspace);
396-
if os::path_exists(&installed_lib) {
397-
os::remove_file(&installed_lib);
398-
did_something = true;
399-
}
400-
if !did_something {
401-
warn(fmt!("Warning: there don't seem to be any files for %s installed in %s",
402-
pkgid.to_str(), workspace.to_str()));
403-
}
404-
405-
}

branches/snap-stage3/src/librustpkg/rustpkg.rs

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ pub mod api;
5050
mod conditions;
5151
mod context;
5252
mod crate;
53-
mod installed_packages;
5453
mod messages;
5554
mod package_id;
5655
mod package_path;
@@ -249,14 +248,6 @@ impl CtxMethods for Ctx {
249248
}
250249
}
251250
}
252-
"list" => {
253-
io::println("Installed packages:");
254-
for installed_packages::list_installed_packages |pkg_id| {
255-
io::println(fmt!("%s-%s",
256-
pkg_id.local_path.to_str(),
257-
pkg_id.version.to_str()));
258-
}
259-
}
260251
"prefer" => {
261252
if args.len() < 1 {
262253
return usage::uninstall();
@@ -272,24 +263,11 @@ impl CtxMethods for Ctx {
272263
return usage::uninstall();
273264
}
274265

275-
let pkgid = PkgId::new(args[0]);
276-
if !installed_packages::package_is_installed(&pkgid) {
277-
warn(fmt!("Package %s doesn't seem to be installed! Doing nothing.", args[0]));
278-
return;
279-
}
280-
else {
281-
let rp = rust_path();
282-
assert!(!rp.is_empty());
283-
for each_pkg_parent_workspace(&pkgid) |workspace| {
284-
path_util::uninstall_package_from(workspace, &pkgid);
285-
note(fmt!("Uninstalled package %s (was installed in %s)",
286-
pkgid.to_str(), workspace.to_str()));
287-
}
288-
}
266+
self.uninstall(args[0], None);
289267
}
290268
"unprefer" => {
291269
if args.len() < 1 {
292-
return usage::unprefer();
270+
return usage::uninstall();
293271
}
294272

295273
self.unprefer(args[0], None);
@@ -469,7 +447,6 @@ pub fn main() {
469447
~"do" => usage::do_cmd(),
470448
~"info" => usage::info(),
471449
~"install" => usage::install(),
472-
~"list" => usage::list(),
473450
~"prefer" => usage::prefer(),
474451
~"test" => usage::test(),
475452
~"uninstall" => usage::uninstall(),

0 commit comments

Comments
 (0)