зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1580184 - Avoid creating duplicate entries in the source tree, r=jlast.
Differential Revision: https://phabricator.services.mozilla.com/D50268 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1c1c39c118
Коммит
909ce93ac8
|
@ -373,7 +373,7 @@ function generateDefaults(overrides: Object) {
|
|||
),
|
||||
"server1.conn13.child1/42/originalSource-sha": createMockSource(
|
||||
"server1.conn13.child1/42/originalSource-sha",
|
||||
"http://mdn.com/four.js",
|
||||
"http://mdn.com/four.js [original]",
|
||||
false
|
||||
),
|
||||
"server1.conn13.child1/42": createMockSource(
|
||||
|
|
|
@ -179,11 +179,11 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi
|
|||
"isExtension": false,
|
||||
"isPrettyPrinted": false,
|
||||
"isWasm": false,
|
||||
"relativeUrl": "http://mdn.com/four.js",
|
||||
"url": "http://mdn.com/four.js",
|
||||
"relativeUrl": "http://mdn.com/four.js [original]",
|
||||
"url": "http://mdn.com/four.js [original]",
|
||||
},
|
||||
"name": "four.js",
|
||||
"path": "FakeThread/mdn.com/four.js",
|
||||
"name": "four.js%20[original]",
|
||||
"path": "FakeThread/mdn.com/four.js%20[original]",
|
||||
"type": "source",
|
||||
},
|
||||
Object {
|
||||
|
@ -273,11 +273,11 @@ exports[`SourcesTree on receiving new props updates highlighted items updates hi
|
|||
"isExtension": false,
|
||||
"isPrettyPrinted": false,
|
||||
"isWasm": false,
|
||||
"relativeUrl": "http://mdn.com/four.js",
|
||||
"url": "http://mdn.com/four.js",
|
||||
"relativeUrl": "http://mdn.com/four.js [original]",
|
||||
"url": "http://mdn.com/four.js [original]",
|
||||
},
|
||||
"name": "four.js",
|
||||
"path": "FakeThread/mdn.com/four.js",
|
||||
"name": "four.js%20[original]",
|
||||
"path": "FakeThread/mdn.com/four.js%20[original]",
|
||||
"type": "source",
|
||||
},
|
||||
Object {
|
||||
|
|
|
@ -36,10 +36,9 @@ function createNodeInTree(
|
|||
}
|
||||
|
||||
/*
|
||||
* Look for the child directory
|
||||
* Look for the child node
|
||||
* 1. if it exists return it
|
||||
* 2. if it does not exist create it
|
||||
* 3. if it is a file, replace it with a directory
|
||||
*/
|
||||
function findOrCreateNode(
|
||||
parts: string[],
|
||||
|
@ -69,7 +68,7 @@ function findOrCreateNode(
|
|||
const childIsFile = !nodeHasChildren(child);
|
||||
|
||||
// if we have a naming conflict, we'll create a new node
|
||||
if (child.type === "source" || (!childIsFile && addedPartIsFile)) {
|
||||
if (childIsFile != addedPartIsFile) {
|
||||
// pass true to findNodeInContents to sort node by url
|
||||
const { index: insertIndex } = findNodeInContents(
|
||||
subTree,
|
||||
|
@ -79,7 +78,7 @@ function findOrCreateNode(
|
|||
}
|
||||
|
||||
// if there is no naming conflict, we can traverse into the child
|
||||
return child;
|
||||
return (child: any);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -132,7 +131,7 @@ function addSourceToNode(
|
|||
): Source | TreeNode[] {
|
||||
const isFile = !isPathDirectory(url.path);
|
||||
|
||||
if (node.type == "source") {
|
||||
if (node.type == "source" && !isFile) {
|
||||
throw new Error(`Unexpected type "source" at: ${node.name}`);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче