0

I'm writing a deployment bash script that will publish recent changes in source control to a different machine. I'm new to svn from the command line (have used it in development for years) and new to bash scripting.

I need a way to checkout only files that have been modified recently. Something like this:

svn checkout svn://server/repo/project/trunk -mtime -1d4h

The idea being this would only checkout files that have been committed within the last 28 hours.

Lightbeard
  • 4,011
  • 10
  • 49
  • 59
  • AFAIK there is no feature like that into SVN. You probably will need to write a script for that where will checkout with depth=empty, list the log , found the last commit into the last 28 hours and rollback wrapping the filenames updating each one... not so hard, but need some work... – ceinmart Mar 30 '14 at 01:18

2 Answers2

1
  1. You can't checkout changes, you get only some state of some part of repository (i.e "revision"), which will include all files, existing in this node (subdirectory) in this revision (and added|modified in any revision before this revision, including this revision)
  2. Date format specification in Subversion doesn't allow "relative date-time", only absolute values
  3. Scripts, which export|save outside repository all files, changed in revision|revision range, exist and can be found in Net (Subversion Command Line Script to export changed files as good bash-sample)

Consequences of the above notes

  • You must to supply correct Subversion-style date or revision number for starting point
  • Relative date with free-form specification can be easy constructed with bash date command (-d "28 hours before") and stored in variable, which can be used as parameter for electrictoolbox's script
  • Deploy of files from export-directory to final destination is final part (heavy environment-specific, no suggestions here now)
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
0

I found something simpler to suite my needs based on this: How can I keep the original file [commit] timestamp on Subversion?

I checkout or update a working copy of the project using --config-option config:miscellany:use-commit-times=yes which sets the timestamps on the filesystem equal to the last checkout time. I then use a standard find command. For example:

#!/bin/bash

function listfn {

   while read file; do

      if [[ !( $file =~ ^.*\.svn.*$ ) ]]; then
          echo $file
      fi

   done

}


svn checkout --config-option config:miscellany:use-commit-times=yes svn://server/repo/project/trunk project-fordeploy

find project-fordeploy -mtime -1d4h | listfn
Community
  • 1
  • 1
Lightbeard
  • 4,011
  • 10
  • 49
  • 59