Sha256: 1d53073789923abe2c131e424fc84ff525d3d0a0642983f0105c8936e676ce1b

Contents?: true

Size: 1.33 KB

Versions: 23

Compression:

Stored size: 1.33 KB

Contents

#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import argparse
import sys

import subprocess2

import git_common as git

def main(args):
  default_args = git.get_config_list('depot-tools.upstream-diff.default-args')
  args = default_args + args

  parser = argparse.ArgumentParser()
  parser.add_argument('--wordwise', action='store_true', default=False,
                      help=(
                        'Print a colorized wordwise diff '
                        'instead of line-wise diff'))
  opts, extra_args = parser.parse_known_args(args)

  cur = git.current_branch()
  if not cur or cur == 'HEAD':
    print 'fatal: Cannot perform git-upstream-diff while not on a branch'
    return 1

  par = git.upstream(cur)
  if not par:
    print 'fatal: No upstream configured for branch \'%s\'' % cur
    return 1

  cmd = [git.GIT_EXE, 'diff', '--patience', '-C', '-C']
  if opts.wordwise:
    cmd += ['--word-diff=color', r'--word-diff-regex=(\w+|[^[:space:]])']
  cmd += [git.get_or_create_merge_base(cur, par)]

  cmd += extra_args

  return subprocess2.check_call(cmd)


if __name__ == '__main__':
  try:
    sys.exit(main(sys.argv[1:]))
  except KeyboardInterrupt:
    sys.stderr.write('interrupted\n')
    sys.exit(1)

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
libv8-6.0.286.54.3 vendor/depot_tools/git_upstream_diff.py
libv8-6.0.286.54.2 vendor/depot_tools/git_upstream_diff.py
libv8-6.0.286.54.1 vendor/depot_tools/git_upstream_diff.py
libv8-6.0.286.54.0 vendor/depot_tools/git_upstream_diff.py
libv8-6.0.286.54.0beta2 vendor/depot_tools/git_upstream_diff.py
libv8-6.0.286.54.0beta1 vendor/depot_tools/git_upstream_diff.py
libv8-6.0.286.44.0beta1 vendor/depot_tools/git_upstream_diff.py
libv8-5.9.211.38.1 vendor/depot_tools/git_upstream_diff.py
libv8-5.9.211.38.0 vendor/depot_tools/git_upstream_diff.py
libv8-5.9.211.38.0beta0 vendor/depot_tools/git_upstream_diff.py
libv8-5.7.492.65.1 vendor/depot_tools/git_upstream_diff.py
libv8-5.7.492.65.0 vendor/depot_tools/git_upstream_diff.py
libv8-5.7.492.65.0beta1 vendor/depot_tools/git_upstream_diff.py
libv8-5.6.326.50.0beta1 vendor/depot_tools/git_upstream_diff.py
libv8-5.3.332.38.5 vendor/depot_tools/git_upstream_diff.py
libv8-5.3.332.38.4 vendor/depot_tools/git_upstream_diff.py
libv8-5.3.332.38.3 vendor/depot_tools/git_upstream_diff.py
libv8-5.3.332.38.2 vendor/depot_tools/git_upstream_diff.py
libv8-5.3.332.38.1 vendor/depot_tools/git_upstream_diff.py
libv8-5.3.332.38.0 vendor/depot_tools/git_upstream_diff.py