diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2014-07-14 17:02:07 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2014-07-14 17:02:07 -0700 |
commit | 96b7e5552f6ee0e5d4be527803b6d3009709c3c7 (patch) | |
tree | 3fec00785eb8a76f196d934fa095174eadd3ed13 /lib/puppet/provider/vcsrepo/p4.rb | |
parent | f87608e828f97ff79be39ebaf11ca2647763f2f1 (diff) | |
parent | d37ba2f14e958e57ed34abe1797c78b4663e211a (diff) | |
download | puppet-vcsrepo-96b7e5552f6ee0e5d4be527803b6d3009709c3c7.tar.gz puppet-vcsrepo-96b7e5552f6ee0e5d4be527803b6d3009709c3c7.tar.bz2 |
Merge branch 'master' into 1.0.x
Diffstat (limited to 'lib/puppet/provider/vcsrepo/p4.rb')
-rw-r--r-- | lib/puppet/provider/vcsrepo/p4.rb | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/lib/puppet/provider/vcsrepo/p4.rb b/lib/puppet/provider/vcsrepo/p4.rb index 4f53415..63d3df2 100644 --- a/lib/puppet/provider/vcsrepo/p4.rb +++ b/lib/puppet/provider/vcsrepo/p4.rb @@ -68,12 +68,12 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d revision = 0 if hash && hash['code'] != 'error' - hash['data'].each do |c| - if c['status'] == 'have' - change = c['change'].to_i - revision = change if change > revision - end - end + hash['data'].each do |c| + if c['status'] == 'have' + change = c['change'].to_i + revision = change if change > revision + end + end end return revision end @@ -180,7 +180,7 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d view = "\nView:\n" hash.keys.sort.each do |k| - v = hash[k] + v = hash[k] next if( k == "code" ) if(k.to_s =~ /View/ ) view += "\t#{v}\n" @@ -251,28 +251,28 @@ Puppet::Type.type(:vcsrepo).provide(:p4, :parent => Puppet::Provider::Vcsrepo) d # helper method as cstat does not Marshal def marshal_cstat(hash) - data = hash['data'] - code = 'error' - - list = Array.new - change = Hash.new - data.each_line do |l| - p = /^\.\.\. (.*) (.*)$/ - m = p.match(l) - if m + data = hash['data'] + code = 'error' + + list = Array.new + change = Hash.new + data.each_line do |l| + p = /^\.\.\. (.*) (.*)$/ + m = p.match(l) + if m change[m[1]] = m[2] - if m[1] == 'status' - code = 'stat' - list.push change - change = Hash.new - end - end - end - - hash = Hash.new - hash.store 'code', code - hash.store 'data', list - return hash + if m[1] == 'status' + code = 'stat' + list.push change + change = Hash.new + end + end + end + + hash = Hash.new + hash.store 'code', code + hash.store 'data', list + return hash end end |