You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.0 KiB

  1. #!/usr/bin/python
  2. # The MIT License (MIT)
  3. # Copyright (c) 2014 Antonio SJ Musumeci <trapexit@spawn.link>
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. # The above copyright notice and this permission notice shall be included in
  11. # all copies or substantial portions of the Software.
  12. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  18. # THE SOFTWARE.
  19. import sys
  20. import subprocess
  21. packagename = sys.argv[1]
  22. version = sys.argv[2]
  23. args = ["git", "tag", '-l']
  24. tags = subprocess.check_output(args)
  25. tags = tags.split()
  26. tags.reverse()
  27. if version in tags:
  28. idx = tags.index(version)
  29. tags = tags[idx:]
  30. tags = zip(tags,tags)
  31. else:
  32. tags = zip(tags,tags)
  33. tags.insert(0,(version,'HEAD'))
  34. tag = tags[0]
  35. for prev in tags[1:]:
  36. print packagename, "("+tag[0]+")", "trusty;", "urgency=medium"
  37. print
  38. args = ['git','log','--oneline',tag[1]+'...'+prev[1]]
  39. for line in subprocess.check_output(args).strip().split('\n'):
  40. print " * " + line
  41. print
  42. args = ['git','log','-1','--format=-- %an <%ae> %cD',tag[1]]
  43. authorandtime = subprocess.check_output(args).strip()
  44. print ' ' + authorandtime + '\n'
  45. tag = prev