summaryrefslogtreecommitdiff
path: root/lib/puppet/provider/vcsrepo/hg.rb
diff options
context:
space:
mode:
authorAaron Bull Schaefer <aaron@elasticdog.com>2010-12-15 01:43:52 +0800
committerJames Turnbull <james@lovedthanlost.net>2010-12-27 15:47:00 +0800
commitf1120f2d9b121097b7e77709328144af330d0b34 (patch)
treeaebb7dd9d961b85fc89a14b02d382c103c7f8029 /lib/puppet/provider/vcsrepo/hg.rb
parentc0023928719024e346f5d3c03ef0f112db02f898 (diff)
restructure conditional to fix Regexp.quote(nil) error
Diffstat (limited to 'lib/puppet/provider/vcsrepo/hg.rb')
-rw-r--r--lib/puppet/provider/vcsrepo/hg.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb
index 0a2e5b7..0212d50 100644
--- a/lib/puppet/provider/vcsrepo/hg.rb
+++ b/lib/puppet/provider/vcsrepo/hg.rb
@@ -48,21 +48,16 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d
at_path do
current = hg('parents')[/^changeset:\s+(?:-?\d+):(\S+)/m, 1]
desired = @resource.value(:revision)
- if current == desired
- current
- else
+ if desired
+ # Return the tag name if it maps to the current nodeid
mapped = hg('tags')[/^#{Regexp.quote(desired)}\s+\d+:(\S+)/m, 1]
- if mapped
- # A tag, return that tag if it maps to the current nodeid
- if current == mapped
- desired
- else
- current
- end
+ if current == mapped
+ desired
else
- # Use the current nodeid
current
end
+ else
+ current
end
end
end