Skip to content

Instantly share code, notes, and snippets.

@grotezo
Created January 15, 2010 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grotezo/278426 to your computer and use it in GitHub Desktop.
Save grotezo/278426 to your computer and use it in GitHub Desktop.
#!/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}\.\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