forked from OSchip/llvm-project
gn build: make sync build work with git revs now that svn is gone
This commit is contained in:
parent
0bff9bd26e
commit
19ca80ef05
|
@ -68,12 +68,6 @@ def sync_source_lists(write):
|
|||
def find_gitrev(touched_line, in_file):
|
||||
return git_out(
|
||||
['log', '--format=%h', '-1', '-S' + touched_line, in_file]).rstrip()
|
||||
def svnrev_from_gitrev(gitrev):
|
||||
git_llvm = os.path.join(
|
||||
os.path.dirname(__file__), '..', '..', 'git-svn', 'git-llvm')
|
||||
return int(subprocess.check_output(
|
||||
[sys.executable, git_llvm, 'svn-lookup', gitrev],
|
||||
).rstrip().lstrip('r'))
|
||||
|
||||
# Collect changes to gn files, grouped by revision.
|
||||
for gn_file in gn_files:
|
||||
|
@ -97,16 +91,16 @@ def sync_source_lists(write):
|
|||
|
||||
def by_rev(files, key):
|
||||
for f in files:
|
||||
svnrev = svnrev_from_gitrev(find_gitrev(f, cmake_file))
|
||||
changes_by_rev[svnrev][gn_file][key].append(f)
|
||||
rev = find_gitrev(f, cmake_file)
|
||||
changes_by_rev[rev][gn_file][key].append(f)
|
||||
by_rev(sorted(cmake_cpp - gn_cpp), 'add')
|
||||
by_rev(sorted(gn_cpp - cmake_cpp), 'remove')
|
||||
|
||||
# Output necessary changes grouped by revision.
|
||||
for svnrev in sorted(changes_by_rev):
|
||||
print('gn build: Merge r{0} -- https://reviews.llvm.org/rL{0}'
|
||||
.format(svnrev))
|
||||
for gn_file, data in sorted(changes_by_rev[svnrev].items()):
|
||||
for rev in sorted(changes_by_rev):
|
||||
print('gn build: Merge {0} -- https://reviews.llvm.org/rG{0}'
|
||||
.format(rev))
|
||||
for gn_file, data in sorted(changes_by_rev[rev].items()):
|
||||
add = data.get('add', [])
|
||||
remove = data.get('remove', [])
|
||||
if write:
|
||||
|
@ -120,7 +114,7 @@ def sync_source_lists(write):
|
|||
print(' remove:\n ' + '\n '.join(remove))
|
||||
print()
|
||||
if write:
|
||||
git(['commit', '-m', 'gn build: Merge r%d' % svnrev])
|
||||
git(['commit', '-m', 'gn build: Merge %s' % rev])
|
||||
else:
|
||||
print()
|
||||
|
||||
|
|
Loading…
Reference in New Issue