You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dan Tenenbaum <da...@gmail.com> on 2006/02/12 02:38:26 UTC

adding all unversioned files (except ignored ones)

Periodically I would like to add all unversioned files to the
repository (excluding files matching patterns set in the svn:ignore
property). I don't want to have to remember every new file (some of
them are generated by other programs) and add it manually.

I thought that
svn add * --force
would do what I want. But it adds everything, including files that I
have excluded using the svn:ignore property.

I should probably ask here if I set that property correctly; I set the
property by doing this:
svn propset svn:ignore -F svnignore .
where svnignore is a file that contains newline-separated patterns of
files to ignore. Here, in case I have screwed up royally and this will
help diagnose it, is the contents of that file:

ignore.sh
svnignore
log/*
config/*
config/environments/*
db/*.sh

So, the question is how to automatically add to the repository all
unversioned files that do not match any of the patterns in the
svn:ignore property. It would also be nice if I could see a list of
such files before doing the add, in case there is stuff that should
not be added.

I looked at several of the GUI svn clients (svnX, jsvn, rapidsvn,
etc.) and they didn't seem to be able to do this either. Can anyone
help?
Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: adding all unversioned files (except ignored ones)

Posted by Saulius Grazulis <gr...@akl.lt>.
On Sunday 12 February 2006 04:38, Dan Tenenbaum wrote:

> Periodically I would like to add all unversioned files to the
> repository (excluding files matching patterns set in the svn:ignore
> property). I don't want to have to remember every new file (some of
> them are generated by other programs) and add it manually.

I have written two small shell scripts for myself -- one to add all 
unversioned files, and another to delete missing files. Have a look, maybe 
they help you.

==> svnaddunknown <==
#!/bin/sh

svn add \
    `svn status | awk '/^\?/{print $2}'` \
${1+"$@"}

==> svndelmissing <==
#!/bin/sh

svn del \
    `svn status | awk '/^\!/{print $2}'` \
${1+"$@"}

-- 
Saulius Gražulis

Visuomeninė organizacija "Atviras Kodas Lietuvai"
P.Vileišio g. 18
LT-10306 Vilnius
Lietuva (Lithuania)

tel/fax:      (+370-5)-210 40 05
mobilus:      (+370-684)-49802, (+370-614)-36366

Re: adding all unversioned files (except ignored ones)

Posted by Kevin Greiner <gr...@gmail.com>.
On 2/13/06, Matthew Willis <mw...@ecornell.com> wrote:
>
>
> svn status -u | grep "?" | awk '{print $2}' | while read i ; do svn
> add "$i" ; done


I last touched a real unix shell years ago... How is this different than:
"svn add . --force"

In limited testing here, it seems to work just as Dan wants.

Re: adding all unversioned files (except ignored ones)

Posted by Ma...@gfa-net.de.
Matthew Willis <mw...@ecornell.com> wrote:
> 
> On Feb 13, 2006, at 6:41 PM, Ryan Schmidt wrote:
> 
> > On Feb 12, 2006, at 03:38, Dan Tenenbaum wrote:
> >
> >> So, the question is how to automatically add to the repository all
> >> unversioned files that do not match any of the patterns in the
> >> svn:ignore property. It would also be nice if I could see a list of
> >> such files before doing the add, in case there is stuff that should
> >> not be added.
> >>
> >> I looked at several of the GUI svn clients (svnX, jsvn, rapidsvn,
> >> etc.) and they didn't seem to be able to do this either. Can anyone
> >> help?
> >
> > You would need to write or find a script that does this. It's not 
> > built-in. (At least, not built into the official code. You could 
> > check the contrib directory...)
> >
> 
> I often use the following:
> 
> svn status -u | grep "?" | awk '{print $2}' | while read i ; do svn 
> add "$i" ; done
> 

You could speed this up by just saying 'svn status' as you are only
interested in local files so no repository access is required.

And grep "^?" may be a bit safer as it only takes files with a '?' in
the first column (although it might stand nowhere else anyway).

Mathias


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: adding all unversioned files (except ignored ones)

Posted by Matthew Willis <mw...@ecornell.com>.
On Feb 13, 2006, at 6:41 PM, Ryan Schmidt wrote:

> On Feb 12, 2006, at 03:38, Dan Tenenbaum wrote:
>
>> So, the question is how to automatically add to the repository all
>> unversioned files that do not match any of the patterns in the
>> svn:ignore property. It would also be nice if I could see a list of
>> such files before doing the add, in case there is stuff that should
>> not be added.
>>
>> I looked at several of the GUI svn clients (svnX, jsvn, rapidsvn,
>> etc.) and they didn't seem to be able to do this either. Can anyone
>> help?
>
> You would need to write or find a script that does this. It's not  
> built-in. (At least, not built into the official code. You could  
> check the contrib directory...)
>

I often use the following:

svn status -u | grep "?" | awk '{print $2}' | while read i ; do svn  
add "$i" ; done

-lilmatt

--
Matthew Willis
eCornell

Re: adding all unversioned files (except ignored ones)

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Feb 12, 2006, at 03:38, Dan Tenenbaum wrote:

> Periodically I would like to add all unversioned files to the
> repository (excluding files matching patterns set in the svn:ignore
> property). I don't want to have to remember every new file (some of
> them are generated by other programs) and add it manually.
>
> I thought that
> svn add * --force
> would do what I want. But it adds everything, including files that I
> have excluded using the svn:ignore property.

The asterisk is expanded by your shell before Subversion ever sees  
it. Yes, if you explicitly tell Subversion what to add, it adds it,  
even if it would normally have ignored it.


> So, the question is how to automatically add to the repository all
> unversioned files that do not match any of the patterns in the
> svn:ignore property. It would also be nice if I could see a list of
> such files before doing the add, in case there is stuff that should
> not be added.
>
> I looked at several of the GUI svn clients (svnX, jsvn, rapidsvn,
> etc.) and they didn't seem to be able to do this either. Can anyone
> help?

You would need to write or find a script that does this. It's not  
built-in. (At least, not built into the official code. You could  
check the contrib directory...)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

adding all unversioned files (except ignored ones)

Posted by Dan Tenenbaum <da...@gmail.com>.
Periodically I would like to add all unversioned files to the
repository (excluding files matching patterns set in the svn:ignore
property). I don't want to have to remember every new file (some of
them are generated by other programs) and add it manually.

I thought that
svn add * --force
would do what I want. But it adds everything, including files that I
have excluded using the svn:ignore property.

I should probably ask here if I set that property correctly; I set the
property by doing this:
svn propset svn:ignore -F svnignore .
where svnignore is a file that contains newline-separated patterns of
files to ignore. Here, in case I have screwed up royally and this will
help diagnose it, is the contents of that file:

ignore.sh
svnignore
log/*
config/*
config/environments/*
db/*.sh

So, the question is how to automatically add to the repository all
unversioned files that do not match any of the patterns in the
svn:ignore property. It would also be nice if I could see a list of
such files before doing the add, in case there is stuff that should
not be added.

I looked at several of the GUI svn clients (svnX, jsvn, rapidsvn,
etc.) and they didn't seem to be able to do this either. Can anyone
help?
Thanks

Re: adding all unversioned files (except ignored ones)

Posted by Kevin Greiner <gr...@gmail.com>.
On 2/11/06, Dan Tenenbaum <da...@gmail.com> wrote:
>
> I should probably ask here if I set that property correctly; I set the
> property by doing this:
> svn propset svn:ignore -F svnignore .
> where svnignore is a file that contains newline-separated patterns of
> files to ignore. Here, in case I have screwed up royally and this will
> help diagnose it, is the contents of that file:
>
> ignore.sh
> svnignore
> log/*
> config/*
> config/environments/*
> db/*.sh


Just tested this locally. You need to add a line for each directory you want
ignored like: log, config, db, etc. Also remember that svn:ignore isn't
recursive itself. Apply it recursively or use global ignores in each
client's config.