Kleinere Anpassungen; Scripte angepasst

This commit is contained in:
2016-06-27 11:35:25 +02:00
parent 1b7c975dc7
commit 4c8616c309
5 changed files with 54 additions and 34 deletions

View File

@ -6,8 +6,12 @@ import time
import codecs
from git import Repo
import locale
# Locales for date set up to de_DE
# Please edit to you needs
locale.setlocale(locale.LC_ALL, 'de_DE')
# set up the git repo
# path is the current working directory
pathrepo = os.getcwd()
repo = Repo(pathrepo)
assert not repo.bare
@ -15,11 +19,11 @@ git = repo.git
headcommit = repo.head.commit
index = repo.index
commFiles = git.diff_tree('-r', 'ORIG_HEAD', 'HEAD', no_commit_id=True, name_only=True).split("\n")
#commit = git.log('-1', format='%h').rstrip()
#cmt = subprocess.check_output('git log -1 --format="%s" ', shell=True).decode("utf-8").rstrip()
# get the commited/changed files and date/author/commit
commFiles = git.diff_tree('-r', 'ORIG_HEAD', 'HEAD',
no_commit_id=True, name_only=True).split("\n")
# iterate through all files and write the gfi help-files
for fl in commFiles:
flname, flext = os.path.splitext(fl)
if flext == '.tex':
@ -36,9 +40,8 @@ for fl in commFiles:
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
f.write("% gitfile-info control file\n")
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3] + "}{"
+ date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3]
+ "}{" + date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
#print("\\gfiSet{" + date + "}{" + author + "}{" + commit + "}")
f.close