]> Tony Duckles's Git Repositories (git.nynim.org) - svn2svn.git/blob - tests/make-replay-repo.sh
Initial rev_map support handling and better svn-copy handling
[svn2svn.git] / tests / make-replay-repo.sh
1 #!/bin/sh
2 # Use svn2svn.py to create a filtered repo with only /trunk history
3
4 PWD=$(pwd)
5 REPO="$PWD/_repo_replay"
6 REPOURL="file://$REPO"
7
8 # Clean-up
9 echo "Cleaning-up..."
10 rm -rf $REPO _dup_wc
11
12 # Init repo
13 echo "Creating _repo_replay..."
14 svnadmin create $REPO
15 # Add pre-revprop-change hook script, which is required by svn2svn
16 cat > $REPO/hooks/pre-revprop-change << EOF
17 #!/bin/sh
18
19 # PRE-REVPROP-CHANGE HOOK
20
21 # The pre-revprop-change hook is invoked before a revision property
22 # is added, modified or deleted. Subversion runs this hook by invoking
23 # a program (script, executable, binary, etc.) named 'pre-revprop-change'
24 # (for which this file is a template), with the following ordered
25 # arguments:
26 #
27 # [1] REPOS-PATH (the path to this repository)
28 # [2] REVISION (the revision being tweaked)
29 # [3] USER (the username of the person tweaking the property)
30 # [4] PROPNAME (the property being set on the revision)
31 # [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted)
32 #
33 # [STDIN] PROPVAL ** the new property value is passed via STDIN.
34 #
35 # If the hook program exits with success, the propchange happens; but
36 # if it exits with failure (non-zero), the propchange doesn't happen.
37 # The hook program can use the 'svnlook' utility to examine the
38 # existing value of the revision property.
39 #
40 # WARNING: unlike other hooks, this hook MUST exist for revision
41 # properties to be changed. If the hook does not exist, Subversion
42 # will behave as if the hook were present, but failed. The reason
43 # for this is that revision properties are UNVERSIONED, meaning that
44 # a successful propchange is destructive; the old value is gone
45 # forever. We recommend the hook back up the old value somewhere.
46 #
47 # On a Unix system, the normal procedure is to have 'pre-revprop-change'
48 # invoke other programs to do the real work, though it may do the
49 # work itself too.
50 #
51 # Note that 'pre-revprop-change' must be executable by the user(s) who will
52 # invoke it (typically the user httpd runs as), and that user must
53 # have filesystem-level permission to access the repository.
54 #
55 # On a Windows system, you should name the hook program
56 # 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
57 # but the basic idea is the same.
58 #
59 # The hook program typically does not inherit the environment of
60 # its parent process. For example, a common problem is for the
61 # PATH environment variable to not be set to its usual value, so
62 # that subprograms fail to launch unless invoked via absolute path.
63 # If you're having unexpected problems with a hook program, the
64 # culprit may be unusual (or missing) environment variables.
65 #
66 # Here is an example hook script, for a Unix /bin/sh interpreter.
67 # For more examples and pre-written hooks, see those in
68 # the Subversion repository at
69 # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
70 # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
71
72 REPOS="\$1"
73 REV="\$2"
74 USER="\$3"
75 PROPNAME="\$4"
76 ACTION="\$5"
77
78 echo "pre-revprop-change: REPOS=\$1 REV=\$2 USER=\$3 PROPNAME=\$4 ACTION=\$5" >&2
79
80 # Allow modifying svn:log
81 if [ "\$ACTION" = "M" -a "\$PROPNAME" = "svn:log" ]; then exit 0; fi
82 # Allow svn2svn to add svn2svn source-tracking properties
83 if [ "\$ACTION" = "A" -a "\$PROPNAME" = "svn2svn:source_uuid" ]; then exit 0; fi
84 if [ "\$ACTION" = "A" -a "\$PROPNAME" = "svn2svn:source_url" ]; then exit 0; fi
85 if [ "\$ACTION" = "A" -a "\$PROPNAME" = "svn2svn:source_rev" ]; then exit 0; fi
86
87 echo "Changing revision property \$PROPNAME is prohibited" >&2
88 exit 1
89 EOF
90 chmod 755 $REPO/hooks/pre-revprop-change
91 svn mkdir -q -m "Add /trunk" $REPOURL/trunk
92
93 # svn2svn
94 ../svn2svn.py -a file://$PWD/_repo_ref/trunk file://$PWD/_repo_replay/trunk