Raising subversion for a pleasant development

    One fine day I was tired of uploading to ftp \ ssh all the changes made to the project. At this point, I already nurtured the idea of ​​moving the development under the control of SVN - version control, still a nice thing. As a result, it was decided to combine business with pleasure - both version control and automatic updating of the project. According to tradition, the narration will be conducted on the example of my beloved debian.
    A note can be considered a supplement to the article svn tips (at least the first paragraph).

    About the installation \ configuration of SVN can be read in the following topics:We create an init-script to launch the svn-server with the system (initially - the script was found somewhere on the Internet. It seems that I changed something in it :)).
    /etc/init.d/svn :
    #! / bin / sh -e
    #
    # Default-start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Get LSB functions
    . / lib / lsb / init-functions
    . / etc / default / rcS
    SVNSERVE = / usr / bin / svnserve
    SVN_USER = subversion
    SVN_GROUP = www-data
    SVN_REPO_PATH = / usr / share / svn /
    # Check that the package is still installed
    [-x $ SVNSERVE] || exit 0;
    case "$ 1" in
     start)
      log_begin_msg "Starting svnserve ..."
      umask 002
      if start-stop-daemon --start --chuid $ SVN_USER: $ SVN_GROUP --exec $ SVNSERVE - -d -r $ SVN_REPO_PATH
      then
       log_end_msg 0
      else
       log_end_msg $?
      fi
     ;;
     stop)
      log_begin_msg "Stopping svnserve ..."
      if start-stop-daemon --stop --exec $ SVNSERVE
      then
       log_end_msg 0
      else
       log_end_msg $?
      fi
     ;;
     restart | force-reload)
      "$ 0" stop && "$ 0" start
     ;;
     *)
      echo "Usage: /etc/init.d/svn {start | stop | restart | force-reload}"
      exit 1
     ;;
    esac
    exit 0
    We give everyone the right to execute, we strongly recommend that the system start svn at startup and at the same time start it:
    chmod a + x /etc/init.d/svn
    update-rc.d svn defaults
    invoke-rc.d svn start
    Set up a working copy update when committing - hook / usr / share / svn / hooks / post-commit :
    #! / bin / sh
    exec> / tmp / svnup 2> & 1
    # all script output will be directed to the / tmp / svnup file
    for path in `svnlook dirs-changed / usr / share / svn | fgrep '/ trunk /' | cut -d '/' -f 2- | sort -u`
    # get the list of directories changed in the commit, cut off the first
    # part (in my turnip - / trunk) and, if there is such a way - do svn up there
    do
            if [-d "/ var / www / $ path"]
            then
                    echo $ path
                    / usr / bin / svn up -N / var / www / $ path
            fi
    done
    Do not forget to issue the right to execute:
    chmod a + x / usr / share / svn / hooks / post-commit
    And also, make sure that the user subversion : www-data has write permissions to the necessary directories / var / www / $ path .
    Further work (arranging the repository) is already performed on the developer's machine (well, except perhaps - then upload the working copy on the server to the desired folder).
    And, as usual, I hope that the material will be useful to someone.

    Also popular now: