mtd/scripts creatediffs.py,1.3,1.4
gleixner at infradead.org
gleixner at infradead.org
Mon Nov 7 05:19:22 EST 2005
Update of /home/cvs/mtd/scripts
In directory phoenix.infradead.org:/tmp/cvs-serv29154
Modified Files:
creatediffs.py
Log Message:
Add function to retrieve author from Signed-off-by line
Index: creatediffs.py
===================================================================
RCS file: /home/cvs/mtd/scripts/creatediffs.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- creatediffs.py 6 Nov 2005 22:50:04 -0000 1.3
+++ creatediffs.py 7 Nov 2005 10:19:18 -0000 1.4
@@ -18,6 +18,7 @@
import difflib
import email
import mailbox
+import re
import string
from Tkinter import *
@@ -34,6 +35,9 @@
includepaths = ["drivers", "fs", "include"]
excludepatterns = ["jffs3","ecos"]
+# Regex to retrieve real author from signed off line
+re_author = re.compile(r"""^Signed-.ff-.y: (.*) <(.*)>""")
+
# Print the usage information
def usage(res):
print "USAGE:"
@@ -93,6 +97,8 @@
Checkbutton(f1, text="Add Author Signed-off", variable=self.signAuthor).grid(row=0,column=3)
self.signOwn = IntVar()
Checkbutton(f1, text="Add own Signed-off", variable=self.signOwn).grid(row=0,column=4)
+ self.authSignOff = IntVar()
+ Checkbutton(f1, text="Get author from Signed-off", variable=self.authSignOff).grid(row=0,column=5)
Label(f2, text="What").grid(row=0, column=0, sticky=W)
Label(f2, textvariable = self.subject, justify=LEFT, relief=SUNKEN).grid(row=0, column=1, sticky=W)
@@ -228,13 +234,6 @@
fd.write("git status\n")
fd.close()
- fd = open(mtdrepo + "/commit.sh", "w")
- fd.write('#!/bin/sh\n')
- fd.write('export GIT_AUTHOR_NAME="%s"\n' %(self.usr[0]))
- fd.write('export GIT_AUTHOR_EMAIL="%s"\n' %(self.usr[1]))
- fd.write('export GIT_AUTHOR_DATE="%s"\n' %(self.cdate))
- fd.write('\ngit commit -v -F logmessage\n')
- fd.close()
fd = open(mtdrepo+"/logmessage", "w")
lines = self.log.get(1.0,END).splitlines()
# Strip trailing newlines
@@ -242,13 +241,35 @@
lines.pop(-1)
for line in lines:
fd.write(line+"\n")
- if len(lines) > 0 and lines[-1].find("Signed") < 0:
+ if len(lines) > 0 and lines[-1].find("Signed-") < 0:
fd.write("\n")
+
+ if self.authSignOff:
+ for line in lines:
+ try:
+ ainfo = re_author.match(line)
+ name = ainfo.group(1)
+ mail = ainfo.group(2)
+ self.usr[0] = name
+ self.usr[1] = mail
+ break;
+ except Exception, ex:
+ pass
+
if self.signAuthor.get() == 1:
fd.write("Signed-off-by: %s <%s>\n" %(self.usr[0], self.usr[1]))
if self.signOwn.get() == 1:
fd.write("Signed-off-by: %s <%s>\n" %(mysign[0], mysign[1]))
fd.close()
+
+ fd = open(mtdrepo + "/commit.sh", "w")
+ fd.write('#!/bin/sh\n')
+ fd.write('export GIT_AUTHOR_NAME="%s"\n' %(self.usr[0]))
+ fd.write('export GIT_AUTHOR_EMAIL="%s"\n' %(self.usr[1]))
+ fd.write('export GIT_AUTHOR_DATE="%s"\n' %(self.cdate))
+ fd.write('\ngit commit -v -F logmessage\n')
+ fd.close()
+
self.next()
def next(self):
More information about the linux-mtd-cvs
mailing list