'''
Readme
python commitmessage.py 19.3.A.0.12 19.3.A.0.13
oldtag:19.3.A.0.12
newtag:19.3.A.0.13
'''
import os
import os.path
import string
import sys
import commands
class ParseCommit:
def parse(self,alldms,commit):
self.dms = -1
self.changeid = -1
title = " - "+commit[4].lstrip()
if ( len(title) > 70):
title = title + "<<<<<<<
print " - "+commit[4].lstrip(),
for line in commit:
if line.find("FIX=") != -1:
self.dms = line
alldms.append(line.lstrip())
#print line.lstrip()
continue
if line.find("Change-Id:") != -1:
self.changeid = line
print " "+line.lstrip(),
continue
#oldtag="19.3.A.0.12"
#newtag="19.3.A.0.13"
oldtag=sys.argv[1]
newtag=sys.argv[2]
#print "oldtag:"+oldtag
#print "newtag:"+newtag
cmd_gitallsh1 = "git log --pretty=%H " + oldtag + ".." + newtag
cmd_gitalltile = "git log --pretty=%s " + oldtag + ".." + newtag
cmd_gitsh1 = "git log -1 "
alldms = []
count = 0
'''
stream = os.popen(cmd_gitallsh1)
allsh1 = stream.readlines()
parse = ParseCommit();
print cmd_gitsh1 + allsh1[0]
stream = os.popen(cmd_gitsh1 + allsh1[0])
commit = stream.readlines()
parse.parse(alldms,commit);
'''
print "Delivery of " + newtag
print "includes:"
stream = os.popen(cmd_gitallsh1)
allsh1 = stream.readlines()
parse = ParseCommit();
for sh1 in allsh1:
#print sh1
stream = os.popen(cmd_gitsh1+sh1)
commit = stream.readlines()
parse.parse(alldms,commit);
for dms in alldms:
print dms, 提取两个tag之间的commit message的信息