How to commit only top level files?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How to commit only top level files?

Bo Berglund
I have a project where I want to commit the modified sources in the
top folder but want to prevent it from recursing to subdirectories,
which hold the compiled binaries. These are only to be committed when
the sources are stable.

I looked at svn ci with the --depth argument, but I do not understand
the wording of the docs:
http://svnbook.red-bean.com/en/1.7/svn.ref.svn.html#svn.ref.svn.sw.depth

it says:

--depth ARG

Instructs Subversion to limit the scope of an operation to a
particular tree depth. ARG is one of empty (only the target itself),
files (the target and any immediate file children thereof), immediates
(the target and any immediate children thereof), or infinity (the
target and all of its descendants—full recursion).

The problem I have is in the definition of "target"...

I am doing the operation inside the top level of the WC tree (where
the .svn dir is located).
The command will be:
svn ci --depth <argument>

What should I use as argument so that only the changed files in the
current dir are committed?
empty does not work for me because the dir is NOT empty
files does not work because I don't understand what "file children" is
immediates clearly would include subdirs too?
infinity not what I want, full recursion...

Tried to google but I only get hits that deal with the opposite, how
to exclude file commit.

I want to block recursion into subdirectories...


--
Bo Berglund
Developer in Sweden

Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Alfred von Campe

On Nov 6, 2018, at 15:11, Bo Berglund <[hidden email]> wrote:

What should I use as argument so that only the changed files in the
current dir are committed?

Will the -N [—non-recursive] option work for you?

Alfred
Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Bo Berglund
On Tue, 6 Nov 2018 15:19:06 -0500, Alfred von Campe
<[hidden email]> wrote:

>
>> On Nov 6, 2018, at 15:11, Bo Berglund <[hidden email]> wrote:
>>
>> What should I use as argument so that only the changed files in the
>> current dir are committed?
>
>Will the -N [—non-recursive] option work for you?
>
Non-recursive would work, but is it really available for svn ci?
It is not mentioned in the svnbook....

http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.commit.html


--
Bo Berglund
Developer in Sweden

Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Alfred von Campe

On Nov 6, 2018, at 15:41, Bo Berglund <[hidden email]> wrote:

on-recursive would work, but is it really available for svn ci?
It is not mentioned in the svnbook....

But “svn ci —help” does list it as an available option, at least on my system running 1.9.4.

Alfred
Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Mark Phippard-3


On Tue, Nov 6, 2018 at 4:15 PM Alfred von Campe <[hidden email]> wrote:

On Nov 6, 2018, at 15:41, Bo Berglund <[hidden email]> wrote:

on-recursive would work, but is it really available for svn ci?
It is not mentioned in the svnbook....

But “svn ci —help” does list it as an available option, at least on my system running 1.9.4.



You want "svn help ci":

 -N [--non-recursive]     : obsolete; try --depth=files or --depth=immediates

Do the "right way" to do this now would be:

svn ci --depth=files .


--
Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Branko Čibej
In reply to this post by Alfred von Campe
On 06.11.2018 21:19, Alfred von Campe wrote:
>
>> On Nov 6, 2018, at 15:11, Bo Berglund <[hidden email]
>> <mailto:[hidden email]>> wrote:
>>
>> What should I use as argument so that only the changed files in the
>> current dir are committed?
>
> Will the -N [—non-recursive] option work for you?

The -N option is deprecated in favour of --depth, because it has
different meanings for different commands, whereas --depth always means
the same thing.

-- Brane

Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Branko Čibej
In reply to this post by Bo Berglund
On 06.11.2018 21:11, Bo Berglund wrote:

> I have a project where I want to commit the modified sources in the
> top folder but want to prevent it from recursing to subdirectories,
> which hold the compiled binaries. These are only to be committed when
> the sources are stable.
>
> I looked at svn ci with the --depth argument, but I do not understand
> the wording of the docs:
> http://svnbook.red-bean.com/en/1.7/svn.ref.svn.html#svn.ref.svn.sw.depth
>
> it says:
>
> --depth ARG
>
> Instructs Subversion to limit the scope of an operation to a
> particular tree depth. ARG is one of empty (only the target itself),
> files (the target and any immediate file children thereof), immediates
> (the target and any immediate children thereof), or infinity (the
> target and all of its descendants—full recursion).
>
> The problem I have is in the definition of "target"...

"Target" is any file or directory that you tell the command to operate
on. For example, when you say:

    svn commit foo bar

"foo" and "bar" are targets for 'svn commit'. You can omit explicit
targets for some commands — svn commit is one of them — in which case
the implicit target is the current directory; so,

    svn commit

means exactly the same as

    svn commit .


> I am doing the operation inside the top level of the WC tree (where
> the .svn dir is located).
> The command will be:
> svn ci --depth <argument>
>
> What should I use as argument so that only the changed files in the
> current dir are committed?

    svn commit --depth files

(or 'svn commit --depth files .') will only commit /files/ that in the
current directory. On the other hand,

    svn commit --depth immediates

will commit files /and/ directories, but will not recurse into the
directories. Basically this means that changed files and property
changes on directories in the current dir will be committed, but nothing
else.


> empty does not work for me because the dir is NOT empty

That's not what '--depth empty' means. It means "commit only the target
itself", so if the target is a directory, it will only commit any
property changes on that directory.


> files does not work because I don't understand what "file children" is

Files within the target direcory.

> immediates clearly would include subdirs too?

Yes, but nothing inside those subdirs.

> infinity not what I want, full recursion...
>
> Tried to google but I only get hits that deal with the opposite, how
> to exclude file commit.
>
> I want to block recursion into subdirectories...

You want either 'svn commit --depth files' or 'svn commit --depth
immediates', depending on whether or not property changes on directories
matter.

-- Brane

Reply | Threaded
Open this post in threaded view
|

Re: How to commit only top level files?

Bo Berglund
On Tue, 6 Nov 2018 23:13:08 +0100, Branko ?ibej <[hidden email]>
wrote:

>> The problem I have is in the definition of "target"...
>
>"Target" is any file or directory that you tell the command to operate
>on. For example, when you say:
>
>    svn commit foo bar
>
>"foo" and "bar" are targets for 'svn commit'. You can omit explicit
>targets for some commands — svn commit is one of them — in which case
>the implicit target is the current directory; so,
>
>    svn commit
>
>means exactly the same as
>
>    svn commit .
>
>
>> I am doing the operation inside the top level of the WC tree (where
>> the .svn dir is located).
>> The command will be:
>> svn ci --depth <argument>
>>
>> What should I use as argument so that only the changed files in the
>> current dir are committed?
>
>    svn commit --depth files
>
>(or 'svn commit --depth files .') will only commit /files/ that in the
>current directory. On the other hand,
>
>    svn commit --depth immediates
>
>will commit files /and/ directories, but will not recurse into the
>directories. Basically this means that changed files and property
>changes on directories in the current dir will be committed, but nothing
>else.
>
>
>> empty does not work for me because the dir is NOT empty
>
>That's not what '--depth empty' means. It means "commit only the target
>itself", so if the target is a directory, it will only commit any
>property changes on that directory.
>
>
>> files does not work because I don't understand what "file children" is
>
>Files within the target direcory.
>
>> immediates clearly would include subdirs too?
>
>Yes, but nothing inside those subdirs.
>
>> infinity not what I want, full recursion...
>>
>> Tried to google but I only get hits that deal with the opposite, how
>> to exclude file commit.
>>
>> I want to block recursion into subdirectories...
>
>You want either 'svn commit --depth files' or 'svn commit --depth
>immediates', depending on whether or not property changes on directories
>matter.
>
>-- Brane

Thanks for the complete explanation!

I used --depth files and got what I wanted!


--
Bo Berglund
Developer in Sweden