Prepare git_update_version.py for real usage.
* gcc-changelog/git_update_version.py: Prepare the script, the only missing piece is pushing of the updated branches.
This commit is contained in:
parent
9722b1399a
commit
62b5b53e94
|
@ -1,3 +1,8 @@
|
||||||
|
2020-05-21 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
|
* gcc-changelog/git_update_version.py: Prepare the script, the
|
||||||
|
only missing piece is pushing of the updated branches.
|
||||||
|
|
||||||
2020-05-21 Martin Liska <mliska@suse.cz>
|
2020-05-21 Martin Liska <mliska@suse.cz>
|
||||||
|
|
||||||
* gcc-changelog/git_commit.py: Support DR entries/
|
* gcc-changelog/git_commit.py: Support DR entries/
|
||||||
|
|
|
@ -24,8 +24,7 @@ from git import Repo
|
||||||
|
|
||||||
from git_repository import parse_git_revisions
|
from git_repository import parse_git_revisions
|
||||||
|
|
||||||
# TODO: remove sparta suffix
|
current_timestamp = datetime.datetime.now().strftime('%Y%m%d\n')
|
||||||
current_timestamp = datetime.datetime.now().strftime('%Y%m%d sparta\n')
|
|
||||||
|
|
||||||
|
|
||||||
def read_timestamp(path):
|
def read_timestamp(path):
|
||||||
|
@ -36,11 +35,9 @@ def prepend_to_changelog_files(repo, folder, git_commit):
|
||||||
if not git_commit.success:
|
if not git_commit.success:
|
||||||
for error in git_commit.errors:
|
for error in git_commit.errors:
|
||||||
print(error)
|
print(error)
|
||||||
# TODO: add error message
|
raise AssertionError()
|
||||||
return
|
|
||||||
for entry, output in git_commit.to_changelog_entries(use_commit_ts=True):
|
for entry, output in git_commit.to_changelog_entries(use_commit_ts=True):
|
||||||
# TODO
|
full_path = os.path.join(folder, entry, 'ChangeLog')
|
||||||
full_path = os.path.join(folder, entry, 'ChangeLog.test')
|
|
||||||
print('writting to %s' % full_path)
|
print('writting to %s' % full_path)
|
||||||
if os.path.exists(full_path):
|
if os.path.exists(full_path):
|
||||||
content = open(full_path).read()
|
content = open(full_path).read()
|
||||||
|
@ -73,9 +70,10 @@ for ref in origin.refs:
|
||||||
branch = repo.branches[name]
|
branch = repo.branches[name]
|
||||||
else:
|
else:
|
||||||
branch = repo.create_head(name, ref).set_tracking_branch(ref)
|
branch = repo.create_head(name, ref).set_tracking_branch(ref)
|
||||||
|
print('=== Working on: %s ===' % branch, flush=True)
|
||||||
origin.pull(rebase=True)
|
origin.pull(rebase=True)
|
||||||
branch.checkout()
|
branch.checkout()
|
||||||
print('=== Working on: %s ===' % branch)
|
print('branch pulled and checked out')
|
||||||
assert not repo.index.diff(None)
|
assert not repo.index.diff(None)
|
||||||
commit = branch.commit
|
commit = branch.commit
|
||||||
commit_count = 1
|
commit_count = 1
|
||||||
|
@ -90,9 +88,8 @@ for ref in origin.refs:
|
||||||
datestamp_path = os.path.join(args.git_path, 'gcc/DATESTAMP')
|
datestamp_path = os.path.join(args.git_path, 'gcc/DATESTAMP')
|
||||||
if read_timestamp(datestamp_path) != current_timestamp:
|
if read_timestamp(datestamp_path) != current_timestamp:
|
||||||
print('DATESTAMP will be changed:')
|
print('DATESTAMP will be changed:')
|
||||||
# TODO: set strict=True after testing period
|
|
||||||
commits = parse_git_revisions(args.git_path, '%s..HEAD'
|
commits = parse_git_revisions(args.git_path, '%s..HEAD'
|
||||||
% commit.hexsha, strict=False)
|
% commit.hexsha)
|
||||||
for git_commit in reversed(commits):
|
for git_commit in reversed(commits):
|
||||||
prepend_to_changelog_files(repo, args.git_path, git_commit)
|
prepend_to_changelog_files(repo, args.git_path, git_commit)
|
||||||
# update timestamp
|
# update timestamp
|
||||||
|
@ -101,5 +98,7 @@ for ref in origin.refs:
|
||||||
repo.git.add(datestamp_path)
|
repo.git.add(datestamp_path)
|
||||||
repo.index.commit('Daily bump.')
|
repo.index.commit('Daily bump.')
|
||||||
# TODO: push the repository
|
# TODO: push the repository
|
||||||
|
# repo.git.push('origin', branch)
|
||||||
else:
|
else:
|
||||||
print('DATESTAMP unchanged')
|
print('DATESTAMP unchanged')
|
||||||
|
print('branch is done\n', flush=True)
|
||||||
|
|
Loading…
Reference in New Issue