(argv)
| 97 | |
| 98 | |
| 99 | def main(argv): |
| 100 | parser = argparse.ArgumentParser(description=( |
| 101 | "Rolls the inspector_protocol project (upstream) into node's " |
| 102 | "deps/inspector_protocol (downstream).")) |
| 103 | parser.add_argument("--ip_src_upstream", |
| 104 | help="The inspector_protocol (upstream) tree.", |
| 105 | default="~/ip/src") |
| 106 | parser.add_argument("--node_src_downstream", |
| 107 | help="The nodejs/node src tree.", |
| 108 | default="~/nodejs/node") |
| 109 | parser.add_argument('--force', dest='force', action='store_true', |
| 110 | help=("Whether to carry out the modifications " |
| 111 | "in the destination tree.")) |
| 112 | parser.set_defaults(force=False) |
| 113 | |
| 114 | args = parser.parse_args(argv) |
| 115 | upstream = os.path.normpath(os.path.expanduser(args.ip_src_upstream)) |
| 116 | downstream = os.path.normpath(os.path.expanduser( |
| 117 | args.node_src_downstream)) |
| 118 | CheckRepoIsClean(upstream) |
| 119 | CheckRepoIsInspectorProtocolCheckout(upstream) |
| 120 | |
| 121 | # Read V8's inspector_protocol revision |
| 122 | v8_ip_revision = ReadV8IPRevision(downstream) |
| 123 | node_ip_revision = ReadNodeIPRevision(downstream) |
| 124 | if v8_ip_revision == node_ip_revision: |
| 125 | print('Node is already at V8\'s inspector_protocol revision %s - nothing to do.' % v8_ip_revision) |
| 126 | sys.exit(0) |
| 127 | print('Checking out %s into %s ...' % (upstream, v8_ip_revision)) |
| 128 | CheckoutRevision(upstream, v8_ip_revision) |
| 129 | |
| 130 | src_dir = upstream |
| 131 | dest_dir = os.path.join(downstream, 'deps/inspector_protocol') |
| 132 | print('Rolling %s into %s ...' % (src_dir, dest_dir)) |
| 133 | src_files = set(FindFilesToSyncIn(src_dir)) |
| 134 | dest_files = set(FindFilesToSyncIn(dest_dir)) |
| 135 | to_add = [f for f in src_files if f not in dest_files] |
| 136 | to_delete = [f for f in dest_files if f not in src_files] |
| 137 | to_copy = [f for f in src_files |
| 138 | if (f in dest_files and not FilesAreEqual( |
| 139 | os.path.join(src_dir, f), os.path.join(dest_dir, f)))] |
| 140 | print('To add: %s' % to_add) |
| 141 | print('To delete: %s' % to_delete) |
| 142 | print('To copy: %s' % to_copy) |
| 143 | if not to_add and not to_delete and not to_copy: |
| 144 | print('Nothing to do. You\'re good.') |
| 145 | sys.exit(0) |
| 146 | if not args.force: |
| 147 | print('Rerun with --force if you wish the modifications to be done.') |
| 148 | sys.exit(1) |
| 149 | print('You said --force ... as you wish, modifying the destination.') |
| 150 | for f in to_add + to_copy: |
| 151 | contents = open(os.path.join(src_dir, f)).read() |
| 152 | open(os.path.join(dest_dir, f), 'w').write(contents) |
| 153 | shutil.copymode(os.path.join(src_dir, f), os.path.join(dest_dir, f)) |
| 154 | for f in to_delete: |
| 155 | os.unlink(os.path.join(dest_dir, f)) |
| 156 | head_revision = GetHeadRevision(upstream) |
no test coverage detected
searching dependent graphs…