TrimMergeInfo.pl - Trim Matching Subversion Merge Information


NAME

TrimMergeInfo.pl - Trim Matching Subversion Merge Information


SYNOPSIS

    perl TrimMergeInfo.pl <wc_dir> <path_regex>
        [--revisions=<range>] [<path_regex> ...]


DESCRIPTION

Recursively trim matching "svn:mergeinfo" entries from the indicated working copy directory. This script can be run multiple times on the same working copy in order to apply different sets of regular expressions.

This script does not commit any changes. If you make a mistake, you can use "svn revert" to restore the trimmed information.

Merge information is recorded for both folders and files.

NOTE: This will NOT trim merge information contained within "svn:externals" folders. To trim their merge information, you must explicitly run this on the corresponding directories in the working copy.

This script uses the Subversion command line tools.

Arguments

<wc_dir>

This argument specifies the pathname of the working copy directory. The merge information for this directory, and all contained files and subdirectories, will be trimmed.

Only one working copy directory may be specified.

<path_regex>

These arguments specify Perl regular expressions to look for in the merge source paths. Any entry that matches one of these will have its merged revision numbers trimmed. If merge source path ends up with no revision numbers, it is removed. If all the merge source paths are removed, the merge info property is deleted.

One or more of these arguments are required.

--revisions

This optional argument specifies a revision number range to remove from the matching source paths.

Four forms of revision ranges are supported:

  1. 0:HEAD

    This is the default. It indicates that all merge info for the matching source paths should be trimmed.

  2. 0:endrev

    This range indicates that any revision numbers prior to, and including, endrev should be trimmed. This is often used to remove any merge info prior to the creation of a branch.

  3. startrev:endrev

    This specifies an inclusive range of revisions to be trimmed.

    startrev:HEAD

    This range indicates that any revisions after, and including, startrev should be trimmed.

Listing Merge Info

The following Subversion command will give you a full listing of the merge information in a working copy.

    svn propget svn:mergeinfo D:\my\working\copy --depth=infinity

Please note that this won't contain information from external folders.

Merge Info Data Format

The "svn:mergeinfo" property of files and folders consists of a multi-line value. Each line represents merge information for a merge source in the common repository.

Example value for file "branches/15.5/foo.c":

    /project/bar/trunk/foo.c:127-201,212
    /project/bar/branches/alt_a/foo.c:208,210,218-220

This script can be used to trim any or all of these lines. This is particularly useful when one of the referenced branches has been deleted from the HEAD of the repository.


VERSION

    $Id: TrimMergeInfo.pl 13 2009-07-06 16:48:03Z Geoffrey $


COPYRIGHT

Copyright (c)2009 Geoff Rowell. All rights reserved.

 TrimMergeInfo.pl - Trim Matching Subversion Merge Information