summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--NEWS5
-rw-r--r--configure.in.in2
-rwxr-xr-xscripts/xdt-commit66
4 files changed, 63 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cde6fe..05118d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-18 Brian Tarricone <bjt23@cornell.edu>
+
+ * scripts/xdt-commit: Support git/git-svn as well as svn (bug 4491).
+ * configure.in.in: Re-add 'svn' version tag.
+
2008-10-12 Brian Tarricone <bjt23@cornell.edu>
* scripts/xdt-autogen.in: Only attempt to patch intltool merge for
diff --git a/NEWS b/NEWS
index feb5fb2..6abc045 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+4.5.92
+======
+
+- Add support for git (and git-svn) to the xdt-commit script (bug 4491).
+
4.5.91
======
diff --git a/configure.in.in b/configure.in.in
index 8f814b3..3a247f6 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -14,7 +14,7 @@ m4_define([xdt_version_minor], [5])
m4_define([xdt_version_micro], [91])
m4_define([xdt_version_nano], [])
m4_define([xdt_version_build], [r@REVISION@])
-m4_define([xdt_version_tag], [])
+m4_define([xdt_version_tag], [svn])
m4_define([xdt_version], [xdt_version_major().xdt_version_minor().xdt_version_micro()ifelse(xdt_version_nano(), [], [], [.xdt_version_nano()])ifelse(xdt_version_tag(), [svn], [xdt_version_tag()-xdt_version_build()], [])])
diff --git a/scripts/xdt-commit b/scripts/xdt-commit
index cab95ae..2fe6bd0 100755
--- a/scripts/xdt-commit
+++ b/scripts/xdt-commit
@@ -26,20 +26,39 @@
##
-## Check if SVN is installed
+## Check what kind of repo we have
##
-if ! type svn &> /dev/null; then
- echo "Subversion needs to be installed."
+if [ -d .git ]; then
+ repo_type=git
+elif [ -d .svn ]; then
+ repo_type=svn
+else
+ echo "This doesn't appear to be the root of a versioned source tree." >&2
exit 1
fi
##
-## Check if we are in a versioned directory
+## Check if needed tools are installed
##
-if ! svn info &> /dev/null; then
- echo "Current working directory is not versioned."
- exit 1
+if [ "$repo_type" = "git" ]; then
+ if ! type git &>/dev/null; then
+ echo "Git needs to be installed." >&2
+ exit 1
+ fi
+elif [ "$repo_type" = "svn" ]; then
+ if ! type svn &> /dev/null; then
+ echo "Subversion needs to be installed." >&2
+ exit 1
+ fi
+
+ ##
+ ## Check if we are in a versioned directory
+ ##
+ if ! svn info &> /dev/null; then
+ echo "Current working directory is not versioned." >&2
+ exit 1
+ fi
fi
@@ -53,7 +72,7 @@ FILES=$*
## Detect all ChangeLog's inside this directory by scanning it
## recursively
##
-CHANGELOGS=$(find . -type f -iname ChangeLog)
+CHANGELOGS=$(find . -type f -iname ChangeLog | sed 's:^\./::')
##
@@ -62,14 +81,25 @@ CHANGELOGS=$(find . -type f -iname ChangeLog)
for CHANGELOG in $CHANGELOGS; do
# Make sure the file exists
if [ -f "$CHANGELOG" ]; then
- # Determine SVN status
- STATUS=$(svn status "${CHANGELOG}")
- STATUS=${STATUS:0:1}
+ if [ "$repo_type" = "svn" ]; then
+ # Determine SVN status
+ STATUS=$(svn status "${CHANGELOG}")
+ STATUS=${STATUS:0:1}
+ elif [ "$repo_type" = "git" ]; then
+ # Determine git status, and fake it into svn-style status
+ STATUS=$(git status | grep -E "(modified|new file):[[:space:]]+${CHANGELOG}")
+ [ "$STATUS" ] || STATUS='?' # signal no changes or not versioned
+ fi
# Check if file is versioned
if [ "$STATUS" != "?" ]; then
# Parse output
- MSG=$(svn diff "${CHANGELOG}" | grep -P '^\+\t' | sed 's/^+//')
+ if [ "$repo_type" = "svn" ]; then
+ MSG=$(svn diff "${CHANGELOG}")
+ elif [ "$repo_type" = "git" ]; then
+ MSG=$(git diff HEAD "${CHANGELOG}")
+ fi
+ MSG=$(echo "$MSG" | grep -P '^\+\t' | sed 's/^+//')
# Append to commit message (and insert newline between ChangeLogs)
if [ -z "$COMMIT_MSG" ]; then
@@ -87,7 +117,15 @@ done
## files is empty, ask the user to enter a commit message himself
##
if [ -n "$COMMIT_MSG" ]; then
- svn commit $FILES -m "$COMMIT_MSG"
+ if [ "$repo_type" = "svn" ]; then
+ svn commit $FILES -m "$COMMIT_MSG"
+ elif [ "$repo_type" = "git" ]; then
+ git commit $FILES -m "$COMMIT_MSG"
+ fi
else
- svn commit $FILES
+ if [ "$repo_type" = "svn" ]; then
+ svn commit $FILES
+ elif [ "$repo_type" = "git" ]; then
+ git commit $FILES
+ fi
fi