ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/svnadmin/hooks/scripts/detect-merge-conflicts.sh
Revision: 6421
Committed: Sat Nov 30 20:59:17 2013 UTC (10 years, 5 months ago) by laffer1
Content type: application/x-sh
File size: 965 byte(s)
Log Message:
create initial svn hooks for src based on mports hooks

File Contents

# Content
1 #!/bin/sh
2 #
3 # $MidnightBSD$
4 # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/detect-merge-conflicts.sh
5
6 # A pre-commit hook to detect changes that look like forgotten
7 # conflict markers. If any additions starting with '>>>>>>>'
8 # or '<<<<<<<' are found, the commit is aborted with a nice
9 # error message.
10 #
11
12 REPO=$1
13 TXN=$2
14
15 SVNLOOK=/usr/local/bin/svnlook
16
17 # Check arguments
18 if [ -z "$REPO" -o -z "$TXN" ]; then
19 echo "Syntax: $0 path_to_repos txn_id" >&2
20 exit 1
21 fi
22
23 # We scan through the transaction diff, looking for things that look
24 # like conflict markers. If we find one, we abort the commit.
25 SUSPICIOUS=$($SVNLOOK diff -t "$TXN" "$REPO" | grep -E '^\+(<{7} \.|>{7} \.)' | wc -l)
26
27 if [ $SUSPICIOUS -ne 0 ]; then
28 echo "Some parts of your commit look suspiciously like merge" >&2
29 echo "conflict markers. Please double-check your diff and try" >&2
30 echo "committing again." >&2
31 exit 1
32 fi
33
34 # No conflict markers detected, let it fly!
35 exit 0

Properties

Name Value
svn:executable *