From 369477b9e5ba130fb76b1cb3ad8321817b4f1a08 Mon Sep 17 00:00:00 2001 From: Jean-Marc Martins Date: Fri, 13 Sep 2013 17:21:50 +0200 Subject: [PATCH] =?UTF-8?q?Adds=20the=20committer=20in=20the=20config=20+?= =?UTF-8?q?=20python3=C2=A0support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config | 5 +++++ radicale/config.py | 3 +++ radicale/storage/filesystem.py | 10 ++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config b/config index 75b12bd..1138ccb 100644 --- a/config +++ b/config @@ -94,6 +94,11 @@ http_user_parameter = http_password_parameter = +[git] +# Git default options +committer = Firstname Lastname + + [rights] # Rights management method # Value: None | owner_only | owner_write | from_file diff --git a/radicale/config.py b/radicale/config.py index 44d057e..8e23c20 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -72,6 +72,9 @@ INITIAL_CONFIG = { "http_url": "", "http_user_parameter": "", "http_password_parameter": ""}, + "git": { + "committer": "Firstname Lastname ", + }, "rights": { "type": "None", "file": "~/.config/radicale/rights"}, diff --git a/radicale/storage/filesystem.py b/radicale/storage/filesystem.py index a08c0ff..15e8e8b 100644 --- a/radicale/storage/filesystem.py +++ b/radicale/storage/filesystem.py @@ -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