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

Re: Newlines when setting svn:ignore from cmdline

From: jeremy hinds <jeremy.hinds_at_gmail.com>
Date: Thu, 17 Jul 2008 18:32:47 -0600

On Thu, Jul 17, 2008 at 2:39 PM, Quinn Taylor <quinntaylor_at_mac.com> wrote:
> Hello everyone, first post...
>
> Setting the svn:ignore property on a directory node requires a newline
> between each item. While one way to do this is to use a file argument,
> creating a file is not always an elegant or compelling solution. This value
> can be set interactively on the command line by putting all the values
> within ' marks and typing a return between each. However, I haven't found a
> way to effectively script or automate this process.

This borders upon shifting the topic from Subversion to shell
scripting, but how about something like this Bash function

  function svn_ignore {
    local target="$1"; shift
    svn ps svn:ignore "`echo $* | tr ' ' '\n'`" "$target"
  }

which would let you do

  $ svn_ignore . \*.o \*.exe \*.tmp
  property 'svn:ignore' set on '.'
  $ svn pg svn:ignore .
  *.o
  *.exe
  *.tmp

It breaks if your ignore patterns have spaces in them, and it only
works against a single target at a time, but it might work for the
common case.

> Step 2 on
> <http://riquedafreak.blogspot.com/2007/12/spring-cleaning-with-subversion.html>
> describes how to set the ignore property for several values on directories
> matching a certain pattern. I would like to make this into a bash alias, but
> so far my attempts to do so have been fruitless, since svn propset doesn't
> do anything intelligent with \n or \r escape characters. To me, this seems
> like a dumb restriction.

Again, you probably want a function instead of an alias. You could
supplement the previous function with something like

  function svn_ignore_multidir {
    local dir_pattern="$1"; shift
    # find(1) can't do -exec with a shell function, so loop manually
    for dir in `find . -name "$dir_pattern"`; do
      svn_ignore "$dir" $*
    done
  }

In this case, it breaks if the subdirectories have spaces in the path,
but since you're using Bash, I assume that isn't a big limitation. To
reproduce the example in the blog you mentioned, you'd do

  $ svn_ignore_multidir \*.xcodeproj \*.pbxuser \*.mode1 \*.mode1v3

Hope this helps,
Jeremy

>
> I've researched a few possibly related existing issues, both of which deal
> with auto-props which can be set in user-specific configuration. (On OS X,
> this is found in the ~/.subversion/config file.)
>
>
> Bug #1989 — Make auto-props affect directories
> http://subversion.tigris.org/issues/show_bug.cgi?id=1989
>
> Kevin Ballard suggests using \n for newlines and making auto-props apply to
> directories. The latest comments on this issue say that it's unscheduled,
> but made into a branch of SVN 2 years ago. I would LOVE to see progress and
> a resolution on this, since it would also help solve the problem I'm facing.
> (In fact, such files in .xcodproj directories is one of the problems I'm
> dealing with.)
>
>
> Bug #2068 — No escaping of separator characters in auto-props
> http://subversion.tigris.org/issues/show_bug.cgi?id=2068
>
> This bug relates to the inability to use semicolons within auto-prop values,
> since it's a separator. Introducing an escaped newline might deal with a
> similar issue or part of the Subversion config system.
>
>
> Nothing that I've found so far has dealt with accepting escaped newlines in
> svn:ignore propset strings. Does anyone else feel that this is an issue that
> could stand to be improved?
>
> Thanks,
> - Quinn Taylor

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-07-18 02:33:44 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.