It's easy - Executing the given shell command in each git project by running repo forall -c ''
For example, I want to know how many patch files between master-product-qc-4.3(Ara mainline) and r18521.1(pure QCOM release without any Ara changes). It can be done with below steps. 1. Check your repo branches to avoid typo;
$ git --git-dir=.repo/manifests/.git branch -a * default remotes/m/master-product-qc-4.3 -> origin/master-product-qc-4.3 remotes/origin/int-qc/r1031.1 remotes/origin/int-qc/r18521.1 remotes/origin/int-qc/r18522.2 remotes/origin/master remotes/origin/master-product-qc-4.3 |
2. Put below shell command in a script and run it(You can use attached script file);
repo forall -c '\ repo_url=$(echo $REPO_PROJECT | sed -e "s:\/:_:g") && \ reportsdir=~/repo_branch_diff && \ range_f= remotes/origin/int-qc/r18521.1 && \ range_t= remotes/origin/master-product-qc-4.3 && \ mkdir -p $reportsdir/$repo_url && \ git diff --name-only $range_f..$range_t > $reportsdir/$repo_url/$repo_url.filediff && \ git diff -b $range_f..$range_t > $reportsdir/$repo_url/$repo_url.thediff && \ [ -s $reportsdir/$repo_url/$repo_url.thediff ] && \ git format-patch $range_f..$range_t -o $reportsdir/$repo_url && \ echo "from: " >> $reportsdir/$repo_url/git_branch_revisions.txt && \ git show-ref $range_f >> $reportsdir/$repo_url/git_branch_revisions.txt && \ echo "to: " >> $reportsdir/$repo_url/git_branch_revisions.txt && \ git show-ref $range_t >> $reportsdir/$repo_url/git_branch_revisions.txt' |
Before running above command, 2 things you need to check: - Specify which two branches you want to do diff. One is specified by 'range_f'(from); another is specified by 'range_t'(to). For my case, from' is remotes/origin/int-qc/r18521.1, to is remotes/origin/master-product-qc-4.3 ; - Specify a path with write permission for saving diff results(For my case, the patch is ~/repo_branch_diff).
Generally, above command will do 'diff' for each repo project(Each repo project is a single git repository). If two repo projects have difference, then a folder named as repo project will be created. That means I will put each repo project's patch files in difference folder. It's help us to know how many patches for a single repo project. Here's the result for my case:
$ ls -lh drwxr-sr-x 2 m7yang psw_easha 24K Feb 15 10:59 aol1_device_nokia drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:29 aol1_device_qcom_common drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 10:59 aol1_kernel_lk drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_kernel_msm drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 10:59 aol1_platform_bionic drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 10:59 aol1_platform_bootable_recovery drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 20 15:52 aol1_platform_build drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 10:59 aol1_platform_dalvik drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_chromium drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_dhcpcd drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_ebtables drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_icu4c drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_iptables drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_jhead drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_libsepol drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_llvm drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_mp4parser drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_oprofile drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_skia drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_srec drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_svox drwxr-sr-x 2 m7yang psw_easha 4.0K Feb 15 11:00 aol1_platform_external_tinyxml |
Each folder contains git patch files( .patch) and below 3 files: - A .filediff file. Open that file you can see how many files are difference between two branches; - A .thediff file that is a big diff file - All differences are in this single file. It's useful when you want to use 'patch' to patch whole changes to somewhere; - git_branch_revisions.txt keep two SHA-1s for 'from' branch and 'to' branch;
-- MingYang - 29 Jul 2014