summaryrefslogtreecommitdiffstats
path: root/tools/git
diff options
context:
space:
mode:
authordgrogan <dgrogan@chromium.org>2016-01-21 12:39:00 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-21 20:41:03 +0000
commitcbc1e379d2cdd15075312be77c769ab646ad4607 (patch)
treec147c1959e9fb89db3c6fe06e6d56c3bd3bac396 /tools/git
parent9ebaf878de33c358b12a7066b811f54f1571c801 (diff)
downloadchromium_src-cbc1e379d2cdd15075312be77c769ab646ad4607.zip
chromium_src-cbc1e379d2cdd15075312be77c769ab646ad4607.tar.gz
chromium_src-cbc1e379d2cdd15075312be77c769ab646ad4607.tar.bz2
Make move_source_file.py work in blink again.
It got busted after the repository merge. You still have to run it from third_party/WebKit. It doesn't work if you run it from src/. Also update comment to note that it now does reorder gyp(i) entries. Tested locally by doing a dummy move in each of chromium and blink. Review URL: https://codereview.chromium.org/1614633002 Cr-Commit-Position: refs/heads/master@{#370778}
Diffstat (limited to 'tools/git')
-rw-r--r--tools/git/OWNERS1
-rwxr-xr-xtools/git/move_source_file.py16
2 files changed, 12 insertions, 5 deletions
diff --git a/tools/git/OWNERS b/tools/git/OWNERS
new file mode 100644
index 0000000..e0511af
--- /dev/null
+++ b/tools/git/OWNERS
@@ -0,0 +1 @@
+per-file move_source_file.py=satorux@chromium.org
diff --git a/tools/git/move_source_file.py b/tools/git/move_source_file.py
index f1dde3b..0569ea3 100755
--- a/tools/git/move_source_file.py
+++ b/tools/git/move_source_file.py
@@ -8,8 +8,7 @@ to them, and re-ordering headers as needed. If multiple source files are
specified, the destination must be a directory. Updates include guards in
moved header files. Assumes Chromium coding style.
-Attempts to update paths used in .gyp(i) files, but does not reorder
-or restructure .gyp(i) files in any way.
+Attempts to update and reorder paths used in .gyp(i) files.
Updates full-path references to files in // comments in source files.
@@ -213,11 +212,18 @@ def UpdateIncludeGuard(old_path, new_path):
f.write(new_contents)
def main():
- if not os.path.isdir('.git'):
- print 'Fatal: You must run from the root of a git checkout.'
+ # We use "git rev-parse" to check if the script is run from a git checkout. It
+ # returns 0 even when run in the .git directory. We don't want people running
+ # this in the .git directory.
+ if (os.system('git rev-parse') != 0 or
+ os.path.basename(os.getcwd()) == '.git'):
+ print 'Fatal: You must run in a git checkout.'
return 1
- in_blink = os.getcwd().endswith("third_party/WebKit")
+ cwd = os.getcwd()
+ parent = os.path.dirname(cwd)
+ in_blink = (os.path.basename(parent) == 'third_party' and
+ os.path.basename(cwd) == 'WebKit')
parser = optparse.OptionParser(usage='%prog FROM_PATH... TO_PATH')
parser.add_option('--already_moved', action='store_true',