summaryrefslogtreecommitdiffstats
path: root/state.rb
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2008-10-09 01:44:19 -0400
committerCasey Dahlin <cdahlin@redhat.com>2008-10-09 01:47:08 -0400
commit45c7cf611b96ee7b5aa85bb18feafe29f270c7e0 (patch)
treed13e75b7277329463acffa46a8ca6b8fc29413aa /state.rb
parent3bda19aa69df2422ee193b2f7e75d3cc4e6c6ac9 (diff)
downloadupstate-45c7cf611b96ee7b5aa85bb18feafe29f270c7e0.tar.gz
upstate-45c7cf611b96ee7b5aa85bb18feafe29f270c7e0.tar.xz
upstate-45c7cf611b96ee7b5aa85bb18feafe29f270c7e0.zip
Properly deterministic hashing that accounts for deps
State#hash now gives consistent results (finally) and takes deps into account (again)
Diffstat (limited to 'state.rb')
-rw-r--r--state.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/state.rb b/state.rb
index 2a52b19..cc49bd9 100644
--- a/state.rb
+++ b/state.rb
@@ -214,7 +214,9 @@ class State
# Our ID is a function of our class and deps
def hash
- (self.class.hash ** 2 + self.params.sort.hash) % 0x4000000000000000
+ (self.class.name.hash ** 3 +
+ self.params.sort.hash ** 2 +
+ @deps.map{ |x| x.state.hash }.sort.hash) % 0x4000000000000000
end
# A state is rooted in a set of states if any state in the set which it _may_