*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
62 lines
1.9 KiB
Python
62 lines
1.9 KiB
Python
import os.path
|
|
import pprint
|
|
import subprocess
|
|
import sys
|
|
|
|
import transfer.protocol
|
|
|
|
|
|
class RsyncOverSsh(transfer.protocol.Protocol):
|
|
|
|
def __init__(self, options, config):
|
|
super(RsyncOverSsh, self).__init__(options, config)
|
|
self.ssh_config = config.get_value("ssh")
|
|
|
|
def build_rsync_command(self, transfer_spec, dry_run):
|
|
dest_path = os.path.join(
|
|
self.ssh_config["root_dir"],
|
|
transfer_spec.dest_path)
|
|
flags = "-avz"
|
|
if dry_run:
|
|
flags += "n"
|
|
cmd = [
|
|
"rsync",
|
|
flags,
|
|
"-e",
|
|
"ssh -p {}".format(self.ssh_config["port"]),
|
|
"--rsync-path",
|
|
# The following command needs to know the right way to do
|
|
# this on the dest platform - ensures the target dir exists.
|
|
"mkdir -p {} && rsync".format(dest_path)
|
|
]
|
|
|
|
# Add source dir exclusions
|
|
if transfer_spec.exclude_paths:
|
|
for exclude_path in transfer_spec.exclude_paths:
|
|
cmd.append("--exclude")
|
|
cmd.append(exclude_path)
|
|
|
|
cmd.extend([
|
|
"--delete",
|
|
transfer_spec.source_path + "/",
|
|
"{}@{}:{}".format(
|
|
self.ssh_config["user"],
|
|
self.ssh_config["dest_host"],
|
|
dest_path)])
|
|
return cmd
|
|
|
|
def transfer(self, transfer_specs, dry_run):
|
|
if self.options.verbose:
|
|
printer = pprint.PrettyPrinter()
|
|
for spec in transfer_specs:
|
|
printer.pprint(spec)
|
|
|
|
for spec in transfer_specs:
|
|
cmd = self.build_rsync_command(spec, dry_run)
|
|
if self.options.verbose:
|
|
print "executing the following command:\n{}".format(cmd)
|
|
result = subprocess.call(
|
|
cmd, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr)
|
|
if result != 0:
|
|
return result
|