Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Again, every Git commit made by those authors will be translated with author set to jdoe. SVN revisions made by jdoe is always set to first matching Git user in the authors files – John Doe <john_doe@example.com> in this particular case.

Changes made to authors files are being applied immediately, there is no need to restart mirroring or reinstall SubGit.

Scriptable Authors Mapping

In addition to the authors filefiles, there 's is another way to provide establish SVN to Git authors mapping using authors helper program. The authors helper is an executable - script – script or binary - that – that is able to read data from standard input and provide send its work result to the standard output. The data helper reads from input and the data helper provides to output must fulfill certain formatInput and output data must fulfil the following formats:

  • for Git to Subversion mapping:

    No Format
    INPUT:
    Author Name author email OUTPUT: Subversionuser
     
       author Name
       author email
    OUTPUT: 
       subversion_user_name
  • for Subversion to Git mapping:

    No Format
    INPUT:
    Subversionusername OUTPUT: Author Name author
     
       subversion_user_name
    OUTPUT: 
       author Name
       author email

Every time SubGit finds needs to map an author name during translation, it invokes the authors mapping helper program, passes the name to it and expects the helper to answer with matching author name.

The authors helper program might be extremely useful especially when you have many authors and the authors list is constantly changing - new – new users are being added, names and emails changes and so on. If you use some catalog to store accounts - LDAP– LDAP, Active Directory, OpenID and so forth - you – you can create a script that will gather needed information from the catalog and provide it to SubGit.

During On configuration or installation phase SubGit places simple creates a simple authors.sh script into subgit/in samples directory subdirectory. This script doesn't do much useful, it 's just some 'proof of concept' that demonstrates how input data is being read and output data provided.

Expand
titleThe

...

simple authors helper script
#!/bin/sh
while read input
    do
      if [ -z "$name" ]; then
        name="$input"
      elif [ -z "$email" ]; then
       email="$input"
      fi
    done

    if [ -z "$email" ]; then
      echo Full Name
      echo author@email.com
    else
      echo shortSvnUserName
    fi

...

exit 0;

For more details on the authors helper see Script-provided authors mapping article.

Depending on what was sent to its input script returns either Git author name and email or SVN short name. It can be extended to, say, receive the data from catalog or database thereby facilitate the authors mapping.