Use 'Merge list' as display name for /MERGE_LIST
Bug: issue 6041 Change-Id: I4cd4ce47173a277cf917ced5b274225aa982000d
This commit is contained in:
committed by
David Pursehouse
parent
99550098d4
commit
a93d94396a
@@ -20,8 +20,8 @@ limitations under the License.
|
||||
/** @polymerBehavior Gerrit.PathListBehavior */
|
||||
var PathListBehavior = {
|
||||
specialFilePathCompare: function(a, b) {
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
// The commit message always goes first.
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
if (a === COMMIT_MESSAGE_PATH) {
|
||||
return -1;
|
||||
}
|
||||
@@ -29,6 +29,15 @@ limitations under the License.
|
||||
return 1;
|
||||
}
|
||||
|
||||
// The merge list always comes next.
|
||||
var MERGE_LIST_PATH = '/MERGE_LIST';
|
||||
if (a === MERGE_LIST_PATH) {
|
||||
return -1;
|
||||
}
|
||||
if (b === MERGE_LIST_PATH) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
var aLastDotIndex = a.lastIndexOf('.');
|
||||
var aExt = a.substr(aLastDotIndex + 1);
|
||||
var aFile = a.substr(0, aLastDotIndex) || a;
|
||||
|
||||
@@ -27,13 +27,14 @@ limitations under the License.
|
||||
var sort = Gerrit.PathListBehavior.specialFilePathCompare;
|
||||
var testFiles = [
|
||||
'/a.h',
|
||||
'/MERGE_LIST',
|
||||
'/a.cpp',
|
||||
'/COMMIT_MSG',
|
||||
'/asdasd',
|
||||
'/mrPeanutbutter.py'
|
||||
];
|
||||
assert.deepEqual(testFiles.sort(sort),
|
||||
['/COMMIT_MSG', '/a.h', '/a.cpp', '/asdasd', '/mrPeanutbutter.py']);
|
||||
['/COMMIT_MSG', '/MERGE_LIST', '/a.h', '/a.cpp', '/asdasd', '/mrPeanutbutter.py']);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
var PATCH_DESC_MAX_LENGTH = 500;
|
||||
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
var MERGE_LIST_PATH = '/MERGE_LIST';
|
||||
|
||||
var FileStatus = {
|
||||
A: 'Added',
|
||||
@@ -601,12 +602,16 @@
|
||||
},
|
||||
|
||||
_computeFileDisplayName: function(path) {
|
||||
return path === COMMIT_MESSAGE_PATH ? 'Commit message' : path;
|
||||
if (path === COMMIT_MESSAGE_PATH) {
|
||||
return 'Commit message';
|
||||
} else if (path === MERGE_LIST_PATH) {
|
||||
return 'Merge list';
|
||||
}
|
||||
return path;
|
||||
},
|
||||
|
||||
_computeTruncatedFileDisplayName: function(path) {
|
||||
return path === COMMIT_MESSAGE_PATH ?
|
||||
'Commit message' : util.truncatePath(path);
|
||||
return util.truncatePath(this._computeFileDisplayName(path));
|
||||
},
|
||||
|
||||
_formatBytes: function(bytes) {
|
||||
@@ -636,7 +641,7 @@
|
||||
|
||||
_computeClass: function(baseClass, path) {
|
||||
var classes = [baseClass];
|
||||
if (path === COMMIT_MESSAGE_PATH) {
|
||||
if (path === COMMIT_MESSAGE_PATH || path === MERGE_LIST_PATH) {
|
||||
classes.push('invisible');
|
||||
}
|
||||
return classes.join(' ');
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
'use strict';
|
||||
|
||||
var COMMIT_MESSAGE_PATH = '/COMMIT_MSG';
|
||||
var MERGE_LIST_PATH = '/MERGE_LIST';
|
||||
|
||||
var COMMENT_SAVE = 'Try again when all comments have saved.';
|
||||
|
||||
@@ -553,12 +554,16 @@
|
||||
},
|
||||
|
||||
_computeFileDisplayName: function(path) {
|
||||
return path === COMMIT_MESSAGE_PATH ? 'Commit message' : path;
|
||||
if (path === COMMIT_MESSAGE_PATH) {
|
||||
return 'Commit message';
|
||||
} else if (path === MERGE_LIST_PATH) {
|
||||
return 'Merge list';
|
||||
}
|
||||
return path;
|
||||
},
|
||||
|
||||
_computeTruncatedFileDisplayName: function(path) {
|
||||
return path === COMMIT_MESSAGE_PATH ?
|
||||
'Commit message' : util.truncatePath(path);
|
||||
return util.truncatePath(this._computeFileDisplayName(path));
|
||||
},
|
||||
|
||||
_computeFileSelected: function(path, currentPath) {
|
||||
|
||||
@@ -343,6 +343,8 @@ limitations under the License.
|
||||
'/foo/bar/baz');
|
||||
assert.equal(element._computeFileDisplayName('/COMMIT_MSG'),
|
||||
'Commit message');
|
||||
assert.equal(element._computeFileDisplayName('/MERGE_LIST'),
|
||||
'Merge list');
|
||||
});
|
||||
|
||||
test('jump to file dropdown with patch range', function() {
|
||||
|
||||
Reference in New Issue
Block a user