Sha256: 3d603813403c09fbcf895f5af6f8de424a6fee61dc60582a8d3b1b6d8fcfb1d2

Contents?: true

Size: 1.87 KB

Versions: 44

Compression:

Stored size: 1.87 KB

Contents

#!/usr/bin/env python
# Copyright 2015 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.
"""Usage: %prog <commit>*

Given a commit, finds the release where it first appeared (e.g. 47.0.2500.0) as
well as attempting to determine the branches to which it was merged.

Note that it uses the "cherry picked from" annotation to find merges, so it will
only work on merges that followed the "use cherry-pick -x" instructions.
"""

import optparse
import re
import sys

import git_common as git


def GetNameForCommit(sha1):
  name = re.sub(r'~.*$', '', git.run('name-rev', '--tags', '--name-only', sha1))
  if name == 'undefined':
    name = git.run(
        'name-rev', '--refs', 'remotes/branch-heads/*', '--name-only',
        sha1) + ' [untagged]'
  return name


def GetMergesForCommit(sha1):
  return [c.split()[0] for c in
          git.run('log', '--oneline', '-F', '--all', '--no-abbrev', '--grep',
                  'cherry picked from commit %s' % sha1).splitlines()]


def main():
  parser = optparse.OptionParser(usage=sys.modules[__name__].__doc__)
  _, args = parser.parse_args()

  if len(args) == 0:
    parser.error('Need at least one commit.')

  for arg in args:
    commit_name = GetNameForCommit(arg)
    if not commit_name:
      print '%s not found' % arg
      return 1
    print 'commit %s was:' % arg
    print '  initially in ' + commit_name
    merges = GetMergesForCommit(arg)
    for merge in merges:
      print '  merged to ' + GetNameForCommit(merge) + ' (as ' + merge + ')'
    if not merges:
      print 'No merges found. If this seems wrong, be sure that you did:'
      print '  git fetch origin && gclient sync --with_branch_heads'

  return 0


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

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
libv8-7.8.279.23.0beta1 vendor/depot_tools/git_find_releases.py
libv8-7.3.492.27.3beta1 vendor/depot_tools/git_find_releases.py
libv8-7.3.492.27.1 vendor/depot_tools/git_find_releases.py
libv8-7.3.492.27.0 vendor/depot_tools/git_find_releases.py
libv8-7.3.492.27.0beta1 vendor/depot_tools/git_find_releases.py
libv8-6.7.288.46.1 vendor/depot_tools/git_find_releases.py
libv8-6.7.288.46.0 vendor/depot_tools/git_find_releases.py
libv8-6.7.288.46.1beta0 vendor/depot_tools/git_find_releases.py
libv8-6.3.292.48.1 vendor/depot_tools/git_find_releases.py
libv8-6.3.292.48.0 vendor/depot_tools/git_find_releases.py
libv8-6.3.292.48.0beta2 vendor/depot_tools/git_find_releases.py
libv8-6.3.292.48.0beta1 vendor/depot_tools/git_find_releases.py
libv8-6.2.414.42.1 vendor/depot_tools/git_find_releases.py
libv8-6.2.414.42.0 vendor/depot_tools/git_find_releases.py
libv8-6.2.414.42.0beta1 vendor/depot_tools/git_find_releases.py
libv8-6.0.286.54.3 vendor/depot_tools/git_find_releases.py
libv8-6.0.286.54.2 vendor/depot_tools/git_find_releases.py
libv8-6.0.286.54.1 vendor/depot_tools/git_find_releases.py
libv8-6.0.286.54.0 vendor/depot_tools/git_find_releases.py
libv8-6.0.286.54.0beta2 vendor/depot_tools/git_find_releases.py