Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 3c810e8

Browse files
committed
Bug 1344316 Add Commit Date to libyuv README r=jesup
MozReview-Commit-ID: 6EVZR6ZilH1 --HG-- extra : rebase_source : 02c1b5486f9d14180954bcff9cfbd6848b1bf4fe
1 parent 9a7751b commit 3c810e8

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

media/libyuv/README_MOZILLA

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ The upstream repository is https://chromium.googlesource.com/libyuv/libyuv
99
Updates before this file was added were done manually; the last import was
1010
r1602 (svn).
1111

12-
The git commit ID last used to import was 054ec37f8e31e6131c8f19eb74395d29009d6604
12+
The git commit ID last used to import was 054ec37f8e31e6131c8f19eb74395d29009d6604 (2017-02-21 23:59:57)

media/libyuv/update.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import re
88
import shutil
99
import sys
10+
import datetime
1011
import subprocess
1112
import tarfile
1213
import urllib
@@ -23,6 +24,14 @@ def prepare_upstream(prefix, commit=None):
2324
os.chdir(base)
2425
return commit
2526

27+
def get_commit_date(prefix, commit=None):
28+
upstream_url = 'https://chromium.googlesource.com/libyuv/libyuv/+/' + commit
29+
text = urllib.urlopen(upstream_url).readlines()
30+
text = "".join(text)
31+
regex = '<tr><th class="Metadata-title">committer</th><td>.+</td><td>[^\s]+ ([0-9a-zA-Z: ]+)\s*\+*[0-9]*</td></tr>'
32+
date = re.search(regex, text).groups(0)[0]
33+
return datetime.datetime.strptime(date, "%b %d %H:%M:%S %Y")
34+
2635
def cleanup_upstream():
2736
os.remove(os.path.join(base, 'libyuv/.gitignore'))
2837

@@ -44,13 +53,13 @@ def apply_patches():
4453
# Patch for bug 1342732
4554
os.system("patch -p3 < row_any.patch")
4655

47-
def update_readme(commit):
56+
def update_readme(commit, commitdate):
4857
with open('README_MOZILLA') as f:
4958
readme = f.read()
5059

5160
if 'The git commit ID last used to import was ' in readme:
52-
new_readme = re.sub('The git commit ID last used to import was [v\.a-f0-9]+',
53-
'The git commit ID last used to import was %s' % commit, readme)
61+
new_readme = re.sub('The git commit ID last used to import was [v\.a-f0-9]+ \(.+\)',
62+
'The git commit ID last used to import was %s (%s)' % (commit, commitdate), readme)
5463
else:
5564
new_readme = "%s\n\nThe git commit ID last used to import was %s\n" % (readme, commit)
5665

@@ -72,9 +81,10 @@ def update_readme(commit):
7281
prefix = os.path.join(base, 'libyuv/')
7382

7483
commit = prepare_upstream(prefix, commit)
84+
commitdate = get_commit_date(prefix, commit)
7585

7686
apply_patches()
77-
update_readme(commit)
87+
update_readme(commit, commitdate)
7888

7989
print('Patches applied; run "hg addremove --similarity 70 libyuv" before committing changes')
8090

0 commit comments

Comments
 (0)