public interface

Change

implements PropertySupport
com.atlassian.bitbucket.content.Change

Class Overview

Describes a single change made by a commit.

Summary

Public Methods
@Nullable Conflict getConflict()
Retrieves conflict information, if any, related to this change.
@Nullable String getContentId()
An identifier for the content which was changed.
@Nullable Boolean getExecutable()
The executable permission for the file after the change.
@Nullable String getFromContentId()
An identifier from which the content was changed.
@Nonnull ContentTreeNode.Type getNodeType()
The type of the file node, which is most likely to be a file or possibly a submodule.
@Nonnull Path getPath()
The path to the changed content.
int getPercentUnchanged()
The percentage of content that matches before and after a change.
@Nullable Boolean getSrcExecutable()
The executable permission for the file before the change.
@Nullable Path getSrcPath()
The path at which the changed content originated.
@Nonnull ChangeType getType()
The type of change that was applied.
[Expand]
Inherited Methods
From interface com.atlassian.bitbucket.property.PropertySupport

Public Methods

@Nullable public Conflict getConflict ()

Retrieves conflict information, if any, related to this change.

When streaming changes for a pull request, it is possible for some changes to be decorated with conflict information. Other sources of change information, such as the CommitService, will never include conflicts on any of the changes they return.

When conflict information is present, the conflicting changes describe the changes that were made on each side of the merge. Details provided with this change will not be accurate when conflict information is present. Instead, this change will describe the way the conflict was handled by the system to allow the merge to be committed.

Returns
  • conflict information related to this change, or null if there is no conflict

@Nullable public String getContentId ()

An identifier for the content which was changed.

For deletions, the returned content ID is for the content prior to deletion, since there is no identifier available afterward. For all other types, the identifier is for the content after the change.

Some SCM implementations, such as Mercurial, do not provide content IDs. When working with repositories for such SCMs, this value will be null.

Returns
  • a content identifier

@Nullable public Boolean getExecutable ()

The executable permission for the file after the change.

If the file was deleted this value will be null, since a deleted file is neither executable nor non-executable. Otherwise, it will be true or false according to the permissions on the file.

Returns
  • true or false for any change other than a deletion; null for deleted files

@Nullable public String getFromContentId ()

An identifier from which the content was changed. Some SCM implementations, such as Mercurial, do not provide content IDs. When working with repositories for such SCMs, this value will be null.

Returns
  • a content identifier

@Nonnull public ContentTreeNode.Type getNodeType ()

The type of the file node, which is most likely to be a file or possibly a submodule. A directory type is never returned as they are transient and can be recreated from the path.

Returns
  • the node type

@Nonnull public Path getPath ()

The path to the changed content.

  • For copies, this is the path of the content that was created
  • For deletions, this is the path of the content before it was deleted
  • For moves, this is the path of content after the move
  • For all other types, this is the path of the content to which the change occurred

Returns
  • the changed path

public int getPercentUnchanged ()

The percentage of content that matches before and after a change. This is useful, for example, in determining the likelihood that an identified copy or move is correct.

Note: This feature may not be supported by all SCM implementations. Where it is not supported, it will always return -1.

Returns
  • a percentage, if the change is scored, or -1 if it is not

@Nullable public Boolean getSrcExecutable ()

The executable permission for the file before the change.

If the file was created this value will be null, since the file was neither executable nor non-executable before it was created. Otherwise, it will be true or false according to the permissions on the file.

Returns
  • true or false for any change other than a creation; null for newly-created files

@Nullable public Path getSrcPath ()

The path at which the changed content originated.

  • For copies, this is the path to the content that was copied
  • For moves, this is the path to the content before it was moved
  • For all other types, this value is not defined

Returns
  • the originating path, if any

@Nonnull public ChangeType getType ()

The type of change that was applied.

Returns
  • the change type