Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: git_cl.py

Issue 437593002: Make “git cl land” handle core.abbrev > 7 (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Copyright (C) 2008 Evan Martin <martine@danga.com> 6 # Copyright (C) 2008 Evan Martin <martine@danga.com>
7 7
8 """A git-command for integrating reviews on Rietveld.""" 8 """A git-command for integrating reviews on Rietveld."""
9 9
10 from distutils.version import LooseVersion 10 from distutils.version import LooseVersion
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 # And then swap back to the original branch and clean up. 2006 # And then swap back to the original branch and clean up.
2007 RunGit(['checkout', '-q', cl.GetBranch()]) 2007 RunGit(['checkout', '-q', cl.GetBranch()])
2008 RunGit(['branch', '-D', MERGE_BRANCH]) 2008 RunGit(['branch', '-D', MERGE_BRANCH])
2009 if base_has_submodules: 2009 if base_has_submodules:
2010 RunGit(['branch', '-D', CHERRY_PICK_BRANCH]) 2010 RunGit(['branch', '-D', CHERRY_PICK_BRANCH])
2011 2011
2012 if cl.GetIssue(): 2012 if cl.GetIssue():
2013 if cmd == 'dcommit' and 'Committed r' in output: 2013 if cmd == 'dcommit' and 'Committed r' in output:
2014 revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) 2014 revision = re.match('.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1)
2015 elif cmd == 'push' and retcode == 0: 2015 elif cmd == 'push' and retcode == 0:
2016 match = (re.match(r'.*?([a-f0-9]{7})\.\.([a-f0-9]{7})$', l) 2016 match = (re.match(r'.*?([a-f0-9]{7,})\.\.([a-f0-9]{7,})$', l)
2017 for l in output.splitlines(False)) 2017 for l in output.splitlines(False))
2018 match = filter(None, match) 2018 match = filter(None, match)
2019 if len(match) != 1: 2019 if len(match) != 1:
2020 DieWithError("Couldn't parse ouput to extract the committed hash:\n%s" % 2020 DieWithError("Couldn't parse ouput to extract the committed hash:\n%s" %
2021 output) 2021 output)
2022 revision = match[0].group(2) 2022 revision = match[0].group(2)
2023 else: 2023 else:
2024 return 1 2024 return 1
2025 viewvc_url = settings.GetViewVCUrl() 2025 viewvc_url = settings.GetViewVCUrl()
2026 if viewvc_url and revision: 2026 if viewvc_url and revision:
(...skipping 23 matching lines...) Expand all
2050 2050
2051 2051
2052 @subcommand.usage('[upstream branch to apply against]') 2052 @subcommand.usage('[upstream branch to apply against]')
2053 def CMDdcommit(parser, args): 2053 def CMDdcommit(parser, args):
2054 """Commits the current changelist via git-svn.""" 2054 """Commits the current changelist via git-svn."""
2055 if not settings.GetIsGitSvn(): 2055 if not settings.GetIsGitSvn():
2056 message = """This doesn't appear to be an SVN repository. 2056 message = """This doesn't appear to be an SVN repository.
2057 If your project has a git mirror with an upstream SVN master, you probably need 2057 If your project has a git mirror with an upstream SVN master, you probably need
2058 to run 'git svn init', see your project's git mirror documentation. 2058 to run 'git svn init', see your project's git mirror documentation.
2059 If your project has a true writeable upstream repository, you probably want 2059 If your project has a true writeable upstream repository, you probably want
2060 to run 'git cl push' instead. 2060 to run 'git cl land' instead.
2061 Choose wisely, if you get this wrong, your commit might appear to succeed but 2061 Choose wisely, if you get this wrong, your commit might appear to succeed but
2062 will instead be silently ignored.""" 2062 will instead be silently ignored."""
2063 print(message) 2063 print(message)
2064 ask_for_data('[Press enter to dcommit or ctrl-C to quit]') 2064 ask_for_data('[Press enter to dcommit or ctrl-C to quit]')
2065 return SendUpstream(parser, args, 'dcommit') 2065 return SendUpstream(parser, args, 'dcommit')
2066 2066
2067 2067
2068 @subcommand.usage('[upstream branch to apply against]') 2068 @subcommand.usage('[upstream branch to apply against]')
2069 def CMDland(parser, args): 2069 def CMDland(parser, args):
2070 """Commits the current changelist via git.""" 2070 """Commits the current changelist via git."""
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 2633 ('AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
2634 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))) 2634 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)))
2635 2635
2636 2636
2637 if __name__ == '__main__': 2637 if __name__ == '__main__':
2638 # These affect sys.stdout so do it outside of main() to simplify mocks in 2638 # These affect sys.stdout so do it outside of main() to simplify mocks in
2639 # unit testing. 2639 # unit testing.
2640 fix_encoding.fix_encoding() 2640 fix_encoding.fix_encoding()
2641 colorama.init() 2641 colorama.init()
2642 sys.exit(main(sys.argv[1:])) 2642 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698