Use 'owned commit' instead of 'sub commit' whenever refers to a commit owned by anoth...
authordewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Sep 2017 21:47:41 +0000 (21:47 +0000)
committerdewei_zhu@apple.com <dewei_zhu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Sep 2017 21:47:41 +0000 (21:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177178

Reviewed by Ryosuke Niwa.

We use both 'owned commit' and 'sub commit' to refer to a commit owned by an another commit. We should use one term instead of two.
Renaming 'subCommit' to 'ownedCommit', 'ownsSubCommit' to 'ownsCommit' and 'sub-commit' to 'owned-commit'.

* browser-tests/commit-log-viewer-tests.js:
* public/api/commits.php:
* public/api/report-commits.php:
* public/include/commit-log-fetcher.php:
* public/v3/components/commit-log-viewer.js:
(CommitLogViewer.prototype._renderCommitList):
* public/v3/components/owned-commit-viewer.js: Renamed from Websites/perf.webkit.org/public/v3/components/sub-commit-viewer.js.
(OwnedCommitViewer):
(OwnedCommitViewer.prototype.didConstructShadowTree):
(OwnedCommitViewer.prototype._toggleVisibility):
(OwnedCommitViewer.prototype.render):
(OwnedCommitViewer.prototype._renderOwnedCommitTable):
(OwnedCommitViewer.htmlTemplate):
(OwnedCommitViewer.cssTemplate):
* public/v3/index.html:
* public/v3/models/commit-log.js:
(CommitLog):
(CommitLog.prototype.updateSingleton):
(CommitLog.prototype.ownsCommits):
(CommitLog.prototype.fetchOwnedCommits):
(CommitLog.prototype._buildOwnedCommitMap):
(CommitLog.diffOwnedCommits):
(CommitLog.prototype.ownsSubCommits): Deleted.
(CommitLog.prototype.fetchSubCommits): Deleted.
(CommitLog.prototype._buildSubCommitMap): Deleted.
(CommitLog.diffSubCommits): Deleted.
* server-tests/api-commits-tests.js:
* server-tests/api-report-commits-tests.js:
* server-tests/tools-os-build-fetcher-tests.js:
(return.waitForInvocationPromise.then):
(string_appeared_here.return.waitForInvocationPromise.then):
* tools/js/os-build-fetcher.js:
(prototype._fetchAvailableBuilds):
(prototype._addOwnedCommitsForBuild):
(prototype._addSubCommitsForBuild): Deleted.
* unit-tests/commit-log-tests.js:
(return.commit.fetchOwnedCommits.then):
(return.fetchingPromise.then):
(return.commit.fetchSubCommits.then): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222227 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Websites/perf.webkit.org/ChangeLog
Websites/perf.webkit.org/browser-tests/commit-log-viewer-tests.js
Websites/perf.webkit.org/public/api/commits.php
Websites/perf.webkit.org/public/api/report-commits.php
Websites/perf.webkit.org/public/include/commit-log-fetcher.php
Websites/perf.webkit.org/public/v3/components/commit-log-viewer.js
Websites/perf.webkit.org/public/v3/components/owned-commit-viewer.js [moved from Websites/perf.webkit.org/public/v3/components/sub-commit-viewer.js with 64% similarity]
Websites/perf.webkit.org/public/v3/index.html
Websites/perf.webkit.org/public/v3/models/commit-log.js
Websites/perf.webkit.org/server-tests/api-commits-tests.js
Websites/perf.webkit.org/server-tests/api-report-commits-tests.js
Websites/perf.webkit.org/server-tests/tools-os-build-fetcher-tests.js
Websites/perf.webkit.org/tools/js/os-build-fetcher.js
Websites/perf.webkit.org/unit-tests/commit-log-tests.js

index 14c2782..ef6028a 100644 (file)
@@ -1,3 +1,53 @@
+2017-09-19  Dewei Zhu  <dewei_zhu@apple.com>
+
+        Use 'owned commit' instead of 'sub commit' whenever refers to a commit owned by another commit.
+        https://bugs.webkit.org/show_bug.cgi?id=177178
+
+        Reviewed by Ryosuke Niwa.
+
+        We use both 'owned commit' and 'sub commit' to refer to a commit owned by an another commit. We should use one term instead of two.
+        Renaming 'subCommit' to 'ownedCommit', 'ownsSubCommit' to 'ownsCommit' and 'sub-commit' to 'owned-commit'.
+
+        * browser-tests/commit-log-viewer-tests.js:
+        * public/api/commits.php:
+        * public/api/report-commits.php:
+        * public/include/commit-log-fetcher.php:
+        * public/v3/components/commit-log-viewer.js:
+        (CommitLogViewer.prototype._renderCommitList):
+        * public/v3/components/owned-commit-viewer.js: Renamed from Websites/perf.webkit.org/public/v3/components/sub-commit-viewer.js.
+        (OwnedCommitViewer):
+        (OwnedCommitViewer.prototype.didConstructShadowTree):
+        (OwnedCommitViewer.prototype._toggleVisibility):
+        (OwnedCommitViewer.prototype.render):
+        (OwnedCommitViewer.prototype._renderOwnedCommitTable):
+        (OwnedCommitViewer.htmlTemplate):
+        (OwnedCommitViewer.cssTemplate):
+        * public/v3/index.html:
+        * public/v3/models/commit-log.js:
+        (CommitLog):
+        (CommitLog.prototype.updateSingleton):
+        (CommitLog.prototype.ownsCommits):
+        (CommitLog.prototype.fetchOwnedCommits):
+        (CommitLog.prototype._buildOwnedCommitMap):
+        (CommitLog.diffOwnedCommits):
+        (CommitLog.prototype.ownsSubCommits): Deleted.
+        (CommitLog.prototype.fetchSubCommits): Deleted.
+        (CommitLog.prototype._buildSubCommitMap): Deleted.
+        (CommitLog.diffSubCommits): Deleted.
+        * server-tests/api-commits-tests.js:
+        * server-tests/api-report-commits-tests.js:
+        * server-tests/tools-os-build-fetcher-tests.js:
+        (return.waitForInvocationPromise.then):
+        (string_appeared_here.return.waitForInvocationPromise.then):
+        * tools/js/os-build-fetcher.js:
+        (prototype._fetchAvailableBuilds):
+        (prototype._addOwnedCommitsForBuild):
+        (prototype._addSubCommitsForBuild): Deleted.
+        * unit-tests/commit-log-tests.js:
+        (return.commit.fetchOwnedCommits.then):
+        (return.fetchingPromise.then):
+        (return.commit.fetchSubCommits.then): Deleted.
+
 2017-09-12  Dewei Zhu  <dewei_zhu@apple.com>
 
         Performance Dashboard backend should support A/B testing for owned components.
index 265b6f7..0c6b341 100644 (file)
@@ -23,7 +23,7 @@ describe('CommitLogViewer', () => {
         "revision": "210949",
         "repository": 1,
         "previousCommit": null,
-        "ownsSubCommits": false,
+        "ownsCommits": false,
         "time": +new Date("2017-01-20T03:23:50.645Z"),
         "authorName": "Chris Dumez",
         "authorEmail": "cdumez@apple.com",
@@ -35,7 +35,7 @@ describe('CommitLogViewer', () => {
         "revision": "210950",
         "repository": 1,
         "previousCommit": null,
-        "ownsSubCommits": false,
+        "ownsCommits": false,
         "time": +new Date("2017-01-20T03:49:37.887Z"),
         "authorName": "Commit Queue",
         "authorEmail": "commit-queue@webkit.org",
index bd8df22..96cce1f 100644 (file)
@@ -38,9 +38,9 @@ function main($paths) {
             $commits = $fetcher->fetch_latest_for_platform($repository_id, $platform_id);
         } else
             $commits = $fetcher->fetch_latest($repository_id);
-    } else if ($filter == 'sub-commits') {
+    } else if ($filter == 'owned-commits') {
         $owner_revision = array_get($_GET, 'owner-revision');
-        $commits = $fetcher->fetch_subcommits_for_revision($repository_id, $owner_revision);
+        $commits = $fetcher->fetch_owned_commits_for_revision($repository_id, $owner_revision);
     } else if ($filter == 'last-reported') {
         $from = array_get($_GET, 'from');
         $to = array_get($_GET, 'to');
index 559b41b..6c651a9 100644 (file)
@@ -32,20 +32,20 @@ function main($post_data)
             exit_with_error('FailedToInsertRepository', array('commit' => $commit_info));
         }
         $owner_commit_id = insert_commit($db, $commit_info, $repository_id, NULL);
-        if (!array_key_exists('subCommits', $commit_info))
+        if (!array_key_exists('ownedCommits', $commit_info))
             continue;
 
-        foreach($commit_info['subCommits'] as $sub_commit_repository_name => $sub_commit_info) {
-            if (array_key_exists('time', $sub_commit_info)) {
+        foreach($commit_info['ownedCommits'] as $owned_commit_repository_name => $owned_commit_info) {
+            if (array_key_exists('time', $owned_commit_info)) {
                 $db->rollback_transaction();
-                exit_with_error('SubCommitShouldNotContainTimestamp', array('commit' => $sub_commit_info));
+                exit_with_error('OwnedCommitShouldNotContainTimestamp', array('commit' => $owned_commit_info));
             }
-            $sub_commit_repository_id = $db->select_or_insert_row('repositories', 'repository', array('name' => $sub_commit_repository_name, 'owner' => $repository_id));
-            if (!$sub_commit_repository_id) {
+            $owned_commit_repository_id = $db->select_or_insert_row('repositories', 'repository', array('name' => $owned_commit_repository_name, 'owner' => $repository_id));
+            if (!$owned_commit_repository_id) {
                 $db->rollback_transaction();
-                exit_with_error('FailedToInsertRepository', array('commit' => $sub_commit_info));
+                exit_with_error('FailedToInsertRepository', array('commit' => $owned_commit_info));
             }
-            insert_commit($db, $sub_commit_info, $sub_commit_repository_id, $owner_commit_id);
+            insert_commit($db, $owned_commit_info, $owned_commit_repository_id, $owner_commit_id);
         }
     }
     $db->commit_transaction();
index fe3d759..709cf2d 100644 (file)
@@ -35,7 +35,7 @@ class CommitLogFetcher {
         foreach ($commit_rows as &$commit_row) {
             $associated_task = &$task_by_id[$commit_row['taskcommit_task']];
             # FIXME: The last parameter should be determined based on commit_ownerships.
-            $commit = $this->format_commit($commit_row, $commit_row, /* owns_sub_commits */ FALSE);
+            $commit = $this->format_commit($commit_row, $commit_row, /* owns_commits */ FALSE);
             $commit['repository'] = $commit_row['commit_repository'];
             array_push($commits, $commit);
             array_push($associated_task[Database::is_true($commit_row['taskcommit_is_fix']) ? 'fixes' : 'causes'], $commit_row['commit_id']);
@@ -61,7 +61,7 @@ class CommitLogFetcher {
             committer_account as "authorEmail",
             commit_repository as "repository",
             commit_message as "message",
-            EXISTS(SELECT * FROM commit_ownerships WHERE commit_owner = commit_id) as "ownsSubCommits"
+            EXISTS(SELECT * FROM commit_ownerships WHERE commit_owner = commit_id) as "ownsCommits"
             FROM commits LEFT OUTER JOIN committers ON commit_committer = committer_id
             WHERE commit_repository = $1 AND commit_reported = true';
         $values = array($repository_id);
@@ -107,13 +107,13 @@ class CommitLogFetcher {
 
         foreach ($commits as &$commit) {
             $commit['time'] = Database::to_js_time($commit['time']);
-            $commit['ownsSubCommits'] = Database::is_true($commit['ownsSubCommits']);
+            $commit['ownsCommits'] = Database::is_true($commit['ownsCommits']);
         }
 
         return $commits;
     }
 
-    function fetch_subcommits_for_revision($repository_id, $commit_revision) {
+    function fetch_owned_commits_for_revision($repository_id, $commit_revision) {
         return $this->db->query_and_fetch_all('SELECT owned.commit_repository as "repository",
             owned.commit_revision as "revision",
             owned.commit_time as "time",
@@ -195,11 +195,11 @@ class CommitLogFetcher {
         if (!$commit_row)
             return array();
         $committer = $this->db->select_first_row('committers', 'committer', array('id' => $commit_row['commit_committer']));
-        $owns_sub_commits = !!$this->db->select_first_row('commit_ownerships', 'commit', array('owner' => $commit_row['commit_id']));
-        return array($this->format_commit($commit_row, $committer, $owns_sub_commits));
+        $owns_commits = !!$this->db->select_first_row('commit_ownerships', 'commit', array('owner' => $commit_row['commit_id']));
+        return array($this->format_commit($commit_row, $committer, $owns_commits));
     }
 
-    private function format_commit($commit_row, $committer_row, $owns_sub_commits) {
+    private function format_commit($commit_row, $committer_row, $owns_commits) {
         return array(
             'id' => $commit_row['commit_id'],
             'revision' => $commit_row['commit_revision'],
@@ -210,7 +210,7 @@ class CommitLogFetcher {
             'authorName' => $committer_row ? $committer_row['committer_name'] : null,
             'authorEmail' => $committer_row ? $committer_row['committer_account'] : null,
             'message' => $commit_row['commit_message'],
-            'ownsSubCommits' => $owns_sub_commits
+            'ownsCommits' => $owns_commits
         );
     }
 }
index 4c76e21..a6e6cc2 100644 (file)
@@ -77,10 +77,10 @@ class CommitLogViewer extends ComponentBase {
         this.renderReplace(this.content('commits-list'), (commits || []).map((commit) => {
             const label = commit.label();
             const url = commit.url();
-            const ownsSubCommits = previousCommit && previousCommit.ownsSubCommits() && commit.ownsSubCommits();
-            const subCommitDifferenceRow = ownsSubCommits ? element('tr', element('td', {colspan: 2}, new SubCommitViewer(previousCommit, commit))) : [];
+            const ownsCommits = previousCommit && previousCommit.ownsCommits() && commit.ownsCommits();
+            const ownedCommitDifferenceRow = ownsCommits ? element('tr', element('td', {colspan: 2}, new OwnedCommitViewer(previousCommit, commit))) : [];
             previousCommit = commit;
-            return [subCommitDifferenceRow,
+            return [ownedCommitDifferenceRow,
                 element('tr', [
                     element('th', [element('h4', {class: 'revision'}, url ? link(label, commit.title(), url) : label), commit.author() || '']),
                     element('td', commit.message() ? commit.message().substring(0, 80) : '')])];
@@ -1,14 +1,14 @@
-class SubCommitViewer extends ComponentBase {
+class OwnedCommitViewer extends ComponentBase {
 
     constructor(previousCommit, currentCommit)
     {
-        super('sub-commit-viewer');
+        super('owned-commit-viewer');
         this._previousCommit = previousCommit;
         this._currentCommit = currentCommit;
-        this._previousSubCommits = null;
-        this._currentSubCommits = null;
-        this._showingSubCommits = false;
-        this._renderSubCommitTableLazily = new LazilyEvaluatedFunction(this._renderSubcommitTable.bind(this));
+        this._previousOwnedCommits = null;
+        this._currentOwnedCommits = null;
+        this._showingOwnedCommits = false;
+        this._renderOwnedCommitTableLazily = new LazilyEvaluatedFunction(this._renderOwnedCommitTable.bind(this));
     }
 
     didConstructShadowTree()
@@ -18,32 +18,32 @@ class SubCommitViewer extends ComponentBase {
 
     _toggleVisibility(expanded)
     {
-        this._showingSubCommits = expanded;
+        this._showingOwnedCommits = expanded;
         this.enqueueToRender();
 
-        Promise.all([this._previousCommit.fetchSubCommits(), this._currentCommit.fetchSubCommits()]).then((subCommitsList) => {
-            this._previousSubCommits = subCommitsList[0];
-            this._currentSubCommits = subCommitsList[1];
+        Promise.all([this._previousCommit.fetchOwnedCommits(), this._currentCommit.fetchOwnedCommits()]).then((ownedCommitsList) => {
+            this._previousOwnedCommits = ownedCommitsList[0];
+            this._currentOwnedCommits = ownedCommitsList[1];
             this.enqueueToRender();
         });
     }
 
     render()
     {
-        const hideSpinner = (this._previousSubCommits && this._currentSubCommits) || !this._showingSubCommits;
+        const hideSpinner = (this._previousOwnedCommits && this._currentOwnedCommits) || !this._showingOwnedCommits;
 
-        this.content('difference-entries').style.display =  this._showingSubCommits ? null : 'none';
+        this.content('difference-entries').style.display =  this._showingOwnedCommits ? null : 'none';
         this.content('spinner-container').style.display = hideSpinner ? 'none' : null;
-        this.content('difference-table').style.display = this._showingSubCommits ? null : 'none';
-        this._renderSubCommitTableLazily.evaluate(this._previousSubCommits, this._currentSubCommits);
+        this.content('difference-table').style.display = this._showingOwnedCommits ? null : 'none';
+        this._renderOwnedCommitTableLazily.evaluate(this._previousOwnedCommits, this._currentOwnedCommits);
     }
 
-    _renderSubcommitTable(previousSubCommits, currentSubCommits)
+    _renderOwnedCommitTable(previousOwnedCommits, currentOwnedCommits)
     {
-        if (!previousSubCommits || !currentSubCommits)
+        if (!previousOwnedCommits || !currentOwnedCommits)
             return;
 
-        const difference = CommitLog.diffSubCommits(this._previousCommit, this._currentCommit);
+        const difference = CommitLog.diffOwnedCommits(this._previousCommit, this._currentCommit);
         const sortedRepositories = Repository.sortByName([...difference.keys()]);
         const element = ComponentBase.createElement;
 
@@ -95,4 +95,4 @@ class SubCommitViewer extends ComponentBase {
     }
 }
 
-ComponentBase.defineElement('sub-commit-viewer', SubCommitViewer);
\ No newline at end of file
+ComponentBase.defineElement('owned-commit-viewer', OwnedCommitViewer);
index d70ca2d..46e6adc 100644 (file)
@@ -74,7 +74,7 @@ Run tools/bundle-v3-scripts to speed up the load time for production.`);
         <script src="components/warning-icon.js"></script>
         <script src="components/close-button.js"></script>
         <script src="components/commit-log-viewer.js"></script>
-        <script src="components/sub-commit-viewer.js"></script>
+        <script src="components/owned-commit-viewer.js"></script>
         <script src="components/editable-text.js"></script>
         <script src="components/expand-collapse-button.js"></script>
         <script src="components/time-series-chart.js"></script>
index 8a74a7c..7be4214 100644 (file)
@@ -11,7 +11,7 @@ class CommitLog extends DataModelObject {
         this._remoteId = rawData.id;
         if (this._remoteId)
             this.ensureNamedStaticMap('remoteId')[this._remoteId] = this;
-        this._subCommits = null;
+        this._ownedCommits = null;
     }
 
     updateSingleton(rawData)
@@ -25,8 +25,8 @@ class CommitLog extends DataModelObject {
             this._rawData.authorName = rawData.authorName;
         if (rawData.message)
             this._rawData.message = rawData.message;
-        if (rawData.ownsSubCommits)
-            this._rawData.ownsSubCommits = rawData.ownsSubCommits;
+        if (rawData.ownsCommits)
+            this._rawData.ownsCommits = rawData.ownsCommits;
     }
 
     repository() { return this._repository; }
@@ -35,7 +35,7 @@ class CommitLog extends DataModelObject {
     revision() { return this._rawData['revision']; }
     message() { return this._rawData['message']; }
     url() { return this._repository.urlForRevision(this._rawData['revision']); }
-    ownsSubCommits() { return this._rawData['ownsSubCommits']; }
+    ownsCommits() { return this._rawData['ownsCommits']; }
 
     label()
     {
@@ -86,48 +86,48 @@ class CommitLog extends DataModelObject {
         });
     }
 
-    fetchSubCommits()
+    fetchOwnedCommits()
     {
         if (!this.repository().ownedRepositories())
             return Promise.reject();
 
-        if (!this.ownsSubCommits())
+        if (!this.ownsCommits())
             return Promise.reject();
 
-        if (this._subCommits)
-            return Promise.resolve(this._subCommits);
+        if (this._ownedCommits)
+            return Promise.resolve(this._ownedCommits);
 
-        return CommitLog.cachedFetch(`../api/commits/${this.repository().id()}/sub-commits?owner-revision=${escape(this.revision())}`).then((data) => {
-            this._subCommits = CommitLog._constructFromRawData(data);
-            return this._subCommits;
+        return CommitLog.cachedFetch(`../api/commits/${this.repository().id()}/owned-commits?owner-revision=${escape(this.revision())}`).then((data) => {
+            this._ownedCommits = CommitLog._constructFromRawData(data);
+            return this._ownedCommits;
         });
     }
 
-    _buildSubCommitMap()
+    _buildOwnedCommitMap()
     {
-        const subCommitMap = new Map;
-        for (const commit of this._subCommits)
-            subCommitMap.set(commit.repository(), commit);
-        return subCommitMap;
+        const ownedCommitMap = new Map;
+        for (const commit of this._ownedCommits)
+            ownedCommitMap.set(commit.repository(), commit);
+        return ownedCommitMap;
     }
 
-    static diffSubCommits(previousCommit, currentCommit)
+    static diffOwnedCommits(previousCommit, currentCommit)
     {
         console.assert(previousCommit);
         console.assert(currentCommit);
-        console.assert(previousCommit._subCommits);
-        console.assert(currentCommit._subCommits);
+        console.assert(previousCommit._ownedCommits);
+        console.assert(currentCommit._ownedCommits);
 
-        const previousSubCommitMap = previousCommit._buildSubCommitMap();
-        const currentSubCommitMap = currentCommit._buildSubCommitMap();
-        const subCommitRepositories = new Set([...currentSubCommitMap.keys(), ...previousSubCommitMap.keys()]);
+        const previousOwnedCommitMap = previousCommit._buildOwnedCommitMap();
+        const currentOwnedCommitMap = currentCommit._buildOwnedCommitMap();
+        const ownedCommitRepositories = new Set([...currentOwnedCommitMap.keys(), ...previousOwnedCommitMap.keys()]);
         const difference = new Map;
 
-        subCommitRepositories.forEach((subCommitRepository) => {
-            const currentRevision = currentSubCommitMap.get(subCommitRepository);
-            const previousRevision = previousSubCommitMap.get(subCommitRepository);
+        ownedCommitRepositories.forEach((ownedCommitRepository) => {
+            const currentRevision = currentOwnedCommitMap.get(ownedCommitRepository);
+            const previousRevision = previousOwnedCommitMap.get(ownedCommitRepository);
             if (currentRevision != previousRevision)
-                difference.set(subCommitRepository, [previousRevision, currentRevision]);
+                difference.set(ownedCommitRepository, [previousRevision, currentRevision]);
         });
 
         return difference;
index 3d990d5..324962a 100644 (file)
@@ -413,8 +413,8 @@ describe("/api/commits/", function () {
 
     });
 
-    describe('/api/commits/<repository>/sub-commits?owner-revision=<commit>', () => {
-        it("should return sub commits for a given commit", () => {
+    describe('/api/commits/<repository>/owned-commits?owner-revision=<commit>', () => {
+        it("should return owned commits for a given commit", () => {
             const db = TestServer.database();
             return Promise.all([
                 db.insert('repositories', {'id': 1, 'name': 'macOS'}),
@@ -423,19 +423,19 @@ describe("/api/commits/", function () {
                 db.insert('commits', {'id': 2, 'repository': 2, 'revision': '210950', 'reported': true}),
                 db.insert('commit_ownerships', {'owner': 1, 'owned': 2})
             ]).then(() => {
-                return TestServer.remoteAPI().getJSON('/api/commits/1/sub-commits?owner-revision=10.12%2016A323')
+                return TestServer.remoteAPI().getJSON('/api/commits/1/owned-commits?owner-revision=10.12%2016A323')
             }).then((results) => {
                 assert.equal(results.status, 'OK');
                 assert.equal(results.commits.length, 1);
 
-                const subCommit = results.commits[0];
-                assert.equal(subCommit.repository, 2);
-                assert.equal(subCommit.revision, '210950');
-                assert.equal(subCommit.id, 2);
+                const ownedCommit = results.commits[0];
+                assert.equal(ownedCommit.repository, 2);
+                assert.equal(ownedCommit.revision, '210950');
+                assert.equal(ownedCommit.id, 2);
             });
         });
 
-        it("should return an empty list of commits if no sub-commits is associated with given commit", () => {
+        it("should return an empty list of commits if no owned-commit is associated with given commit", () => {
             const db = TestServer.database();
             return Promise.all([
                 db.insert('repositories', {'id': 1, 'name': 'macOS'}),
@@ -443,7 +443,7 @@ describe("/api/commits/", function () {
                 db.insert('commits', {'id': 1, 'repository': 1, 'revision': '10.12 16A323', order: 1, 'reported': true}),
                 db.insert('commits', {'id': 2, 'repository': 2, 'revision': '210950', 'reported': true})
             ]).then(() => {
-                return TestServer.remoteAPI().getJSON('/api/commits/1/sub-commits?owner-revision=10.12%2016A323')
+                return TestServer.remoteAPI().getJSON('/api/commits/1/owned-commits?owner-revision=10.12%2016A323')
             }).then((results) => {
                 assert.equal(results.status, 'OK');
                 assert.deepEqual(results.commits, []);
@@ -458,7 +458,7 @@ describe("/api/commits/", function () {
                 db.insert('commits', {'id': 1, 'repository': 1, 'revision': '10.12 16A323', order: 1, 'reported': true}),
                 db.insert('commits', {'id': 2, 'repository': 2, 'revision': '210950', 'reported': true})
             ]).then(() => {
-                return TestServer.remoteAPI().getJSON('/api/commits/1/sub-commits?owner-revision=10.12%2016A324')
+                return TestServer.remoteAPI().getJSON('/api/commits/1/owned-commits?owner-revision=10.12%2016A324')
             }).then((results) => {
                 assert.equal(results.status, 'OK');
                 assert.equal(results.commits.length, 0);
index 6eeba3b..f224df7 100644 (file)
@@ -268,7 +268,7 @@ describe("/api/report-commits/", function () {
         });
     });
 
-    const sameRepositoryNameInSubCommitAndMajorCommit = {
+    const sameRepositoryNameInOwnedCommitAndMajorCommit = {
         "slaveName": "someSlave",
         "slavePassword": "somePassword",
         "commits": [
@@ -276,7 +276,7 @@ describe("/api/report-commits/", function () {
                 "repository": "OSX",
                 "revision": "Sierra16D32",
                 "order": 1,
-                "subCommits": {
+                "ownedCommits": {
                     "WebKit": {
                         "revision": "141978",
                         "author": {"name": "Commit Queue", "account": "commit-queue@webkit.org"},
@@ -299,8 +299,8 @@ describe("/api/report-commits/", function () {
     }
 
     it("should distinguish between repositories with the same name but with a different owner.", () => {
-        return addSlaveForReport(sameRepositoryNameInSubCommitAndMajorCommit).then(() => {
-            return TestServer.remoteAPI().postJSON('/api/report-commits/', sameRepositoryNameInSubCommitAndMajorCommit);
+        return addSlaveForReport(sameRepositoryNameInOwnedCommitAndMajorCommit).then(() => {
+            return TestServer.remoteAPI().postJSON('/api/report-commits/', sameRepositoryNameInOwnedCommitAndMajorCommit);
         }).then((response) => {
             assert.equal(response['status'], 'OK');
             return TestServer.database().selectRows('repositories', {'name': 'WebKit'});
@@ -314,7 +314,7 @@ describe("/api/report-commits/", function () {
         });
     });
 
-    const systemVersionCommitWithSubcommits = {
+    const systemVersionCommitWithOwnedCommits = {
         "slaveName": "someSlave",
         "slavePassword": "somePassword",
         "commits": [
@@ -322,7 +322,7 @@ describe("/api/report-commits/", function () {
                 "repository": "OSX",
                 "revision": "Sierra16D32",
                 "order": 1,
-                "subCommits": {
+                "ownedCommits": {
                     "WebKit": {
                         "revision": "141978",
                         "author": {"name": "Commit Queue", "account": "commit-queue@webkit.org"},
@@ -338,10 +338,10 @@ describe("/api/report-commits/", function () {
         ]
     }
 
-    it("should accept inserting one commit with some sub commits", () => {
+    it("should accept inserting one commit with some owned commits", () => {
         const db = TestServer.database();
-        return addSlaveForReport(systemVersionCommitWithSubcommits).then(() => {
-            return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitWithSubcommits);
+        return addSlaveForReport(systemVersionCommitWithOwnedCommits).then(() => {
+            return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitWithOwnedCommits);
         }).then((response) => {
             assert.equal(response['status'], 'OK');
             return Promise.all([db.selectRows('commits', {'revision': 'Sierra16D32'}),
@@ -402,7 +402,7 @@ describe("/api/report-commits/", function () {
         });
     })
 
-    const multipleSystemVersionCommitsWithSubcommits = {
+    const multipleSystemVersionCommitsWithOwnedCommits = {
         "slaveName": "someSlave",
         "slavePassword": "somePassword",
         "commits": [
@@ -410,7 +410,7 @@ describe("/api/report-commits/", function () {
                 "repository": "OSX",
                 "revision": "Sierra16D32",
                 "order": 2,
-                "subCommits": {
+                "ownedCommits": {
                     "WebKit": {
                         "revision": "141978",
                         "author": {"name": "Commit Queue", "account": "commit-queue@webkit.org"},
@@ -427,7 +427,7 @@ describe("/api/report-commits/", function () {
                 "repository": "OSX",
                 "revision": "Sierra16C67",
                 "order": 1,
-                "subCommits": {
+                "ownedCommits": {
                     "WebKit": {
                         "revision": "141978",
                         "author": {"name": "Commit Queue", "account": "commit-queue@webkit.org"},
@@ -443,10 +443,10 @@ describe("/api/report-commits/", function () {
         ]
     };
 
-    it("should accept inserting multiple commits with multiple sub-commits", () => {
+    it("should accept inserting multiple commits with multiple owned-commits", () => {
         const db = TestServer.database();
-        return addSlaveForReport(multipleSystemVersionCommitsWithSubcommits).then(() => {
-            return TestServer.remoteAPI().postJSON('/api/report-commits/', multipleSystemVersionCommitsWithSubcommits);
+        return addSlaveForReport(multipleSystemVersionCommitsWithOwnedCommits).then(() => {
+            return TestServer.remoteAPI().postJSON('/api/report-commits/', multipleSystemVersionCommitsWithOwnedCommits);
         }).then((response) => {
             assert.equal(response['status'], 'OK');
             return Promise.all([db.selectRows('commits', {'revision': 'Sierra16D32'}),
@@ -530,7 +530,7 @@ describe("/api/report-commits/", function () {
         });
     });
 
-    const systemVersionCommitWithEmptySubcommits = {
+    const systemVersionCommitWithEmptyOwnedCommits = {
         "slaveName": "someSlave",
         "slavePassword": "somePassword",
         "commits": [
@@ -538,15 +538,15 @@ describe("/api/report-commits/", function () {
                 "repository": "OSX",
                 "revision": "Sierra16D32",
                 "order": 1,
-                "subCommits": {
+                "ownedCommits": {
                 }
             }
         ]
     }
 
-    it("should accept inserting one commit with no sub commits", () => {
-        return addSlaveForReport(systemVersionCommitWithEmptySubcommits).then(() => {
-            return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitWithEmptySubcommits);
+    it("should accept inserting one commit with no owned commits", () => {
+        return addSlaveForReport(systemVersionCommitWithEmptyOwnedCommits).then(() => {
+            return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitWithEmptyOwnedCommits);
         }).then((response) => {
             assert.equal(response['status'], 'OK');
             const db = TestServer.database();
@@ -563,7 +563,7 @@ describe("/api/report-commits/", function () {
         });
     });
 
-    const systemVersionCommitAndSubcommitWithTimestamp = {
+    const systemVersionCommitAndOwnedCommitWithTimestamp = {
         "slaveName": "someSlave",
         "slavePassword": "somePassword",
         "commits": [
@@ -571,7 +571,7 @@ describe("/api/report-commits/", function () {
                 "repository": "OSX",
                 "revision": "Sierra16D32",
                 "order": 1,
-                "subCommits": {
+                "ownedCommits": {
                     "WebKit": {
                         "revision": "141978",
                         "time": "2013-02-06T08:55:20.9Z",
@@ -583,11 +583,11 @@ describe("/api/report-commits/", function () {
         ]
     }
 
-    it("should reject inserting one commit with sub commits that contains timestamp", () => {
-        return addSlaveForReport(systemVersionCommitAndSubcommitWithTimestamp).then(() => {
-            return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitAndSubcommitWithTimestamp);
+    it("should reject inserting one commit with owned commits that contains timestamp", () => {
+        return addSlaveForReport(systemVersionCommitAndOwnedCommitWithTimestamp).then(() => {
+            return TestServer.remoteAPI().postJSON('/api/report-commits/', systemVersionCommitAndOwnedCommitWithTimestamp);
         }).then((response) => {
-            assert.equal(response['status'], 'SubCommitShouldNotContainTimestamp');
+            assert.equal(response['status'], 'OwnedCommitShouldNotContainTimestamp');
         });
     });
 });
index 9daabd0..bcd3982 100644 (file)
@@ -30,15 +30,15 @@ describe('OSBuildFetcher', function() {
         'password': 'somePassword'
     };
 
-    const subCommitWithWebKit = {
+    const ownedCommitWithWebKit = {
         'WebKit': {'revision': '141978'}
     };
 
-    const anotherSubCommitWithWebKit = {
+    const anotherownedCommitWithWebKit = {
         'WebKit': {'revision': '141999'}
     };
 
-    const anotherSubCommitWithWebKitAndJavaScriptCore = {
+    const anotherownedCommitWithWebKitAndJavaScriptCore = {
         'WebKit': {'revision': '142000'},
         'JavaScriptCore': {'revision': '142000'}
     };
@@ -61,14 +61,14 @@ describe('OSBuildFetcher', function() {
         'customCommands': [
             {
                 'command': ['list', 'all osx 16Dxx builds'],
-                'subCommitCommand': ['list', 'subCommit', 'for', 'revision'],
+                'ownedCommitCommand': ['list', 'ownedCommit', 'for', 'revision'],
                 'linesToIgnore': '^\\.*$',
                 'minRevision': 'Sierra16D0',
                 'maxRevision': 'Sierra16D999'
             },
             {
                 'command': ['list', 'all osx 16Exx builds'],
-                'subCommitCommand': ['list', 'subCommit', 'for', 'revision'],
+                'ownedCommitCommand': ['list', 'ownedCommit', 'for', 'revision'],
                 'linesToIgnore': '^\\.*$',
                 'minRevision': 'Sierra16E0',
                 'maxRevision': 'Sierra16E999'
@@ -77,7 +77,7 @@ describe('OSBuildFetcher', function() {
     };
 
 
-    const configWithoutSubCommitCommand = {
+    const configWithoutownedCommitCommand = {
         'name': 'OSX',
         'customCommands': [
             {
@@ -141,68 +141,68 @@ describe('OSBuildFetcher', function() {
         });
     });
 
-    describe('OSBuildFetcher._addSubCommitsForBuild', () => {
-        it('should add sub-commit info for commits', () => {
+    describe('OSBuildFetcher._addOwnedCommitsForBuild', () => {
+        it('should add owned-commit info for commits', () => {
             const logger = new MockLogger;
             const fetchter = new OSBuildFetcher(null, null, null, MockSubprocess, logger);
             const waitForInvocationPromise = MockSubprocess.waitForInvocation();
-            const addSubCommitPromise = fetchter._addSubCommitsForBuild([osxCommit, anotherOSXCommit], ['subCommit', 'for', 'revision']);
+            const addownedCommitPromise = fetchter._addOwnedCommitsForBuild([osxCommit, anotherOSXCommit], ['ownedCommit', 'for', 'revision']);
 
             return waitForInvocationPromise.then(() => {
                 assert.equal(MockSubprocess.invocations.length, 1);
-                assert.deepEqual(MockSubprocess.invocations[0].command, ['subCommit', 'for', 'revision', 'Sierra16D32']);
-                MockSubprocess.invocations[0].resolve(JSON.stringify(subCommitWithWebKit));
+                assert.deepEqual(MockSubprocess.invocations[0].command, ['ownedCommit', 'for', 'revision', 'Sierra16D32']);
+                MockSubprocess.invocations[0].resolve(JSON.stringify(ownedCommitWithWebKit));
                 MockSubprocess.reset();
                 return MockSubprocess.waitForInvocation();
             }).then(() => {
                 assert.equal(MockSubprocess.invocations.length, 1);
-                assert.deepEqual(MockSubprocess.invocations[0].command, ['subCommit', 'for', 'revision', 'Sierra16E32']);
-                MockSubprocess.invocations[0].resolve(JSON.stringify(anotherSubCommitWithWebKit));
-                return addSubCommitPromise;
+                assert.deepEqual(MockSubprocess.invocations[0].command, ['ownedCommit', 'for', 'revision', 'Sierra16E32']);
+                MockSubprocess.invocations[0].resolve(JSON.stringify(anotherownedCommitWithWebKit));
+                return addownedCommitPromise;
             }).then((results) => {
                 assert.equal(results.length, 2);
                 assert.equal(results[0]['repository'], osxCommit['repository']);
                 assert.equal(results[0]['revision'], osxCommit['revision']);
-                assert.deepEqual(results[0]['subCommits'], subCommitWithWebKit);
+                assert.deepEqual(results[0]['ownedCommits'], ownedCommitWithWebKit);
                 assert.equal(results[1]['repository'], anotherOSXCommit['repository']);
                 assert.equal(results[1]['revision'], anotherOSXCommit['revision']);
-                assert.deepEqual(results[1]['subCommits'], anotherSubCommitWithWebKit);
+                assert.deepEqual(results[1]['ownedCommits'], anotherownedCommitWithWebKit);
             });
         });
 
-        it('should fail if the command to get sub-commit info fails', () => {
+        it('should fail if the command to get owned-commit info fails', () => {
             const logger = new MockLogger;
             const fetchter = new OSBuildFetcher(null, null, null, MockSubprocess, logger);
             const waitForInvocationPromise = MockSubprocess.waitForInvocation();
-            const addSubCommitPromise = fetchter._addSubCommitsForBuild([osxCommit], ['subCommit', 'for', 'revision'])
+            const addownedCommitPromise = fetchter._addOwnedCommitsForBuild([osxCommit], ['ownedCommit', 'for', 'revision'])
 
             return waitForInvocationPromise.then(() => {
                 assert.equal(MockSubprocess.invocations.length, 1);
-                assert.deepEqual(MockSubprocess.invocations[0].command, ['subCommit', 'for', 'revision', 'Sierra16D32']);
-                MockSubprocess.invocations[0].reject('Failed getting sub-commit');
+                assert.deepEqual(MockSubprocess.invocations[0].command, ['ownedCommit', 'for', 'revision', 'Sierra16D32']);
+                MockSubprocess.invocations[0].reject('Failed getting owned-commit');
 
-                return addSubCommitPromise.then(() => {
+                return addownedCommitPromise.then(() => {
                     assert(false, 'should never be reached');
                 }, (error_output) => {
                     assert(error_output);
-                    assert.equal(error_output, 'Failed getting sub-commit');
+                    assert.equal(error_output, 'Failed getting owned-commit');
                 });
             });
         });
 
 
-        it('should fail if entries in sub-commits does not contain revision', () => {
+        it('should fail if entries in owned-commits does not contain revision', () => {
             const logger = new MockLogger;
             const fetchter = new OSBuildFetcher(null, null, null, MockSubprocess, logger);
             const waitForInvocationPromise = MockSubprocess.waitForInvocation();
-            const addSubCommitPromise = fetchter._addSubCommitsForBuild([osxCommit], ['subCommit', 'for', 'revision'])
+            const addownedCommitPromise = fetchter._addOwnedCommitsForBuild([osxCommit], ['ownedCommit', 'for', 'revision'])
 
             return waitForInvocationPromise.then(() => {
                 assert.equal(MockSubprocess.invocations.length, 1);
-                assert.deepEqual(MockSubprocess.invocations[0].command, ['subCommit', 'for', 'revision', 'Sierra16D32']);
+                assert.deepEqual(MockSubprocess.invocations[0].command, ['ownedCommit', 'for', 'revision', 'Sierra16D32']);
                 MockSubprocess.invocations[0].resolve('{"WebKit":{"RandomKey": "RandomValue"}}');
 
-                return addSubCommitPromise.then(() => {
+                return addownedCommitPromise.then(() => {
                     assert(false, 'should never be reached');
                 }, (error_output) => {
                     assert(error_output);
@@ -223,7 +223,7 @@ describe('OSBuildFetcher', function() {
             TestServer.database().disconnect();
         });
 
-        it('should report all build commits with sub-commits', () => {
+        it('should report all build commits with owned-commits', () => {
             const logger = new MockLogger;
             const fetchter = new OSBuildFetcher(config, TestServer.remoteAPI(), slaveAuth, MockSubprocess, logger);
             const db = TestServer.database();
@@ -260,8 +260,8 @@ describe('OSBuildFetcher', function() {
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16D69']);
-                invocations[0].resolve(JSON.stringify(subCommitWithWebKit));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16D69']);
+                invocations[0].resolve(JSON.stringify(ownedCommitWithWebKit));
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
@@ -270,13 +270,13 @@ describe('OSBuildFetcher', function() {
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16E33h']);
-                invocations[0].resolve(JSON.stringify(anotherSubCommitWithWebKit));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16E33h']);
+                invocations[0].resolve(JSON.stringify(anotherownedCommitWithWebKit));
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16E34']);
-                invocations[0].resolve(JSON.stringify(anotherSubCommitWithWebKitAndJavaScriptCore));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16E34']);
+                invocations[0].resolve(JSON.stringify(anotherownedCommitWithWebKitAndJavaScriptCore));
                 return fetchAvailableBuildsPromise;
             }).then((results) => {
                 assert.equal(results.length, 3);
@@ -290,8 +290,8 @@ describe('OSBuildFetcher', function() {
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16D69']);
-                invocations[0].resolve(JSON.stringify(subCommitWithWebKit));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16D69']);
+                invocations[0].resolve(JSON.stringify(ownedCommitWithWebKit));
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
@@ -300,13 +300,13 @@ describe('OSBuildFetcher', function() {
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16E33h']);
-                invocations[0].resolve(JSON.stringify(anotherSubCommitWithWebKit));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16E33h']);
+                invocations[0].resolve(JSON.stringify(anotherownedCommitWithWebKit));
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                invocations[0].resolve(JSON.stringify(anotherSubCommitWithWebKitAndJavaScriptCore));
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16E34']);
+                invocations[0].resolve(JSON.stringify(anotherownedCommitWithWebKitAndJavaScriptCore));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16E34']);
 
                 return fetchAndReportPromise;
             }).then((result) => {
@@ -355,9 +355,9 @@ describe('OSBuildFetcher', function() {
             });
         });
 
-        it('should report commits without sub-commits if "subCommitCommand" is not specified in config', () => {
+        it('should report commits without owned-commits if "ownedCommitCommand" is not specified in config', () => {
             const logger = new MockLogger;
-            const fetchter = new OSBuildFetcher(configWithoutSubCommitCommand, TestServer.remoteAPI(), slaveAuth, MockSubprocess, logger);
+            const fetchter = new OSBuildFetcher(configWithoutownedCommitCommand, TestServer.remoteAPI(), slaveAuth, MockSubprocess, logger);
             const db = TestServer.database();
             let fetchAndReportPromise = null;
             let fetchAvailableBuildsPromise = null;
@@ -478,8 +478,8 @@ describe('OSBuildFetcher', function() {
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16D69']);
-                MockSubprocess.invocations[0].resolve(JSON.stringify(subCommitWithWebKit));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16D69']);
+                MockSubprocess.invocations[0].resolve(JSON.stringify(ownedCommitWithWebKit));
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
@@ -487,12 +487,12 @@ describe('OSBuildFetcher', function() {
                 invocations[0].resolve('\n\nSierra16E32\nSierra16E33\nSierra16E33h\nSierra16E34');
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16E33h']);
-                invocations[0].resolve(JSON.stringify(anotherSubCommitWithWebKit));
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16E33h']);
+                invocations[0].resolve(JSON.stringify(anotherownedCommitWithWebKit));
                 return MockSubprocess.resetAndWaitForInvocation();
             }).then(() => {
                 assert.equal(invocations.length, 1);
-                assert.deepEqual(invocations[0].command, ['list', 'subCommit', 'for', 'revision', 'Sierra16E34']);
+                assert.deepEqual(invocations[0].command, ['list', 'ownedCommit', 'for', 'revision', 'Sierra16E34']);
                 invocations[0].reject('Command failed');
                 return fetchAndReportPromise.then(() => {
                     assert(false, 'should never be reached');
index 0eb2dc3..551e529 100644 (file)
@@ -56,9 +56,9 @@ class OSBuildFetcher {
                 const label = 'name' in command ? `"${command['name']}"` : `"command['minRevision']" to "command['maxRevision']"`;
                 this._logger.log(`Found ${commits.length} builds for ${label}`);
 
-                if ('subCommitCommand' in command) {
-                    this._logger.log(`Resolving subcommits for "${label}"`);
-                    return this._addSubCommitsForBuild(commits, command['subCommitCommand']);
+                if ('ownedCommitCommand' in command) {
+                    this._logger.log(`Resolving ownedCommits for "${label}"`);
+                    return this._addOwnedCommitsForBuild(commits, command['ownedCommitCommand']);
                 }
 
                 return commits;
@@ -91,17 +91,17 @@ class OSBuildFetcher {
         });
     }
 
-    _addSubCommitsForBuild(commits, command)
+    _addOwnedCommitsForBuild(commits, command)
     {
         return mapInSerialPromiseChain(commits, (commit) => {
-            return this._subprocess.execute(command.concat(commit['revision'])).then((subCommitOutput) => {
-                const subCommits = JSON.parse(subCommitOutput);
-                for (let repositoryName in subCommits) {
-                    const subCommit = subCommits[repositoryName];
-                    assert.deepEqual(Object.keys(subCommit), ['revision']);
-                    assert(typeof(subCommit['revision']) == 'string');
+            return this._subprocess.execute(command.concat(commit['revision'])).then((ownedCommitOutput) => {
+                const ownedCommits = JSON.parse(ownedCommitOutput);
+                for (let repositoryName in ownedCommits) {
+                    const ownedCommit = ownedCommits[repositoryName];
+                    assert.deepEqual(Object.keys(ownedCommit), ['revision']);
+                    assert(typeof(ownedCommit['revision']) == 'string');
                 }
-                commit['subCommits'] = subCommits;
+                commit['ownedCommits'] = ownedCommits;
                 return commit;
             });
         });
index 1bd46e1..3b31e5c 100644 (file)
@@ -60,12 +60,12 @@ function oldOSXCommit()
     });
 }
 
-function commitWithoutSubCommits()
+function commitWithoutOwnedCommits()
 {
     return new CommitLog(6, {
         repository: MockModels.ownerRepository,
         revision: '10.11.4 15E66',
-        ownsSubCommits: false,
+        ownsCommits: false,
         time: null,
     });
 }
@@ -75,7 +75,7 @@ function ownerCommit()
     return new CommitLog(5, {
         repository: MockModels.ownerRepository,
         revision: '10.11.4 15E65',
-        ownsSubCommits: true,
+        ownsCommits: true,
         time: null,
     });
 }
@@ -85,7 +85,7 @@ function otherOwnerCommit()
     return new CommitLog(5, {
         repository: MockModels.ownerRepository,
         revision: '10.11.4 15E66',
-        ownsSubCommits: true,
+        ownsCommits: true,
         time: null,
     });
 }
@@ -167,34 +167,34 @@ describe('CommitLog', function () {
         });
     });
 
-    describe('fetchSubCommits', () => {
+    describe('fetchOwnedCommits', () => {
         beforeEach(() => {
             MockRemoteAPI.inject();
         });
 
         it('should reject if repository of the commit does not own other repositories', () => {
             const commit = osxCommit();
-            return commit.fetchSubCommits().then(() => {
+            return commit.fetchOwnedCommits().then(() => {
                assert(false, 'Should not execute this line.');
             }, (error) => {
                 assert.equal(error, undefined);
             });
         });
 
-        it('should reject if commit does not own other sub-commits', () => {
-            const commit = commitWithoutSubCommits();
-            return commit.fetchSubCommits().then(() => {
+        it('should reject if commit does not own other owned-commits', () => {
+            const commit = commitWithoutOwnedCommits();
+            return commit.fetchOwnedCommits().then(() => {
                 assert(false, 'Should not execute this line.');
             }, (error) => {
                 assert.equal(error, undefined);
             });
         });
 
-        it('should return sub-commit for a valid commit revision', () => {
-            const fetchingPromise = ownerCommit().fetchSubCommits();
+        it('should return owned-commit for a valid commit revision', () => {
+            const fetchingPromise = ownerCommit().fetchOwnedCommits();
             const requests = MockRemoteAPI.requests;
             assert.equal(requests.length, 1);
-            assert.equal(requests[0].url, '../api/commits/111/sub-commits?owner-revision=10.11.4%2015E65');
+            assert.equal(requests[0].url, '../api/commits/111/owned-commits?owner-revision=10.11.4%2015E65');
             assert.equal(requests[0].method, 'GET');
 
             requests[0].resolve({commits: [{
@@ -203,21 +203,21 @@ describe('CommitLog', function () {
                 revision: '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb',
                 time: +(new Date('2016-05-13T00:55:57.841344Z')),
             }]});
-            return fetchingPromise.then((subCommits) => {
-                assert.equal(subCommits.length, 1);
-                assert.equal(subCommits[0].repository(), MockModels.ownedRepository);
-                assert.equal(subCommits[0].revision(), '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb');
-                assert.equal(subCommits[0].id(), 233);
+            return fetchingPromise.then((ownedCommits) => {
+                assert.equal(ownedCommits.length, 1);
+                assert.equal(ownedCommits[0].repository(), MockModels.ownedRepository);
+                assert.equal(ownedCommits[0].revision(), '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb');
+                assert.equal(ownedCommits[0].id(), 233);
             });
         });
 
-        it('should only fetch sub-commits exactly once', () => {
+        it('should only fetch owned-commits exactly once', () => {
             const commit = ownerCommit();
-            const fetchingPromise = commit.fetchSubCommits();
+            const fetchingPromise = commit.fetchOwnedCommits();
             const requests = MockRemoteAPI.requests;
-            let existingSubCommits = null;
+            let existingOwnedCommits = null;
             assert.equal(requests.length, 1);
-            assert.equal(requests[0].url, '../api/commits/111/sub-commits?owner-revision=10.11.4%2015E65');
+            assert.equal(requests[0].url, '../api/commits/111/owned-commits?owner-revision=10.11.4%2015E65');
             assert.equal(requests[0].method, 'GET');
 
             MockRemoteAPI.requests[0].resolve({commits: [{
@@ -227,32 +227,32 @@ describe('CommitLog', function () {
                 time: +(new Date('2016-05-13T00:55:57.841344Z')),
             }]});
 
-            return fetchingPromise.then((subCommits) => {
-                existingSubCommits = subCommits;
-                assert.equal(subCommits.length, 1);
-                assert.equal(subCommits[0].repository(), MockModels.ownedRepository);
-                assert.equal(subCommits[0].revision(), '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb');
-                assert.equal(subCommits[0].id(), 233);
-                return commit.fetchSubCommits();
-            }).then((subCommits) => {
+            return fetchingPromise.then((ownedCommits) => {
+                existingOwnedCommits = ownedCommits;
+                assert.equal(ownedCommits.length, 1);
+                assert.equal(ownedCommits[0].repository(), MockModels.ownedRepository);
+                assert.equal(ownedCommits[0].revision(), '6f8b0dbbda95a440503b88db1dd03dad3a7b07fb');
+                assert.equal(ownedCommits[0].id(), 233);
+                return commit.fetchOwnedCommits();
+            }).then((ownedCommits) => {
                 assert.equal(requests.length, 1);
-                assert.equal(existingSubCommits, subCommits);
+                assert.equal(existingOwnedCommits, ownedCommits);
             });
         });
     });
 
-    describe('diffSubCommits', () => {
+    describe('diffOwnedCommits', () => {
         beforeEach(() => {
             MockRemoteAPI.reset();
         });
 
-        it('should return difference between 2 sub-commits', () => {
+        it('should return difference between 2 owned-commits', () => {
             const oneCommit = ownerCommit();
             const otherCommit = otherOwnerCommit();
-            const fetchingPromise = oneCommit.fetchSubCommits();
+            const fetchingPromise = oneCommit.fetchOwnedCommits();
             const requests = MockRemoteAPI.requests;
             assert.equal(requests.length, 1);
-            assert.equal(requests[0].url, '../api/commits/111/sub-commits?owner-revision=10.11.4%2015E65');
+            assert.equal(requests[0].url, '../api/commits/111/owned-commits?owner-revision=10.11.4%2015E65');
             assert.equal(requests[0].method, 'GET');
 
             requests[0].resolve({commits: [{
@@ -268,9 +268,9 @@ describe('CommitLog', function () {
             }]});
 
             return fetchingPromise.then(() => {
-                const otherFetchingPromise = otherCommit.fetchSubCommits();
+                const otherFetchingPromise = otherCommit.fetchOwnedCommits();
                 assert.equal(requests.length, 2);
-                assert.equal(requests[1].url, '../api/commits/111/sub-commits?owner-revision=10.11.4%2015E66');
+                assert.equal(requests[1].url, '../api/commits/111/owned-commits?owner-revision=10.11.4%2015E66');
                 assert.equal(requests[1].method, 'GET');
 
                 requests[1].resolve({commits: [{
@@ -287,7 +287,7 @@ describe('CommitLog', function () {
 
                 return otherFetchingPromise;
             }).then(() => {
-                const difference = CommitLog.diffSubCommits(oneCommit, otherCommit);
+                const difference = CommitLog.diffOwnedCommits(oneCommit, otherCommit);
                 assert.equal(difference.size, 1);
                 assert.equal(difference.keys().next().value, MockModels.ownedRepository);
             });