diff options
author | Bruce Williams <bruce@codefluency.com> | 2010-03-13 17:32:17 -0800 |
---|---|---|
committer | Bruce Williams <bruce@codefluency.com> | 2010-03-13 17:32:17 -0800 |
commit | c714947908b69c538ea9d050d4375e2b3f19e7ac (patch) | |
tree | 1a464a8d7534e43e30d09dd914cbf231f1a29601 /lib | |
parent | 6adc8745c6565391f5da534306c3ec206da9dc21 (diff) | |
download | puppet-vcsrepo-c714947908b69c538ea9d050d4375e2b3f19e7ac.tar.gz puppet-vcsrepo-c714947908b69c538ea9d050d4375e2b3f19e7ac.tar.bz2 |
Support Mercurial tags, restructure examples
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/provider/vcsrepo/hg.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/puppet/provider/vcsrepo/hg.rb b/lib/puppet/provider/vcsrepo/hg.rb index 7263b4f..928049f 100644 --- a/lib/puppet/provider/vcsrepo/hg.rb +++ b/lib/puppet/provider/vcsrepo/hg.rb @@ -24,7 +24,24 @@ Puppet::Type.type(:vcsrepo).provide(:hg, :parent => Puppet::Provider::Vcsrepo) d def revision at_path do - hg('parents')[/^changeset:\s+(?:-?\d+):(\S+)/m, 1] + current = hg('parents')[/^changeset:\s+(?:-?\d+):(\S+)/m, 1] + desired = @resource.value(:revision) + if current == desired + current + else + 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 + else + # Use the current nodeid + current + end + end end end |