Adds the committer in the config + python3 support
This commit is contained in:
parent
87ec798f37
commit
fe28b040bd
5
config
5
config
@ -94,6 +94,11 @@ http_user_parameter =
|
||||
http_password_parameter =
|
||||
|
||||
|
||||
[git]
|
||||
# Git default options
|
||||
committer = Firstname Lastname <Radicale@Radicale.org>
|
||||
|
||||
|
||||
[rights]
|
||||
# Rights management method
|
||||
# Value: None | owner_only | owner_write | from_file
|
||||
|
@ -72,6 +72,9 @@ INITIAL_CONFIG = {
|
||||
"http_url": "",
|
||||
"http_user_parameter": "",
|
||||
"http_password_parameter": ""},
|
||||
"git": {
|
||||
"committer": "Firstname Lastname <Radicale@Radicale.org>",
|
||||
},
|
||||
"rights": {
|
||||
"type": "None",
|
||||
"file": "~/.config/radicale/rights"},
|
||||
|
@ -26,16 +26,17 @@ import os
|
||||
import posixpath
|
||||
import json
|
||||
import time
|
||||
import sys
|
||||
from contextlib import contextmanager
|
||||
from .. import config, ical
|
||||
|
||||
|
||||
FOLDER = os.path.expanduser(config.get("storage", "filesystem_folder"))
|
||||
|
||||
FILESYSTEM_ENCODING = sys.getfilesystemencoding()
|
||||
|
||||
try:
|
||||
from dulwich.repo import Repo
|
||||
GIT_REPOSITORY = Repo(FOLDER)
|
||||
GIT_REPOSITORY = Repo(FOLDER).encode(FILESYSTEM_ENCODING)
|
||||
except:
|
||||
GIT_REPOSITORY = None
|
||||
|
||||
@ -52,8 +53,9 @@ def open(path, mode="r"):
|
||||
# On exit
|
||||
if GIT_REPOSITORY and mode == "w":
|
||||
path = os.path.relpath(abs_path, FOLDER)
|
||||
GIT_REPOSITORY.stage([path.encode("utf-8")])
|
||||
GIT_REPOSITORY.do_commit("Commit by Radicale")
|
||||
GIT_REPOSITORY.stage([path.encode(FILESYSTEM_ENCODING)])
|
||||
committer = config.get("git", "committer")
|
||||
GIT_REPOSITORY.do_commit("Commit by Radicale", committer=committer)
|
||||
# pylint: enable=W0622
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user