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

Side by Side Diff: git_common.py

Issue 792933003: Add checks to GitSanityChecks (upstream branch or current branch can be None) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « git_cl.py ('k') | 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 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly. 5 # Monkeypatch IMapIterator so that Ctrl-C can kill everything properly.
6 # Derived from https://gist.github.com/aljungberg/626518 6 # Derived from https://gist.github.com/aljungberg/626518
7 import multiprocessing.pool 7 import multiprocessing.pool
8 from multiprocessing.pool import IMapIterator 8 from multiprocessing.pool import IMapIterator
9 def wrapper(func): 9 def wrapper(func):
10 def wrap(self, timeout=None): 10 def wrap(self, timeout=None):
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 393
394 def get_or_create_merge_base(branch, parent=None): 394 def get_or_create_merge_base(branch, parent=None):
395 """Finds the configured merge base for branch. 395 """Finds the configured merge base for branch.
396 396
397 If parent is supplied, it's used instead of calling upstream(branch). 397 If parent is supplied, it's used instead of calling upstream(branch).
398 """ 398 """
399 base = branch_config(branch, 'base') 399 base = branch_config(branch, 'base')
400 base_upstream = branch_config(branch, 'base-upstream') 400 base_upstream = branch_config(branch, 'base-upstream')
401 parent = parent or upstream(branch) 401 parent = parent or upstream(branch)
402 if not parent: 402 if parent is None or branch is None:
403 return None 403 return None
404 actual_merge_base = run('merge-base', parent, branch) 404 actual_merge_base = run('merge-base', parent, branch)
405 405
406 if base_upstream != parent: 406 if base_upstream != parent:
407 base = None 407 base = None
408 base_upstream = None 408 base_upstream = None
409 409
410 def is_ancestor(a, b): 410 def is_ancestor(a, b):
411 return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0 411 return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0
412 412
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind) 762 hash=branch_hash, upstream=upstream_branch, ahead=ahead, behind=behind)
763 763
764 # Set None for upstreams which are not branches (e.g empty upstream, remotes 764 # Set None for upstreams which are not branches (e.g empty upstream, remotes
765 # and deleted upstream branches). 765 # and deleted upstream branches).
766 missing_upstreams = {} 766 missing_upstreams = {}
767 for info in info_map.values(): 767 for info in info_map.values():
768 if info.upstream not in info_map and info.upstream not in missing_upstreams: 768 if info.upstream not in info_map and info.upstream not in missing_upstreams:
769 missing_upstreams[info.upstream] = None 769 missing_upstreams[info.upstream] = None
770 770
771 return dict(info_map.items() + missing_upstreams.items()) 771 return dict(info_map.items() + missing_upstreams.items())
OLDNEW
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698