4
* Defines constants for file types and operations in changesets.
6
final class ArcanistDiffChangeType {
10
const TYPE_DELETE = 3;
11
const TYPE_MOVE_AWAY = 4;
12
const TYPE_COPY_AWAY = 5;
13
const TYPE_MOVE_HERE = 6;
14
const TYPE_COPY_HERE = 7;
15
const TYPE_MULTICOPY = 8;
16
const TYPE_MESSAGE = 9;
17
const TYPE_CHILD = 10;
21
const FILE_BINARY = 3;
22
const FILE_DIRECTORY = 4;
23
const FILE_SYMLINK = 5;
24
const FILE_DELETED = 6;
25
const FILE_NORMAL = 7;
27
public static function getSummaryCharacterForChangeType($type) {
28
static $types = array(
29
self::TYPE_ADD => 'A',
30
self::TYPE_CHANGE => 'M',
31
self::TYPE_DELETE => 'D',
32
self::TYPE_MOVE_AWAY => 'V',
33
self::TYPE_COPY_AWAY => 'P',
34
self::TYPE_MOVE_HERE => 'V',
35
self::TYPE_COPY_HERE => 'P',
36
self::TYPE_MULTICOPY => 'P',
37
self::TYPE_MESSAGE => 'Q',
38
self::TYPE_CHILD => '@',
40
return idx($types, coalesce($type, '?'), '~');
43
public static function getShortNameForFileType($type) {
44
static $names = array(
45
self::FILE_TEXT => null,
46
self::FILE_DIRECTORY => 'dir',
47
self::FILE_IMAGE => 'img',
48
self::FILE_BINARY => 'bin',
49
self::FILE_SYMLINK => 'sym',
51
return idx($names, coalesce($type, '?'), '???');
54
public static function isOldLocationChangeType($type) {
55
static $types = array(
56
ArcanistDiffChangeType::TYPE_MOVE_AWAY => true,
57
ArcanistDiffChangeType::TYPE_COPY_AWAY => true,
58
ArcanistDiffChangeType::TYPE_MULTICOPY => true,
60
return isset($types[$type]);
63
public static function isNewLocationChangeType($type) {
64
static $types = array(
65
ArcanistDiffChangeType::TYPE_MOVE_HERE => true,
66
ArcanistDiffChangeType::TYPE_COPY_HERE => true,
68
return isset($types[$type]);
71
public static function isDeleteChangeType($type) {
72
static $types = array(
73
ArcanistDiffChangeType::TYPE_DELETE => true,
74
ArcanistDiffChangeType::TYPE_MOVE_AWAY => true,
75
ArcanistDiffChangeType::TYPE_MULTICOPY => true,
77
return isset($types[$type]);
80
public static function isCreateChangeType($type) {
81
static $types = array(
82
ArcanistDiffChangeType::TYPE_ADD => true,
83
ArcanistDiffChangeType::TYPE_COPY_HERE => true,
84
ArcanistDiffChangeType::TYPE_MOVE_HERE => true,
86
return isset($types[$type]);
89
public static function isModifyChangeType($type) {
90
static $types = array(
91
ArcanistDiffChangeType::TYPE_CHANGE => true,
93
return isset($types[$type]);
96
public static function getFullNameForChangeType($type) {
97
static $types = array(
98
self::TYPE_ADD => 'Added',
99
self::TYPE_CHANGE => 'Modified',
100
self::TYPE_DELETE => 'Deleted',
101
self::TYPE_MOVE_AWAY => 'Moved Away',
102
self::TYPE_COPY_AWAY => 'Copied Away',
103
self::TYPE_MOVE_HERE => 'Moved Here',
104
self::TYPE_COPY_HERE => 'Copied Here',
105
self::TYPE_MULTICOPY => 'Deleted After Multiple Copy',
106
self::TYPE_MESSAGE => 'Commit Message',
107
self::TYPE_CHILD => 'Contents Modified',
109
return idx($types, coalesce($type, '?'), 'Unknown');