# P4Convert: User Guide (April 2015)

# Notes

## Keyword Expansion Issues:

The conversion process preserves keyword file types and sets these files in Perforce with the +k modifier. However keywords in Subversion and Perforce are expanded differently. For example: In Subversion the keyword `$Revision$` expands to:

    $Revision: 25005 $		(a change number in Perforce)

Another example is the keyword `$Date$`, which in Subversion gives you the time as well...

    $Date: 2006-02-17 12:09:10 +0000 (Fri, 17 Feb 2006) $

and in Perforce...

    $Date: 2006/02/17 $

Here is a list of alternatives, (based on the above example):

    $Revision$    ==> $Change$	gives	$Change: 25005 $
    $Date$        ==> $DateTime$	gives	$DateTime: 2006/02/17 12:09:10 $

Due to the differences in keyword expansion the MD5 sum in Subversion is not valid for use in Perforce. This is why any keyword expanded files have an empty MD5 sum and why the p4 verify -u //... command is recommended in the 'Optional Steps' section.

## Verification

Verification can be performed using a running Subversion server and comparing the differences in files in Perforce using the audit log. To enable the audit log set the following option to `true` and choose the file name.

    com.p4convert.log.audit.enabled=true
    com.p4convert.log.audit.filename=audit.log

A sample line of the audit log:

    # <SVN path>, <SVN revision>, <P4 change>, <MD5 sum>
    trunk/src/foo.c, 1, 1, 1234567890abcdef1234567890abcdef

## Output and Logs

### Console output and logging configuration options

The default SLF4J logging options can be overwritten with another configuration file; specify the `log4j.configuration` option with a local file, using the syntax:

`file:`your_local_file``

    java -Dlog4j.configuration=file:log4j.xml -jar p4convert.jar

Please use or refer to the sample `debug.log4j.xml` for logging options.

### These options are reserved for testing or future enhancements:

    com.p4convert.core.test
    com.p4convert.core.version
    com.p4convert.svn.emptyDirEnabled
    com.p4convert.svn.emptyDirName

### Reading Console/Logging output

    Importing Subversion ranges:

    start: 1
    end:   23091
    last:  23091

    1.0 A:D - trunk
    1.1 A:D - trunk/src
    1.2 A:F - trunk/src/foo.c (UTF-8)
    mapping: r1 => @1

    2.0 A:F - trunk/src/bar.png (BINARY)
    mapping: r2 => @2
    ...

Explanation of output lines, for example:

    1.2 A:F - trunk/src/foo.c (UTF-8)

The numbering `1.2` refers to the current Subversion revision and the node action. (`1` Subversion revision 1 and `.2` = the third node action as `.0` would be the first index)

The letters `A:F` refers to the Subversion action and if it is a file or directory operation.

- A Add

- B Branch

- E Edit

- I Integrate (merge fromNode)

- M Merge (svn:mergeinfo)

- C Copy (svn replace action with fromNode)

- U Update (svn replace action)

- R Remove (delete)

- F File

- D Directory

The subversion path `trunk/src/foo.c` is followed by the detected type.

Detected Type | Perforce Base Type
--- | ---
UTF-8 | Unicode
UTF-16BE | utf16
UTF-16LE | utf16
UTF-32BE | Unicode
UTF-32LE | Unicode
Shift_JIS | Unicode
ISO-2022-JP | downgraded to binary
ISO-2022-CN | downgraded to binary
ISO-2022-KR | downgraded to binary
GB18030 | Unicode
EUC-JP | Unicode
EUC-KR | Unicode
Big5 | Unicode
ISO-8859-1 | Unicode
ISO-8859-2 | Unicode
ISO-8859-5 | Unicode
ISO-8859-6 | downgraded to binary
ISO-8859-7 | Unicode
ISO-8859-8 | Unicode
windows-1251 | Unicode
windows-1254 | Unicode
windows-1256 | downgraded to binary
KOI8-R | Unicode
ISO-8859-9 | Unicode
IBM424_rtl | downgraded to binary
IBM424_ltr | downgraded to binary
IBM420_rtl | downgraded to binary
IBM420_ltr | downgraded to binary
BINARY | binary

### Note

The detected type is based on language detection using ICU4J and not Subversion MIME or Perforce detection.

Finally `mapping: r223 => @223`' refers to the Subversion revision number (`r223`) to the Perforce changelist number (`@223`). Typically 1:1 unless offset or merged against an live or pre-existing Perforce Server.

## Errors

In Import Mode, Perforce related p4-java messages are reported as warnings and should be verified, for example:

    46.3 A:F - repo/trunk/my.file
    WARNING: p4java: //import/repo/trunk/my.file - file(s) up-to-date.

In Conversion Mode, errors are reported as Panics and an exception is thrown.

Problematic Subversion dump records can be extracted and sent to Perforce when it is not possible to send in the whole dumpfile. The extracted dumpfile only contains meta-data and the file content is removed and replaced with a block count.

During an exception note the Subversion revision and node ID (the example above has a revision number of 46 and a node number of 3). Then run the following command to extract the problematic record, for example:

    $ java -jar dist/p4convert.jar --type=SVN --repo=mysvndump.dump --extract=46.3

    searching for node: 46.3...
    Node-path: repo/trunk/my.file
    Node-kind: file
    Node-action: add
    Prop-content-length: 10
    Text-content-length: 308
    Text-content-md5: 6a339b6ccf2af72d77169ef29b98eb0b
    Content-length: 318

    PROPS-END

A file is then generated called `node.46.3.dump` and will contain the Subversion record to be sent to Perforces, as well as the Subversion meta-data (everything after `searching for node: 46.3...`).

Hide partial matches
Highlight matches
0 matching pages