[Checkins] SVN: Sandbox/ctheune/foundation/fix-copyright.sh Keep all working directories of one project together.

Christian Theune ct at gocept.com
Mon Nov 2 03:36:54 EST 2009


Log message for revision 105435:
  Keep all working directories of one project together.
  
  Commit if changes are there and applied cleanly.
  

Changed:
  U   Sandbox/ctheune/foundation/fix-copyright.sh

-=-
Modified: Sandbox/ctheune/foundation/fix-copyright.sh
===================================================================
--- Sandbox/ctheune/foundation/fix-copyright.sh	2009-11-02 08:33:42 UTC (rev 105434)
+++ Sandbox/ctheune/foundation/fix-copyright.sh	2009-11-02 08:36:53 UTC (rev 105435)
@@ -1,7 +1,6 @@
 #!/bin/bash
 set -e
 
-# XXX Do we really want to check in?
 # What happens if we run the fix script but no changes are there? (E.g. due to
 # a re-run? IN this case we should also  not commit (check output of svn
 # stat?)
@@ -40,12 +39,10 @@
 function fix_one() {
     local url="$1"
     local tag="$2"
-    local workdir="${PROJECT}-${tag}-copyrightfix"
+    local workdir="${PROJECT}-copyrightfix/${tag}"
     echo
     echo "Fixing ${url}"
-    if [[ -a ${workdir} ]]; then
-        echo "Working directory already exists, skipping checkout."
-    else
+    if [[ ! -a ${workdir} ]]; then
         svn -q co ${url} ${workdir}
     fi
     ${FIXSCRIPT} --owner "Zope Foundation and Contributors." ${workdir}
@@ -55,8 +52,14 @@
         egrep --color=never -niIr "Copyright \(c\).*Zope Corporation" ${workdir}
         return
     fi
-    svn -q commit ${workdir} \
-        -m "Updating copyright header after transfer of ownership to the Zope Foundation"
+    local changes=$(svn stat ${workdir}|egrep "^M"|wc -l)
+    if [[ $changes -gt 0 ]]; then
+        echo "Changes applied successfully, committing..."
+        svn -q commit ${workdir} \
+            -m "Updating copyright header after transfer of ownership to the Zope Foundation"
+    else
+        echo "No changes needed."
+    fi
     rm -rf ${workdir}
 }
 
@@ -91,3 +94,8 @@
 for branch in $(choose_branches); do
     fix_one "${BASEURL}/branches/${branch}" "${branch}"
 done
+
+workingdirs=$(ls ${PROJECT}-copyrightfix)
+if [[ -z $workingdirs ]]; then
+    rm -r ${PROJECT}-copyrightfix
+fi



More information about the checkins mailing list