feat: set svn:author revprop after commit/tag to preserve real author
This commit is contained in:
@@ -407,6 +407,19 @@ def _sync_git_to_svn_impl(mirror: Mirror) -> int:
|
|||||||
)
|
)
|
||||||
new_rev = _parse_commit_revision(result)
|
new_rev = _parse_commit_revision(result)
|
||||||
|
|
||||||
|
# Restore the real author as svn:author revprop
|
||||||
|
try:
|
||||||
|
_run_svn(
|
||||||
|
["propset", "--revprop", "-r", str(new_rev),
|
||||||
|
"svn:author", svn_username],
|
||||||
|
timeout=30, auth_args=auth_args, wc=wc,
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.warning(
|
||||||
|
"Could not set svn:author for r%d (pre-revprop-change hook?)",
|
||||||
|
new_rev,
|
||||||
|
)
|
||||||
|
|
||||||
mirror.db.record_mapping(
|
mirror.db.record_mapping(
|
||||||
new_rev, commit_hash, svn_branch,
|
new_rev, commit_hash, svn_branch,
|
||||||
_git_ref_from_branch(svn_branch, svn_cfg),
|
_git_ref_from_branch(svn_branch, svn_cfg),
|
||||||
@@ -454,6 +467,20 @@ def _sync_git_to_svn_impl(mirror: Mirror) -> int:
|
|||||||
)
|
)
|
||||||
new_rev = _parse_commit_revision(result)
|
new_rev = _parse_commit_revision(result)
|
||||||
|
|
||||||
|
# Restore the real author as svn:author revprop
|
||||||
|
try:
|
||||||
|
svn_root = svn_cfg.url.rstrip("/")
|
||||||
|
_run_svn(
|
||||||
|
["propset", "--revprop", "-r", str(new_rev),
|
||||||
|
"svn:author", svn_username, svn_root],
|
||||||
|
timeout=30, auth_args=auth_args,
|
||||||
|
)
|
||||||
|
except Exception:
|
||||||
|
logger.warning(
|
||||||
|
"Could not set svn:author for r%d (pre-revprop-change hook?)",
|
||||||
|
new_rev,
|
||||||
|
)
|
||||||
|
|
||||||
# The commit hash stored for a tag is the target commit hash
|
# The commit hash stored for a tag is the target commit hash
|
||||||
target = _git(git_dir, "rev-parse", tag_ref, timeout=30)
|
target = _git(git_dir, "rev-parse", tag_ref, timeout=30)
|
||||||
mirror.db.record_mapping(
|
mirror.db.record_mapping(
|
||||||
|
|||||||
Reference in New Issue
Block a user