Skip to content
Permalink
Browse files
Using fake timestamp in OS version make some results invisible
https://bugs.webkit.org/show_bug.cgi?id=152289

Reviewed by Stephanie Lewis.

Fix various bugs after r194088.

* public/api/commits.php:
(format_commit): Include the commit order.
* public/v2/data.js:
(CommitLogs._cacheConsecutiveCommits): Sort by commit order when commit time is missing.
* tools/pull-os-versions.py:
(OSBuildFetcher._assign_order): Use integer instead of fake time for commit order.
(available_builds_from_command): Exit early when an exception is thrown.


Canonical link: https://commits.webkit.org/170404@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194093 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rniwa committed Dec 15, 2015
1 parent e8fbdc5 commit e87dcf37903acc4235fc679c82c4c95ec9f64a29
@@ -1,3 +1,20 @@
2015-12-14 Ryosuke Niwa <rniwa@webkit.org>

Using fake timestamp in OS version make some results invisible
https://bugs.webkit.org/show_bug.cgi?id=152289

Reviewed by Stephanie Lewis.

Fix various bugs after r194088.

* public/api/commits.php:
(format_commit): Include the commit order.
* public/v2/data.js:
(CommitLogs._cacheConsecutiveCommits): Sort by commit order when commit time is missing.
* tools/pull-os-versions.py:
(OSBuildFetcher._assign_order): Use integer instead of fake time for commit order.
(available_builds_from_command): Exit early when an exception is thrown.

2015-12-14 Ryosuke Niwa <rniwa@webkit.org>

Fix a typo in the previous commit.
@@ -116,6 +116,7 @@ function format_commit($commit_row, $committer_row) {
'revision' => $commit_row['commit_revision'],
'parent' => $commit_row['commit_parent'],
'time' => Database::to_js_time($commit_row['commit_time']),
'order' => $commit_row['commit_order'],
'authorName' => $committer_row ? $committer_row['committer_name'] : null,
'authorEmail' => $committer_row ? $committer_row['committer_account'] : null,
'message' => $commit_row['commit_message']
@@ -136,7 +136,7 @@ CommitLogs._cacheConsecutiveCommits = function (repository, from, to, consecutiv
cachedCommits.commitsByTime.push(commit);
});

cachedCommits.commitsByTime.sort(function (a, b) { return a.time - b.time; });
cachedCommits.commitsByTime.sort(function (a, b) { return a.time && b.time ? (a.time - b.time) : (a.order - b.order); });
cachedCommits.commitsByTime.forEach(function (commit, index) { commit.cacheIndex = index; });
}

@@ -79,16 +79,15 @@ def _assign_order(builds):
kind = ord(match.group('kind').upper()) - ord('A')
minor = int(match.group('minor'))
variant = ord(match.group('variant').upper()) - ord('A') + 1 if match.group('variant') else 0
# These fake times won't conflict with real commit time since even 99Z9999z is still in Feb 1973
fake_time = datetime.utcfromtimestamp((major * 100 + kind) * 10000 + minor + float(variant) / 100)
commit['order'] = fake_time.isoformat()
commit['order'] = ((major * 100 + kind) * 10000 + minor) * 100 + variant


def available_builds_from_command(repository_name, command, lines_to_ignore):
try:
output = subprocess.check_output(command, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as error:
print "Failed:", str(error)
return []

regex = re.compile(lines_to_ignore)
return [{'repository': repository_name, 'revision': line} for line in output.split('\n') if not regex.match(line)]

0 comments on commit e87dcf3

Please sign in to comment.