Skip to content

Instantly share code, notes, and snippets.

@grotezo

grotezo/gist:278416

Created Jan 15, 2010
Embed
What would you like to do?
#!/usr/bin/env ruby
revisions = [
'1.1',
'1.2',
'1.3',
'1.3.2.1',
'1.3.2.3',
'1.3.2.4',
'1.3.4.1',
'1.4',
'1.5'
]
branch = "1.3.2"
puts revisions.select{|v| v =~ /#{branch.gsub('.', '\.')}\.\d+$/}.max{|a,b| a.split('.').last.to_i <=> b.split('.').last.to_i}
# Output is: 1.3.2.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.