Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: clang_format_merge_driver.py

Issue 2348793003: Introduce git merge driver for the blink reformatting
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « clang_format_merge_driver.bat ('k') | gclient.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Clang-format 3-way merge driver.
7
8 """
9
10 import subprocess
11 import sys
12
13 import clang_format
14
15 def main():
16 if len(sys.argv) < 6:
17 print('usage: %s <base> <current> <others> <ignored> <path in the tree>' %
18 sys.argv[0])
19 sys.exit(1)
20
21 base, current, others, _, file_name_in_tree = sys.argv[1:6]
22 print '\nRunning clang-format 3-way merge driver on ' + file_name_in_tree
23
24 try:
25 tool = clang_format.FindClangFormatToolInChromiumTree()
26 for fpath in base, current, others:
27 subprocess.call([tool, '-i', '--style=chromium', fpath])
28 except clang_format.NotFoundError, e:
29 print e
30 print 'Failed to find clang-format. Falling-back on standard 3-way merge'
31
32 return subprocess.call(['git', 'merge-file', '-Lcurrent', '-Lbase', '-Lother',
33 current, base, others])
34
35 if __name__ == '__main__':
36 sys.exit(main())
OLDNEW
« no previous file with comments | « clang_format_merge_driver.bat ('k') | gclient.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698