From 6c413b6191856848f533c7aee259fe72fd350aab Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Thu, 16 Jul 2026 16:10:32 +0200 Subject: [PATCH] fix: handle empty svn commit output (no-op) gracefully --- svn_mirror/git_to_svn.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/svn_mirror/git_to_svn.py b/svn_mirror/git_to_svn.py index 060a160..6399fe2 100644 --- a/svn_mirror/git_to_svn.py +++ b/svn_mirror/git_to_svn.py @@ -500,7 +500,28 @@ def _sync_git_to_svn_impl(mirror: Mirror) -> int: input=message.encode("utf-8"), wc=wc, timeout=120, auth_args=auth_args, ) - new_rev = _parse_commit_revision(result) + try: + new_rev = _parse_commit_revision(result) + except GitToSVNError: + logger.warning( + "svn commit no-op for %s on %s – recording HEAD", + commit_hash[:8], svn_branch, + ) + info = subprocess.run( + ["svnversion", str(wc)], + capture_output=True, text=True, timeout=30, + env={**os.environ, "LC_ALL": "C"}, + ) + rev_text = (info.stdout or "").strip().split(":")[0] + try: + new_rev = int(rev_text) + except (ValueError, TypeError): + logger.warning( + "Cannot determine current SVN revision for %s – " + "skipping mapping", + svn_branch, + ) + continue # Restore the real author as svn:author revprop try: