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

Side by Side Diff: mojo/tools/roll/rev_sdk.py

Issue 790163002: rev_sdk.py: Don't "git rm" nonexistent directories in Chromium. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import sys 7 import sys
8 from utils import commit 8 from utils import commit
9 from utils import mojo_root_dir 9 from utils import mojo_root_dir
10 from utils import system 10 from utils import system
11 11
12 dirs_to_clone = [ 12 dirs_to_clone = [
13 "mojo/edk", 13 "mojo/edk",
14 "mojo/public", 14 "mojo/public",
15 "mojo/services/public", 15 "mojo/services/public",
16 "mojo/services/surfaces/public", 16 "mojo/services/surfaces/public",
17 "mojo/services/view_manager/public", 17 "mojo/services/view_manager/public",
18 "mojo/services/window_manager/public", 18 "mojo/services/window_manager/public",
19 ] 19 ]
20 20
21 def rev(source_dir, chromium_dir): 21 def rev(source_dir, chromium_dir):
22 src_commit = system(["git", "show-ref", "HEAD", "-s"], cwd=source_dir).strip() 22 src_commit = system(["git", "show-ref", "HEAD", "-s"], cwd=source_dir).strip()
23 23
24 for d in dirs_to_clone: 24 for d in dirs_to_clone:
25 print "removing directory %s" % d 25 if os.path.exists(os.path.join(chromium_dir, d)):
26 system(["git", "rm", "-r", d], cwd=chromium_dir) 26 print "removing directory %s" % d
27 system(["git", "rm", "-r", d], cwd=chromium_dir)
27 print "cloning directory %s" % d 28 print "cloning directory %s" % d
28 files = system(["git", "ls-files", d], cwd=source_dir) 29 files = system(["git", "ls-files", d], cwd=source_dir)
29 for f in files.splitlines(): 30 for f in files.splitlines():
30 # Don't copy presubmit files over since the code is read-only on the 31 # Don't copy presubmit files over since the code is read-only on the
31 # chromium side. 32 # chromium side.
32 if os.path.basename(f) == "PRESUBMIT.py": 33 if os.path.basename(f) == "PRESUBMIT.py":
33 continue 34 continue
34 dest_path = os.path.join(chromium_dir, f) 35 dest_path = os.path.join(chromium_dir, f)
35 system(["mkdir", "-p", os.path.dirname(dest_path)]) 36 system(["mkdir", "-p", os.path.dirname(dest_path)])
36 system(["cp", os.path.join(source_dir, f), dest_path]) 37 system(["cp", os.path.join(source_dir, f), dest_path])
37 os.chdir(chromium_dir) 38 os.chdir(chromium_dir)
38 system(["git", "add", d], cwd=chromium_dir) 39 system(["git", "add", d], cwd=chromium_dir)
39 40
40 with open("mojo/public/VERSION", "w") as version_file: 41 with open("mojo/public/VERSION", "w") as version_file:
41 version_file.write(src_commit) 42 version_file.write(src_commit)
42 system(["git", "add", "mojo/public/VERSION"], cwd=chromium_dir) 43 system(["git", "add", "mojo/public/VERSION"], cwd=chromium_dir)
43 commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir) 44 commit("Update mojo sdk to rev " + src_commit, cwd=chromium_dir)
44 45
45 if len(sys.argv) != 2: 46 if len(sys.argv) != 2:
46 print "usage: rev_sdk.py <chromium source dir>" 47 print "usage: rev_sdk.py <chromium source dir>"
47 sys.exit(1) 48 sys.exit(1)
48 49
49 rev(mojo_root_dir, sys.argv[1]) 50 rev(mojo_root_dir, sys.argv[1])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698