Why does this PowerShell script remove svn: mergeinfo from the root directory?

We have a script to remove the svn: mergeinfo property from all folders inside the Subversion working copy, but not the working copy root directory itself. Currently, NAnt build script is invoked through a separate batch file, so I am trying to replace it with a simpler PowerShell script. I had three attempts: from the naive to the slightly more complex. All three do not meet my criteria, outputting a stringproperty 'svn:mergeinfo' deleted from '.'.

Checking the SVN properties of the working copy root indicates that the svn: mergeinfo property has indeed been removed from this folder, which I don't want. Each version is designed to run from the root of the working copy.

Attempt 1:

# I understand why this one fails, it a poor attempt.
Get-ChildItem -Recurse | svn propdel svn:mergeinfo -R $_

Attempt 2:

# This one correctly lists everything except the working copy root, but
# still removes the svn:mergeinfo property from the working copy root.
Get-ChildItem -Recurse -Exclude $pwd | svn propdel svn:mergeinfo -R $_

Attempt 3:

# Again, this one works fine until the svn propdel is added.
Get-ChildItem | ForEach-Object { ls -R $_ } | svn propdel svn:mergeinfo -R $_

Any thoughts on where the error is in my logic?

+3
1

svn - , PowerShell. svn , ForEach-Object (%). :

... | %{ svn propdel svn:mergeinfo -R $_ }

svn $_. , , - $_.FullName $_.Name $_ ( , svn (, $_.FullName/$_.Name)), $_). NB: $_ , , .

+3

Source: https://habr.com/ru/post/1771908/


All Articles