Kleinere Anpassungen; Scripte angepasst
This commit is contained in:
parent
1b7c975dc7
commit
4c8616c309
15
README
15
README
@ -33,13 +33,20 @@
|
|||||||
| Installation |
|
| Installation |
|
||||||
| |
|
| |
|
||||||
Getting the files:
|
Getting the files:
|
||||||
|
latex gitfile-info.ins
|
||||||
|
|
||||||
Getting the documentation:
|
Getting the documentation:
|
||||||
|
latexmk -pdf gitfile-info.dtx
|
||||||
|
|
||||||
Copy the following files into a TeX-readable directory:
|
Copy the following file into a TeX-readable directory:
|
||||||
|
gitfile-info.sty
|
||||||
The following files are needed to make a new application:
|
|
||||||
|
|
||||||
The following files are needed to make a new documentation-table:
|
Copy the hooks into .git/hooks:
|
||||||
|
post-commit
|
||||||
|
post-merge
|
||||||
|
|
||||||
|
Copy the init-script into a executable directory, maybe within the git-repo to post it to the
|
||||||
|
other users:
|
||||||
|
gfi-run
|
||||||
| |
|
| |
|
||||||
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
|
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
|
||||||
|
@ -156,11 +156,11 @@ pdftitle = {\LaTeX-package for reading git commit info for specific files}
|
|||||||
}
|
}
|
||||||
|
|
||||||
Wenn Versionen von \LaTeX-Dateien mit git kontrolliert werden, dann kommt es vor, dass für
|
Wenn Versionen von \LaTeX-Dateien mit git kontrolliert werden, dann kommt es vor, dass für
|
||||||
einen selbst, anderen Nutzern oder Entwicklern der aktuelle Entwicklungsstand der Datei,
|
einen selbst, andere Nutzern oder Entwickler der aktuelle Entwicklungsstand der Datei,
|
||||||
Hinweise zum Autor und dem Datum der letzten Bearbeitung im PDF gezeigt werden sollen. Mir
|
Hinweise zum Autor und dem Datum der letzten Bearbeitung im PDF gezeigt werden sollen. Mir
|
||||||
bekannte Pakete können zwar den Stand des Repositories auslesen, jedoch nicht für eine
|
bekannte Pakete können zwar den Stand des Repositories auslesen, jedoch nicht für eine
|
||||||
bestimmte Datei unterscheiden. Allerdings wird manchmal mit vielen Dateien in einem Repository
|
bestimmte Datei unterscheiden. Allerdings wird manchmal mit vielen Dateien in einem Repository
|
||||||
gearbeitet, die jeweils in verschiedene Versionen vorliegen. Möglicherweise soll auch ein
|
gearbeitet, die jeweils in verschiedenen Versionen vorliegen. Möglicherweise soll auch ein
|
||||||
großes Projekt in mehrere \TeX-Dateien aufgeteilt werden. Dann soll dennoch für jede einzelne
|
großes Projekt in mehrere \TeX-Dateien aufgeteilt werden. Dann soll dennoch für jede einzelne
|
||||||
Datei die Versionsinfo angezeigt werden können. Dieses Paket soll diese Funktionalität
|
Datei die Versionsinfo angezeigt werden können. Dieses Paket soll diese Funktionalität
|
||||||
liefern.
|
liefern.
|
||||||
@ -171,7 +171,7 @@ pdftitle = {\LaTeX-package for reading git commit info for specific files}
|
|||||||
|
|
||||||
\section{Änderungen}
|
\section{Änderungen}
|
||||||
\begin{description}
|
\begin{description}
|
||||||
\item[v0.1] Veröffentlichung
|
\item[v0.1] Intialisierung und erste Veröffentlichung
|
||||||
\end{description}
|
\end{description}
|
||||||
|
|
||||||
\section{Installation}
|
\section{Installation}
|
||||||
|
29
gfi-run
29
gfi-run
@ -7,8 +7,12 @@ import time
|
|||||||
import codecs
|
import codecs
|
||||||
from git import Repo
|
from git import Repo
|
||||||
import locale
|
import locale
|
||||||
|
# Locales for date set up to de_DE
|
||||||
|
# Please edit to you needs
|
||||||
locale.setlocale(locale.LC_ALL, 'de_DE')
|
locale.setlocale(locale.LC_ALL, 'de_DE')
|
||||||
|
|
||||||
|
# set up the git repo
|
||||||
|
# path is the current working directory
|
||||||
pathrepo = os.getcwd()
|
pathrepo = os.getcwd()
|
||||||
repo = Repo(pathrepo)
|
repo = Repo(pathrepo)
|
||||||
assert not repo.bare
|
assert not repo.bare
|
||||||
@ -16,15 +20,19 @@ git = repo.git
|
|||||||
headcommit = repo.head.commit
|
headcommit = repo.head.commit
|
||||||
index = repo.index
|
index = repo.index
|
||||||
|
|
||||||
|
# check for specific file (else) or
|
||||||
|
# every tex file within the git
|
||||||
if len(sys.argv) <= 1:
|
if len(sys.argv) <= 1:
|
||||||
|
# get all the files within the git
|
||||||
commFiles = git.ls_files(full_name=True).split("\n")
|
commFiles = git.ls_files(full_name=True).split("\n")
|
||||||
#commit = git.log('-1', format='%h').rstriMin
|
|
||||||
#cmt = subprocess.check_output('git log -1 --format="%s" ', shell=True).decode("utf-8").rstrip()
|
|
||||||
|
|
||||||
|
# iterate through all files and read date/author/commit and
|
||||||
|
# write in the help file
|
||||||
for fl in commFiles:
|
for fl in commFiles:
|
||||||
flname, flext = os.path.splitext(fl)
|
flname, flext = os.path.splitext(fl)
|
||||||
if flext == '.tex':
|
if flext == '.tex':
|
||||||
rawdate = int(git.log('-1', fl, pretty='format:"%at"').split('"')[1])
|
rawdate = int(git.log('-1', fl,
|
||||||
|
pretty='format:"%at"').split('"')[1])
|
||||||
date = [time.strftime("%d. %B %Y %H:%M", time.localtime(rawdate)),
|
date = [time.strftime("%d. %B %Y %H:%M", time.localtime(rawdate)),
|
||||||
time.strftime("%d", time.localtime(rawdate)),
|
time.strftime("%d", time.localtime(rawdate)),
|
||||||
time.strftime("%m", time.localtime(rawdate)),
|
time.strftime("%m", time.localtime(rawdate)),
|
||||||
@ -37,13 +45,14 @@ if len(sys.argv) <= 1:
|
|||||||
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
|
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
|
||||||
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
||||||
f.write("% gitfile-info control file\n")
|
f.write("% gitfile-info control file\n")
|
||||||
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3] + "}{"
|
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3]
|
||||||
+ date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
+ "}{" + date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
||||||
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
||||||
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
||||||
#print("\\gfiSet{" + date + "}{" + author + "}{" + commit + "}")
|
|
||||||
f.close
|
f.close
|
||||||
else:
|
else:
|
||||||
|
# get the specific file, read date/author/commit and
|
||||||
|
# write the help file
|
||||||
fl = sys.argv[1]
|
fl = sys.argv[1]
|
||||||
flname, flext = os.path.splitext(fl)
|
flname, flext = os.path.splitext(fl)
|
||||||
rawdate = int(git.log('-1', fl, pretty='format:"%at"').split('"')[1])
|
rawdate = int(git.log('-1', fl, pretty='format:"%at"').split('"')[1])
|
||||||
@ -56,13 +65,11 @@ else:
|
|||||||
author = [git.log('-1', fl, pretty='format:"%an"').split('"')[1],
|
author = [git.log('-1', fl, pretty='format:"%an"').split('"')[1],
|
||||||
git.log('-1', fl, pretty='format:"%ae"').split('"')[1]]
|
git.log('-1', fl, pretty='format:"%ae"').split('"')[1]]
|
||||||
commit = [git.log('-1', fl, pretty='format:"%H"').split('"')[1],
|
commit = [git.log('-1', fl, pretty='format:"%H"').split('"')[1],
|
||||||
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
|
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
|
||||||
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
||||||
f.write("% gitfile-info control file\n")
|
f.write("% gitfile-info control file\n")
|
||||||
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3] + "}{"
|
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3]
|
||||||
+ date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
+ "}{" + date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
||||||
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
||||||
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
||||||
#print("\\gfiSet{" + date + "}{" + author + "}{" + commit + "}")
|
|
||||||
f.close
|
f.close
|
||||||
|
|
||||||
|
21
post-commit
21
post-commit
@ -1,14 +1,17 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# -*- mode:python -*-
|
# -*- mode:python -*-
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import codecs
|
import codecs
|
||||||
from git import Repo
|
from git import Repo
|
||||||
import locale
|
import locale
|
||||||
|
# Locales for date set up to de_DE
|
||||||
|
# Please edit to you needs
|
||||||
locale.setlocale(locale.LC_ALL, 'de_DE')
|
locale.setlocale(locale.LC_ALL, 'de_DE')
|
||||||
|
|
||||||
|
# set up the git repo
|
||||||
|
# path is the current working directory
|
||||||
pathrepo = os.getcwd()
|
pathrepo = os.getcwd()
|
||||||
repo = Repo(pathrepo)
|
repo = Repo(pathrepo)
|
||||||
assert not repo.bare
|
assert not repo.bare
|
||||||
@ -16,8 +19,11 @@ git = repo.git
|
|||||||
headcommit = repo.head.commit
|
headcommit = repo.head.commit
|
||||||
index = repo.index
|
index = repo.index
|
||||||
|
|
||||||
commFiles = git.diff_tree('-r', 'HEAD', no_commit_id=True, name_only=True).split("\n")
|
# get the commited/changed files and date/author/commit
|
||||||
date = [time.strftime("%d. %B %Y %H:%M", time.localtime(headcommit.authored_date)),
|
commFiles = git.diff_tree('-r', 'HEAD', no_commit_id=True,
|
||||||
|
name_only=True).split("\n")
|
||||||
|
date = [time.strftime("%d. %B %Y %H:%M",
|
||||||
|
time.localtime(headcommit.authored_date)),
|
||||||
time.strftime("%d", time.localtime(headcommit.authored_date)),
|
time.strftime("%d", time.localtime(headcommit.authored_date)),
|
||||||
time.strftime("%m", time.localtime(headcommit.authored_date)),
|
time.strftime("%m", time.localtime(headcommit.authored_date)),
|
||||||
time.strftime("%Y", time.localtime(headcommit.authored_date)),
|
time.strftime("%Y", time.localtime(headcommit.authored_date)),
|
||||||
@ -25,18 +31,15 @@ date = [time.strftime("%d. %B %Y %H:%M", time.localtime(headcommit.authored_date
|
|||||||
time.strftime("%M", time.localtime(headcommit.authored_date))]
|
time.strftime("%M", time.localtime(headcommit.authored_date))]
|
||||||
author = [headcommit.author.name, headcommit.author.email]
|
author = [headcommit.author.name, headcommit.author.email]
|
||||||
commit = [headcommit.hexsha, headcommit.hexsha[:6]]
|
commit = [headcommit.hexsha, headcommit.hexsha[:6]]
|
||||||
#commit = git.log('-1', format='%h').rstrip()
|
|
||||||
|
|
||||||
#cmt = subprocess.check_output('git log -1 --format="%s" ', shell=True).decode("utf-8").rstrip()
|
|
||||||
|
|
||||||
|
# iterate through all files and write the gfi help-files
|
||||||
for fl in commFiles:
|
for fl in commFiles:
|
||||||
flname, flext = os.path.splitext(fl)
|
flname, flext = os.path.splitext(fl)
|
||||||
if flext == '.tex':
|
if flext == '.tex':
|
||||||
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
||||||
f.write("% gitfile-info control file\n")
|
f.write("% gitfile-info control file\n")
|
||||||
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3] + "}{"
|
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3]
|
||||||
+ date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
+ "}{" + date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
||||||
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
||||||
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
||||||
#print("\\gfiSet{" + date + "}{" + author + "}{" + commit + "}")
|
|
||||||
f.close
|
f.close
|
||||||
|
17
post-merge
17
post-merge
@ -6,8 +6,12 @@ import time
|
|||||||
import codecs
|
import codecs
|
||||||
from git import Repo
|
from git import Repo
|
||||||
import locale
|
import locale
|
||||||
|
# Locales for date set up to de_DE
|
||||||
|
# Please edit to you needs
|
||||||
locale.setlocale(locale.LC_ALL, 'de_DE')
|
locale.setlocale(locale.LC_ALL, 'de_DE')
|
||||||
|
|
||||||
|
# set up the git repo
|
||||||
|
# path is the current working directory
|
||||||
pathrepo = os.getcwd()
|
pathrepo = os.getcwd()
|
||||||
repo = Repo(pathrepo)
|
repo = Repo(pathrepo)
|
||||||
assert not repo.bare
|
assert not repo.bare
|
||||||
@ -15,11 +19,11 @@ git = repo.git
|
|||||||
headcommit = repo.head.commit
|
headcommit = repo.head.commit
|
||||||
index = repo.index
|
index = repo.index
|
||||||
|
|
||||||
commFiles = git.diff_tree('-r', 'ORIG_HEAD', 'HEAD', no_commit_id=True, name_only=True).split("\n")
|
# get the commited/changed files and date/author/commit
|
||||||
#commit = git.log('-1', format='%h').rstrip()
|
commFiles = git.diff_tree('-r', 'ORIG_HEAD', 'HEAD',
|
||||||
|
no_commit_id=True, name_only=True).split("\n")
|
||||||
#cmt = subprocess.check_output('git log -1 --format="%s" ', shell=True).decode("utf-8").rstrip()
|
|
||||||
|
|
||||||
|
# iterate through all files and write the gfi help-files
|
||||||
for fl in commFiles:
|
for fl in commFiles:
|
||||||
flname, flext = os.path.splitext(fl)
|
flname, flext = os.path.splitext(fl)
|
||||||
if flext == '.tex':
|
if flext == '.tex':
|
||||||
@ -36,9 +40,8 @@ for fl in commFiles:
|
|||||||
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
|
git.log('-1', fl, pretty='format:"%h"').split('"')[1]]
|
||||||
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
f = codecs.open(flname+".gfi", "w", encoding="utf-8")
|
||||||
f.write("% gitfile-info control file\n")
|
f.write("% gitfile-info control file\n")
|
||||||
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3] + "}{"
|
f.write("\\gfiSetDate{" + date[1] + "}{" + date[2] + "}{" + date[3]
|
||||||
+ date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
+ "}{" + date[4] + "}{" + date[5] + "}{" + date[0] + "}\n")
|
||||||
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
f.write("\\gfiSetAuthor{" + author[0] + "}{" + author[1] + "}\n")
|
||||||
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
f.write("\\gfiSetCommit{" + commit[0] + "}{" + commit[1] + "}")
|
||||||
#print("\\gfiSet{" + date + "}{" + author + "}{" + commit + "}")
|
|
||||||
f.close
|
f.close
|
||||||
|
Loading…
Reference in New Issue
Block a user