From a07da8a4e351226a04df300eac81c84eb8ee360b Mon Sep 17 00:00:00 2001 From: Tony Duckles Date: Sat, 24 Mar 2012 15:05:33 -0500 Subject: [PATCH] For options.keep_author, update via post-commit rev-prop Rather than using "svn commit --username %author%", mirror the source author info by setting the "svn:author" revprop post-commit the same as we do for "svn:date" (options.keep_date). This frees us up to be able to use --username in the future for legitimate source/target repo auth. * svn2svn/run/svn2svn.py (commit_from_svn_log_entry): Update "svn:author" via post-commit revprop rather than --username. * README.mkd: Reflect new "svn:author" handling. --- README.mkd | 10 ++++------ svn2svn/run/svn2svn.py | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.mkd b/README.mkd index 3ad35fe..3395dc7 100644 --- a/README.mkd +++ b/README.mkd @@ -8,12 +8,10 @@ Features an empty target repo or simply an empty folder/branch in the target repo. - **Maintains logical history (when possible)**, e.g. uses "svn copy" for renames. - **Maintains original commit messages**. -- **Optionally maintain source commit authors (`svn:author`)**. Requires non-authenticated - access to the target repo, since this relies upon the `--username` SVN - command-line arg. -- **Optionally maintain source commit timestamps (`svn:date`)**. Requires a - "pre-revprop-change" hook script in the target repo, to be able to change - the "`svn:date`" revprops after target commits have been made. +- **Optionally maintain source commit authors (`svn:author`) and commit timestamps + (`svn:date`)**. Requires a "pre-revprop-change" hook script in the target + repo, to be able to change the "`svn:author`" and "`svn:date`" revprops after + target commits have been made. - **Optionally maintain identical revision #'s between source vs. target repo**. Effectively requires that you're replaying into an empty target repo, or rather that the first source repo revision to be replayed is less than diff --git a/svn2svn/run/svn2svn.py b/svn2svn/run/svn2svn.py index a284f29..db0b0b0 100644 --- a/svn2svn/run/svn2svn.py +++ b/svn2svn/run/svn2svn.py @@ -66,8 +66,6 @@ def commit_from_svn_log_entry(log_entry, commit_paths=None, target_revprops=None message += "\nDate: " + svn_date if options.log_author: message += "\nAuthor: " + log_entry['author'] - if options.keep_author: - args += ["--username", log_entry['author']] args += ["-m", message] revprops = {} if log_entry['revprops']: @@ -102,6 +100,8 @@ def commit_from_svn_log_entry(log_entry, commit_paths=None, target_revprops=None ui.status("Committed revision %s.", rev_num) if options.keep_date: run_svn(["propset", "--revprop", "-r", rev_num, "svn:date", log_entry['date_raw']]) + if options.keep_author: + run_svn(["propset", "--revprop", "-r", rev_num, "svn:author", log_entry['author']]) bh.disable() # Check if the user tried to press Ctrl-C if bh.trapped: @@ -1180,7 +1180,7 @@ Examples: "maintain same commit author, same commit time, and file/dir properties") parser.add_option("-U", "--keep-author", action="store_true", dest="keep_author", default=False, help="maintain same commit authors (svn:author) as source\n" - "(REQUIRES target_url be non-auth'd, e.g. file://-based, since this uses --username to set author)") + "(REQUIRES 'pre-revprop-change' hook script to allow 'svn:author' changes)") parser.add_option("-D", "--keep-date", action="store_true", dest="keep_date", default=False, help="maintain same commit time (svn:date) as source\n" "(REQUIRES 'pre-revprop-change' hook script to allow 'svn:date' changes)") -- 2.45.2