summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdrian DC <radian.dc@gmail.com>2016-09-08 17:11:11 +0200
committerAdrian DC <radian.dc@gmail.com>2016-12-04 12:04:36 +0100
commit0730edceb5b5454b84260856e064a701276b2c8b (patch)
treec656f11361b961421228f630b7c081a2741fe30a /tools
parentb7831759763be0c30d1762f63db0010225957bca (diff)
downloadbuild-0730edceb5b5454b84260856e064a701276b2c8b.zip
build-0730edceb5b5454b84260856e064a701276b2c8b.tar.gz
build-0730edceb5b5454b84260856e064a701276b2c8b.tar.bz2
build: repopick: Support projects with less than 10 commits
* Verify that the project has at least 10 commits to verify, if not check only the amount of existing commits RM-290 Change-Id: Ic95212510d8f5b980c9a94af8d5ac1e0dfd94b3e
Diffstat (limited to 'tools')
-rwxr-xr-xtools/repopick.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/repopick.py b/tools/repopick.py
index 2b436ef..8031a6a 100755
--- a/tools/repopick.py
+++ b/tools/repopick.py
@@ -319,9 +319,15 @@ if __name__ == '__main__':
if args.start_branch:
subprocess.check_output(['repo', 'start', args.start_branch[0], project_path])
- # Check if change is already picked to HEAD...HEAD~10
+ # Determine the maximum commits to check already picked changes
+ check_picked_count = 10
+ branch_commits_count = int(subprocess.check_output(['git', 'rev-list', '--count', 'HEAD'], cwd=project_path))
+ if branch_commits_count <= check_picked_count:
+ check_picked_count = branch_commits_count - 1
+
+ # Check if change is already picked to HEAD...HEAD~check_picked_count
found_change = False
- for i in range(0, 10):
+ for i in range(0, check_picked_count):
output = subprocess.check_output(['git', 'show', '-q', 'HEAD~{0}'.format(i)], cwd=project_path).split()
if 'Change-Id:' in output:
head_change_id = output[output.index('Change-Id:')+1]