зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1344316
Add Commit Date to libyuv README r=jesup
MozReview-Commit-ID: 6EVZR6ZilH1 --HG-- extra : rebase_source : 02c1b5486f9d14180954bcff9cfbd6848b1bf4fe
This commit is contained in:
Родитель
9a7751b46c
Коммит
3c810e8f62
|
@ -9,4 +9,4 @@ The upstream repository is https://chromium.googlesource.com/libyuv/libyuv
|
|||
Updates before this file was added were done manually; the last import was
|
||||
r1602 (svn).
|
||||
|
||||
The git commit ID last used to import was 054ec37f8e31e6131c8f19eb74395d29009d6604
|
||||
The git commit ID last used to import was 054ec37f8e31e6131c8f19eb74395d29009d6604 (2017-02-21 23:59:57)
|
||||
|
|
|
@ -7,6 +7,7 @@ import os
|
|||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import datetime
|
||||
import subprocess
|
||||
import tarfile
|
||||
import urllib
|
||||
|
@ -23,6 +24,14 @@ def prepare_upstream(prefix, commit=None):
|
|||
os.chdir(base)
|
||||
return commit
|
||||
|
||||
def get_commit_date(prefix, commit=None):
|
||||
upstream_url = 'https://chromium.googlesource.com/libyuv/libyuv/+/' + commit
|
||||
text = urllib.urlopen(upstream_url).readlines()
|
||||
text = "".join(text)
|
||||
regex = '<tr><th class="Metadata-title">committer</th><td>.+</td><td>[^\s]+ ([0-9a-zA-Z: ]+)\s*\+*[0-9]*</td></tr>'
|
||||
date = re.search(regex, text).groups(0)[0]
|
||||
return datetime.datetime.strptime(date, "%b %d %H:%M:%S %Y")
|
||||
|
||||
def cleanup_upstream():
|
||||
os.remove(os.path.join(base, 'libyuv/.gitignore'))
|
||||
|
||||
|
@ -44,13 +53,13 @@ def apply_patches():
|
|||
# Patch for bug 1342732
|
||||
os.system("patch -p3 < row_any.patch")
|
||||
|
||||
def update_readme(commit):
|
||||
def update_readme(commit, commitdate):
|
||||
with open('README_MOZILLA') as f:
|
||||
readme = f.read()
|
||||
|
||||
if 'The git commit ID last used to import was ' in readme:
|
||||
new_readme = re.sub('The git commit ID last used to import was [v\.a-f0-9]+',
|
||||
'The git commit ID last used to import was %s' % commit, readme)
|
||||
new_readme = re.sub('The git commit ID last used to import was [v\.a-f0-9]+ \(.+\)',
|
||||
'The git commit ID last used to import was %s (%s)' % (commit, commitdate), readme)
|
||||
else:
|
||||
new_readme = "%s\n\nThe git commit ID last used to import was %s\n" % (readme, commit)
|
||||
|
||||
|
@ -72,9 +81,10 @@ if __name__ == '__main__':
|
|||
prefix = os.path.join(base, 'libyuv/')
|
||||
|
||||
commit = prepare_upstream(prefix, commit)
|
||||
commitdate = get_commit_date(prefix, commit)
|
||||
|
||||
apply_patches()
|
||||
update_readme(commit)
|
||||
update_readme(commit, commitdate)
|
||||
|
||||
print('Patches applied; run "hg addremove --similarity 70 libyuv" before committing changes')
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче