CleanCode logo
sitemap
SEARCH:

CleanCode PowerShell Libraries v1.2.08 API: CleanCode » SvnTools » Get-SvnInfo

Get-SvnInfo

NAME

Get-SvnInfo

SYNOPSIS

Returns output of the Subversion "svn info" command as PowerShell objects.

SYNTAX

Get-SvnInfo [[-Path] <String[]>] [[-Property] <String[]>] [-Include <String[]>] [-Exclude <String[]>] [-ExcludeTree <String[]>] [-Recurse] [-UseRegex] [-ContainersOnly] [<CommonParameters>]

DESCRIPTION

Get-SvnInfo provides a convenient interface to the Subversion "svn info" command. Conventional output from "svn info" looks like this:

        --------------------------------------------------------------------
        > svn info CleanCode
        Path: C:/usr/ms/devel/CleanCode
        URL: file:///C:/usr/svn/cleancode/trunk/devel/powershell/CleanCode
        Repository Root: file:///C:/usr/svn/cleancode
        Repository UUID: 75eedc-7c4-14e-87a-88bfc6be1
        Revision: 1107
        Node Kind: directory
        Schedule: normal
        Last Changed Author: msorens
        Last Changed Rev: 1105
        Last Changed Date: 2011-08-12 15:54:10 -0700 (Fri, 12 Aug 2011)
        --------------------------------------------------------------------

Get-SvnInfo converts this text output into PowerShell objects and pivots the data from rows to columns. You then specify which columns you want to see using the Property list. You can feed one or more starting paths (Path parameter) and you can recurse through the directory tree from each starting point. Get-SvnInfo uses Get-ChildItem at its core so the standard -Recurse parameter works for Get-SvnInfo as it does for Get-ChildItem. (Actually, Get-SvnInfo uses the CleanCode variation, Get-EnhancedChildItem, which lets you easily focus on SVN-only files).

Once you pivot the output of "svn info" you could easily get excessive line lengths. Get-SvnInfo thus provides a handy mechanism for trimming any selected property, particularly useful if you select any path properties (e.g. Path, URL, Repository Root). See the Property parameter for particulars.

PARAMETERS

-Path <String[]>
        Specifies a path to one or more locations.
        The default location is the current directory (.).

        Required?                    false
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  true

-Property <String[]>
        Specifies the properties to select. Wildcards are *not* permitted.
        Each property in the list must match an existing field name returned by
        the standard Subversion "svn info" command.
        You may optionally qualify a property to return a trimmed version of
        the field value by using the format "<field name>:<value to excise>".
        The <value to excise> must be a constant string by default.
        If you enable the use of regular expressions (see the UseRegex parameter)
        then the <value to excise> for all properties must be a regular expression.

        Required?                    false
        Position?                    2
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

-Include <String[]>
        Retrieves only the specified items. The value of this parameter qualifies
        the Path parameter. Enter a path element or pattern, such as "*.txt".

        The Include parameter is effective only when the command includes
        the Recurse parameter or the path leads to the contents of a directory,
        such as C:\Windows\*, where the wildcard character specifies the contents
        of the C:\Windows directory.

        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  true

-Exclude <String[]>
        Omits the specified items. The value of this parameter qualifies the
        Path parameter.
        Enter a path element or pattern, such as "*.txt".

        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  true

-ExcludeTree <String[]>
        Excludes not just a matching item but also all its children as well.

        Required?                    false
        Position?                    named
        Default value                @()
        Accept pipeline input?       false
        Accept wildcard characters?  true

-Recurse [<SwitchParameter>]
        Gets the items in the specified locations and in all child items of the
        locations. Recurse works only when the path points to a container that
        has children, such as C:\Windows or C:\Windows\*, and not when it points
        to items without children, such as C:\Windows\*.exe. The default is false.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-UseRegex [<SwitchParameter>]
        Set to true, this changes interpretation of trimming prefixes in the
        Property parameter list from plain string to regular expression.
        The default is false.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-ContainersOnly [<SwitchParameter>]
        Returns only containers (directories).

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

<CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, see 
        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

System.String. You can pipe one or more path strings to Get-SvnInfo.

OUTPUTS

Object. The type of object returned is determined by the provider with which it is used.

NOTES



        This function is part of the CleanCode toolbox
        from http://cleancode.sourceforge.net/.

        Since CleanCode 1.1.01.

EXAMPLES


-------------------------- EXAMPLE 1 --------------------------

PS>Get-SvnInfo "." @('Path', 'Revision')

Returns the Subversion Path and Revision properties for all SVN objects in the current directory.

        Path                                     Revision
        ----                                     --------
        C:\usr\powershell\scripts\AnalyzeMySv... 1107
        C:\usr\powershell\scripts\GenerateCle... 1122
        C:\usr\powershell\scripts\psdoc_templ... 1122
        C:\usr\powershell\scripts\RunNUnitGri... 1107

-------------------------- EXAMPLE 2 --------------------------

PS>Get-SvnInfo "." @('Path', 'Revision') | Format-Table -AutoSize

Returns the Subversion Path and Revision properties for all SVN objects in the current directory. Piping the output through Format-Table is one way to show more useful output rather than the truncated output above.

        Path                                                              Revision
        ----                                                              --------
        C:\usr\devel\long\path\to\trim\scripts\AnalyzeMySvnKeywords.ps1   1107
        C:\usr\devel\long\path\to\trim\scripts\GenerateCleanCodeAPI.ps1   1122
        C:\usr\devel\long\path\to\trim\scripts\psdoc_template.html        1122
        C:\usr\devel\long\path\to\trim\scripts\RunNUnitGrid.ps1           1107

-------------------------- EXAMPLE 3 --------------------------

PS>Get-SvnInfo "subdir1","subdir2" 'Path', 'Revision'

Returns the Subversion Path and Revision properties for all SVN objects in the two specified directories.

        Path                                             Revision
        ----                                             --------
        C:\usr\powershell\scripts\subdir1\AnalyzeMySv... 1107
        C:\usr\powershell\scripts\subdir1\GenerateCle... 1122
        C:\usr\powershell\scripts\subdir2\psdoc_templ... 1122
        C:\usr\powershell\scripts\subdir2\RunNUnitGri... 1107

-------------------------- EXAMPLE 4 --------------------------

PS>Get-SvnInfo "." -Recurse Path, Revision, URL

Returns the specified Subversion properties for all SVN objects in the tree rooted at the current directory.

-------------------------- EXAMPLE 5 --------------------------

PS>Get-SvnInfo "." -Recurse 'Path|C:\usr\devel\long\path\to\trim', 'Revision'

Returns the specified Subversion properties for all SVN objects in the tree rooted at the current directory, and trims the initial portion of each Path.

        Path                                Revision
        ----                                --------
        \scripts\AnalyzeMySvnKeywords.ps1   1107
        \scripts\GenerateCleanCodeAPI.ps1   1122
        \scripts\psdoc_template.html        1122
        \scripts\RunNUnitGrid.ps1           1107

-------------------------- EXAMPLE 6 --------------------------

PS>Get-SvnInfo "." -Recurse -ContainersOnly Path, URL | Format-Table Path, @{ n='Branch'; e={$_.URL -replace ".*(trunk|branches/[^/]*).*", '$1'} }

Identifes the branch of each subdirectory in case you have mixed branches in your working copy.

RELATED LINKS

This documentation set was created with CleanCode's DocTreeGenerator.

Valid XHTML 1.0!Valid CSS!Get CleanCode at SourceForge.net. Fast, secure and Free Open Source software downloads
Copyright © 2001-2015 Michael Sorens • Contact usPrivacy Policy
Usage governed by Mozilla Public License 1.1 and CleanCode Courtesy License
CleanCode -- The Website for Clean DesignRevised 2015.12.16