-->

SubGit: use svn.svnCommitMessage option

2019-07-27 14:01发布

问题:

Just seen this feature in the SubGit 3.2.4 release notes:

Support for svn.gitCommitMessage and svn.svnCommitMessage options that allow specifying message patterns used by SubGit while generating commit messages.

But i cannot find any example on the syntax. I want to do a one time import, so i guess i run

subgit configure SVN_REPO repo.git

then edit repo.git/subgit/config and add gitCommitMessage to the svn section. But what are the variables/placeholders i can use?

回答1:

Here are the placeholders that can be used:

  • %author = Git author (available in both directions)
  • %committer = Git committer (available in both directions)
  • %date = date of revision or commit (available in both direction)
  • %message = original message (available in both direction)
  • %note = Git commit note stored at refs/notes/commits (available in Git => SVN direction)
  • %note(refs/notes/namespace) = Git commit note stored at refs/notes/namespace (available in Git => SVN direction)
  • %commit = Git commit hash (available in Git => SVN direction)
  • %svnUser = Subversion username (available in both directions)
  • %revision = Subversion revision, GRN in your notation (available in SVN => Git direction)
  • %branch = Subversion branch (available in both directions)
  • \n = newline feed (available in both directions)

Examples:

[svn]
svnCommitMessage = "%message\n\nr%revision %branch"

or

[svn]
svnCommitMessage = "%message\n%note(refs/notes/test)\n\nr%revision %branch"


回答2:

sorry to answer that late. Now the information is available in the documentation, namely:

the svnCommitMessage option description:

https://subgit.com/config-options.html#svn.svnCommitMessage

available placeholders:

%author = Git author    
%committer = Git committer    
%date = Git commit date    
%message = original message    
%note = Git commit note stored under refs/notes/commits    
%note(refs/notes/namespace) = Git commit note stored under 
refs/notes/namespace
%commit = Git commit hash
%svnUser = Subversion username
%branch = Subversion branch
\n = newline feed

the gitCommitMessage option description:

https://subgit.com/config-options.html#svn.gitCommitMessage

supported placeholders:

%author = Git author    
%committer = Git committer    
%date = date of revision    
%message = original message    
%svnUser = Subversion username    
%revision = Subversion revision, GRN in your notation    
%branch = Subversion branch    
\n = newline feed


标签: git svn subgit