diff options
author | Hunter Haugen <hunter@puppetlabs.com> | 2014-07-14 14:11:01 -0700 |
---|---|---|
committer | Hunter Haugen <hunter@puppetlabs.com> | 2014-07-14 14:11:01 -0700 |
commit | d37ba2f14e958e57ed34abe1797c78b4663e211a (patch) | |
tree | d967423bdb7f02eb0995a32efccb40c0752b38b7 /lib | |
parent | 9dfea1f1898bedb04ec829a292c80f69d7f7d95c (diff) | |
parent | 89ba0d8127bf7700c70e703eb667f58786c7ef01 (diff) | |
download | puppet-vcsrepo-d37ba2f14e958e57ed34abe1797c78b4663e211a.tar.gz puppet-vcsrepo-d37ba2f14e958e57ed34abe1797c78b4663e211a.tar.bz2 |
Merge pull request #187 from p4paul/master
Update Markdown with missing Perforce details.
Diffstat (limited to 'lib')
-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 |