Class P4::Resolver

Description

P4::Resolver is a class for handling resolves in Helix Server. It is intended to be subclassed, and for subclasses to override the Resolve() method. When P4::RunResolve() is called with a P4::Resolver object, it calls the P4::Resolver::Resolve() method of the object once for each scheduled resolve.

Class Methods

$actionResolve() -> string

Enables support for resolves of branches, deletes, and file types. This method is invoked if an action resolve is required. It lets you add a callback in your Resolver implementation to determine what the resolve action should be after the automatic resolver has evaluated it. This is similar to resolves in P4V, when you are prompted to select what you want to do, given what the automatic resolver suggested. The $resolver->ActionResolve() method receives an argument (mergeData) and lets you return a string that specifies what to do. See $resolver.Resolve() for available strings.

The following example counts the number of times it has been called (line 5), stores the mergeData from the autoresolver (type, hint, and info) and returns what the automatic resolver suggested (hint) on line 10 as the answer.

sub ActionResolve( $ ) {
my $self = shift;
my $mergeData = shift;
$self->{'ActionResolve'} += 1;
$self->{'type'} = $mergeData->Type();
$self->{'hint'} = $mergeData->MergeHint();
$self->{'info'} = $mergeData->MergeInfo();
return $mergeData->MergeHint();
}

Instance Methods

$resolver.Resolve() -> string

Returns the resolve decision as a string. The standard Helix Server resolve strings apply:

String Meaning

ay

Accept Yours.

at

Accept Theirs.

am

Accept Merge result.

ae

Accept Edited result.

s

Skip this merge.

q

Abort the merge.

By default, all automatic merges are accepted, and all merges with conflicts are skipped. The P4::Resolver::Resolve() method is called with a single parameter, which is a reference to a P4::MergeData object.