python 用于git的脚本

释放双眼,带上耳机,听听看~!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
1'''
2Readme
3
4python commitmessage.py 19.3.A.0.12 19.3.A.0.13
5
6oldtag:19.3.A.0.12
7newtag:19.3.A.0.13
8
9
10'''
11
12
13
14
15import os
16import os.path
17import string
18import sys
19import commands
20
21class ParseCommit:
22   def parse(self,alldms,commit):
23       self.dms = -1
24       self.changeid = -1
25       title = " - "+commit[4].lstrip()
26       if ( len(title) > 70):
27           title = title + "<<<<<<<<too long"
28       print " - "+commit[4].lstrip(),
29       for line in commit:
30           if line.find("FIX=") != -1:
31                self.dms = line
32                alldms.append(line.lstrip())
33                #print line.lstrip()
34                continue
35           if line.find("Change-Id:") != -1:
36                self.changeid = line
37                print "   "+line.lstrip(),
38                continue              
39
40  
41
42
43
44#oldtag="19.3.A.0.12"
45#newtag="19.3.A.0.13"
46
47oldtag=sys.argv[1]
48newtag=sys.argv[2]
49#print "oldtag:"+oldtag
50#print "newtag:"+newtag
51cmd_gitallsh1 = "git log --pretty=%H " + oldtag + ".." + newtag
52cmd_gitalltile = "git log --pretty=%s " + oldtag + ".." + newtag
53cmd_gitsh1 = "git log -1 "
54alldms = []
55count = 0
56
57
58'''
59stream = os.popen(cmd_gitallsh1)
60allsh1 = stream.readlines()
61parse = ParseCommit();
62
63
64print cmd_gitsh1 + allsh1[0]
65stream = os.popen(cmd_gitsh1 + allsh1[0])
66commit = stream.readlines()
67parse.parse(alldms,commit);
68'''
69
70print "Delivery of " + newtag
71print
72print "includes:"
73
74
75stream = os.popen(cmd_gitallsh1)
76allsh1 = stream.readlines()
77parse = ParseCommit();
78for sh1 in allsh1:
79    #print sh1
80    stream = os.popen(cmd_gitsh1+sh1)
81    commit = stream.readlines()
82    parse.parse(alldms,commit);
83
84
85print
86print
87print
88
89for dms in alldms:    
90    print dms,
91

1
2
1  提取两个tag之间的commit message的信息  
2

版权声明:本文为博主原创文章,未经博主允许不得转载。

给TA打赏
共{{data.count}}人
人已打赏
安全技术

C/C++内存泄漏及检测

2022-1-11 12:36:11

安全事件

注意了,cURL的漏洞也不少

2016-12-20 1:55:10

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索