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

Side by Side Diff: git_common.py

Issue 1888213004: Fix ancestor check (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 8 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 # 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 return None 430 return None
431 actual_merge_base = run('merge-base', parent, branch) 431 actual_merge_base = run('merge-base', parent, branch)
432 432
433 if base_upstream != parent: 433 if base_upstream != parent:
434 base = None 434 base = None
435 base_upstream = None 435 base_upstream = None
436 436
437 def is_ancestor(a, b): 437 def is_ancestor(a, b):
438 return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0 438 return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0
439 439
440 if base: 440 if base and base != actual_merge_base:
441 if not is_ancestor(base, branch): 441 if not is_ancestor(base, branch):
442 logging.debug('Found WRONG pre-set merge-base for %s: %s', branch, base) 442 logging.debug('Found WRONG pre-set merge-base for %s: %s', branch, base)
443 base = None 443 base = None
444 elif is_ancestor(base, actual_merge_base): 444 elif is_ancestor(base, actual_merge_base):
445 logging.debug('Found OLD pre-set merge-base for %s: %s', branch, base) 445 logging.debug('Found OLD pre-set merge-base for %s: %s', branch, base)
446 base = None 446 base = None
447 else: 447 else:
448 logging.debug('Found pre-set merge-base for %s: %s', branch, base) 448 logging.debug('Found pre-set merge-base for %s: %s', branch, base)
449 449
450 if not base: 450 if not base:
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 ['HEAD']) 904 ['HEAD'])
905 905
906 906
907 def clone_file(repository, new_workdir, link, operation): 907 def clone_file(repository, new_workdir, link, operation):
908 if not os.path.exists(os.path.join(repository, link)): 908 if not os.path.exists(os.path.join(repository, link)):
909 return 909 return
910 link_dir = os.path.dirname(os.path.join(new_workdir, link)) 910 link_dir = os.path.dirname(os.path.join(new_workdir, link))
911 if not os.path.exists(link_dir): 911 if not os.path.exists(link_dir):
912 os.makedirs(link_dir) 912 os.makedirs(link_dir)
913 operation(os.path.join(repository, link), os.path.join(new_workdir, link)) 913 operation(os.path.join(repository, link), os.path.join(new_workdir, link))
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