-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new option, --authors-prog, to git-svn that allows a more flexible alternative (or supplement) to --authors-file. This allows more advanced username operations than the authors file will allow. For example, one may look up Subversion users via LDAP, or may generate the name and email address from the Subversion username. Notes: * If both --authors-name and --authors-prog are given, the former is tried first, falling back to the later. * The program is called once per unique SVN username, and the result is cached. * The command-line argument must be the path to a program, not a generic shell command line. The absolute path to this program is taken at startup since the git-svn script changes directory during operation. * The option is not enabled for `git svn log'. [ew: fixed case where neither --authors-(name|prog) were defined] Signed-off-by: Mark Lodato <lodatom@gmail.com> Acked-by: Eric Wong <normalperson@yhbt.net>
- Loading branch information
Mark Lodato
authored and
Eric Wong
committed
May 21, 2009
1 parent
42a5da1
commit 36db1ed
Showing
3 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2009 Eric Wong, Mark Lodato | ||
# | ||
|
||
test_description='git svn authors prog tests' | ||
|
||
. ./lib-git-svn.sh | ||
|
||
cat > svn-authors-prog <<'EOF' | ||
#!/usr/bin/perl | ||
$_ = shift; | ||
if (s/-sub$//) { | ||
print "$_ <$_\@sub.example.com>\n"; | ||
} | ||
else { | ||
print "$_ <$_\@example.com>\n"; | ||
} | ||
EOF | ||
chmod +x svn-authors-prog | ||
|
||
cat > svn-authors <<'EOF' | ||
ff = FFFFFFF FFFFFFF <fFf@other.example.com> | ||
EOF | ||
|
||
test_expect_success 'setup svnrepo' ' | ||
for i in aa bb cc-sub dd-sub ee-foo ff | ||
do | ||
svn mkdir -m $i --username $i "$svnrepo"/$i | ||
done | ||
' | ||
|
||
test_expect_success 'import authors with prog and file' ' | ||
git svn clone --authors-prog=./svn-authors-prog \ | ||
--authors-file=svn-authors "$svnrepo" x | ||
' | ||
|
||
test_expect_success 'imported 6 revisions successfully' ' | ||
( | ||
cd x | ||
test "`git rev-list refs/remotes/git-svn | wc -l`" -eq 6 | ||
) | ||
' | ||
|
||
test_expect_success 'authors-prog ran correctly' ' | ||
( | ||
cd x | ||
git rev-list -1 --pretty=raw refs/remotes/git-svn~1 | \ | ||
grep "^author ee-foo <ee-foo@example\.com> " && | ||
git rev-list -1 --pretty=raw refs/remotes/git-svn~2 | \ | ||
grep "^author dd <dd@sub\.example\.com> " && | ||
git rev-list -1 --pretty=raw refs/remotes/git-svn~3 | \ | ||
grep "^author cc <cc@sub\.example\.com> " && | ||
git rev-list -1 --pretty=raw refs/remotes/git-svn~4 | \ | ||
grep "^author bb <bb@example\.com> " && | ||
git rev-list -1 --pretty=raw refs/remotes/git-svn~5 | \ | ||
grep "^author aa <aa@example\.com> " | ||
) | ||
' | ||
|
||
test_expect_success 'authors-file overrode authors-prog' ' | ||
( | ||
cd x | ||
git rev-list -1 --pretty=raw refs/remotes/git-svn | \ | ||
grep "^author FFFFFFF FFFFFFF <fFf@other\.example\.com> " | ||
) | ||
' | ||
|
||
test_done |