[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Copying commited WC

From: Nick Patavalis <npat_at_efault.net>
Date: 2005-01-05 03:20:37 CET

On 2005-01-04, Sean Laurent <sean@neuronfarm.com> wrote:
> *kicks himself* D'oh! Now that I re-read your original message, I
> understand. Now, I believe someone else has already encountered this
> problem:
> http://svn.haxx.se/users/archive-2004-08/0359.shtml
> Ben Collins-Sussman responded with "Holy unexplained behavior, Batman!":
> http://svn.haxx.se/users/archive-2004-08/0491.shtml
> He also filed issue 1994 which shows that it was fixed in r10528 on Mon Aug 9
> at 11:58:01.
> http://subversion.tigris.org/issues/show_bug.cgi?id=1994

Interesting. So copying a mixed revision WC should work, but it

Getting back to my problem, of trying to copy a WC, I wrote the
following bash shell script. The idea is for it to work correctly with
WCs that are not *intentionally* mixed-revision, and fail gracefully
in all other cases.

  is_update_trivial() {
    return 0
  if [ $# -ne 1 ]; then
    echo "Usage is: $(basename $0) <URL>" 1>&2
    exit 1
  rr=$(svnversion . | grep '^[0-9]\+\(:[0-9]\+\)\?[MS]\?$')
  [ -z "$rr" ] && { echo "Cannot determine WC rev" 1>&2; exit 1; }
  rmin=$(echo $rr | cut -d: -f1 | sed 's/^\([0-9]\+\)[MS]\?$/\1/')
  rmax=$(echo $rr | cut -d: -f2 | sed 's/^\([0-9]\+\)[MS]\?$/\1/')
  if [ x"$rmin" != x"$rmax" ]; then
    echo "Mixed revisions WC"
    if is_update_trivial $rmax; then
      echo "Bringing WC forward to r$rmax"
      svn --non-interactive --quiet up -r $rmax .
      echo "WC not up to date! Up it and call again." 1>&2
      exit 1
  svn --non-interactive --quiet cp . "$2"

As you can see what is missing is the implementation of the
"is_update_trivial()" function, which is something I can't figure out
how to approach. The "is_update_trivial()" function must answer the
following question:

   "will an update of the WC to revision $rmax modify any files?"

Any ideas would be greatly appreciated.

Thanks in advance

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Jan 5 03:27:24 2005

This is an archived mail posted to the Subversion Users mailing list.