Class P4::MergeData

Description

Class containing the context for an individual merge during execution of a p4 resolve.

Class Methods

None.

Instance Methods

md.your_name() -> aString

Returns the name of "your" file in the merge. This is typically a path to a file in the workspace.

p4.run_resolve() do
  |md|
  yours = md.your_name
  md.merge_hint # merge result
end

md.their_name() -> aString

Returns the name of "their" file in the merge. This is typically a path to a file in the depot.

p4.run_resolve() do
  |md|
  theirs = md.their_name
  md.merge_hint # merge result
end

md.base_name() -> aString

Returns the name of the "base" file in the merge. This is typically a path to a file in the depot.

p4.run_resolve() do
  |md|
  base = md.base_name
  md.merge_hint # merge result
end

md.your_path() -> aString

Returns the path of "your" file in the merge. This is typically a path to a file in the workspace.

p4.run_resolve() do
  |md|
  your_path = md.your_path
  md.merge_hint # merge result
end

md.their_path() -> aString

Returns the path of "their" file in the merge. This is typically a path to a temporary file on your local machine in which the contents of P4::MergeData#their_name() have been loaded.

p4.run_resolve() do
  |md|
  their_name = md.their_name
  their_file = File.open( md.their_path )
  md.merge_hint # merge result
end

md.base_path() -> aString

Returns the path of the base file in the merge. This is typically a path to a temporary file on your local machine in which the contents of P4::MergeData#base_name() have been loaded.

p4.run_resolve() do
  |md|
  base_name = md.base_name
  base_file = File.open( md.base_path )
  md.merge_hint # merge result
end

md.result_path() -> aString

Returns the path to the merge result. This is typically a path to a temporary file on your local machine in which the contents of the automatic merge performed by the server have been loaded.

p4.run_resolve() do
  |md|
  result_file = File.open( md.result_path )
  md.merge_hint # merge resultend

md.merge_hint() -> aString

Returns the hint from the server as to how it thinks you might best resolve this merge.

p4.run_resolve() do
  |md|
  puts ( md.merge_hint ) # merge result
end

md.run_merge() -> aBool

If the environment variable P4MERGE is defined, P4::MergeData#run_merge() invokes the specified program and returns a boolean based on the return value of that program.

p4.run_resolve() do
  |md|
  if ( md.run_merge() )
    "am"
  else
    "s"
  end
end