On Oct 21, 2008, at 19:07, Ruslan Sivak wrote:
> Ryan Schmidt wrote:
>
>> On Oct 21, 2008, at 13:57, Ruslan Sivak wrote:
>>
>>> Ryan Schmidt wrote:
>>>
>>>> Extra revisions shouldn't be a problem at all, though I don't
>>>> see why there would be extra revisions. You said you issue a
>>>> nightly commit as part of a batch process. Presumably before you
>>>> commit, you run "svn add" on new files you discover. So, just
>>>> also run "svn rm" on the files that need to be marked as deleted
>>>> in the repository, and then run your single "svn commit".
>>>>
>>>> I also don't understand your assertion of wasting repository
>>>> space. Anything you add to the repository takes up space in the
>>>> repository. If you delete it with "svn rm", that space is not
>>>> reclaimed; it's still used, and the file is still there in the
>>>> repository history. This is how Subversion is designed to work.
>>>> If you don't want deleted files taking up space, then you may
>>>> need to look into a tool other than Subversion.
>>>
>>> The problem here is that my script is very simple.
>>>
>>> svn add .
>>
>> That only adds the directory, which is presumably already under
>> version control. Maybe you mean "svn add *" which would add all
>> files in the directory? Or do you only ever add entire directories
>> worth of photos, never individual files?
>
> Actually my code looks something like this
> svn add --force .
> svn commit -m "daily prd commit"
>
> This adds everything under the current directory recursively and
> then commits everything.
Ah, ok.
>>> svn commit .
>>>
>>> So in order to delete things, I would need to do somethign like
>>> svn st
>>> figure out which files are deleted
>>> svn rm deleted files
>>> svn commit
>>>
>>> This is a lot more complicated, and currently I don't see a way
>>> to do it. Tortoise lets you commit deletions easily, but I don't
>>> see an easy way to script it.
>>
>> Off the top of my head:
>>
>> svn st | sed -n 's/^\! //p' | xargs svn rm
>>
>> That might not be compatible with filenames or paths that have
>> spaces in them.
>>
>> It also assumes you have Unix-like utilities like sed and xargs
>> available to you. If your server runs Windows, you'll have to find
>> Windows versions of those utilities, or maybe use Cygwin or move
>> to a Linux server.
>
> Looks like after I installed UnixUtils and changed the code slightly
>
> svn st --depth=infinity | sed -n "s/^\! //p" | xargs svn rm
>
> it seems to work. What if the file name has a spaces in it? Does
> anyone have a regex for that?
The regular expression is accurate for any filename; the problem is
the xargs command which splits input on whitespace, whether that be a
newline or a space. Maybe there is an argument to xargs to tell it to
split only on newlines. Or you could replace xargs with a short
script written in perl or another language of your choice. For example:
svn st --depth=infinity \
| sed -n "s/^\! //p" \
| perl -e 'while (<>) {chomp;unlink;}'
>>> P.S. When I talked about wasting space, I meant doing a commit
>>> every time there was a change, not a nightly commit.
>>
>> Each commit should take a fixed amount of space for some
>> administrative information, plus the space for the changes you're
>> committing. That fixed amount of space should be small, but if you
>> have many files (i.e. thousands) in a single directory, it could
>> be larger than one would like.
>
> What I mean is if I commit things immediately, and the file happens
> to change several times a day, I only want the last change in the
> repository. I don't necessarily want all the intermediate revisions.
Understood.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-10-22 03:05:07 CEST