summaryrefslogtreecommitdiffstats
path: root/subcmds/diff.py
Commit message (Collapse)AuthorAgeFilesLines
* subcmds: reduce multiprocessing serialization overheadKuang-che Wu2024-10-231-11/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow the same approach as 39ffd9977e to reduce serialization overhead. Below benchmarks are tested with 2.7k projects on my workstation (warm cache). git tracing is disabled for benchmark. (seconds) | v2.48 | v2.48 | this CL | this CL | | -j32 | | -j32 ----------------------------------------------------------- with clean tree state: branches (none) | 5.6 | 5.9 | 1.0 | 0.9 status (clean) | 21.3 | 9.4 | 19.4 | 4.7 diff (none) | 7.6 | 7.2 | 5.7 | 2.2 prune (none) | 5.7 | 6.1 | 1.3 | 1.2 abandon (none) | 19.4 | 18.6 | 0.9 | 0.8 upload (none) | 19.7 | 18.7 | 0.9 | 0.8 forall -c true | 7.5 | 7.6 | 0.6 | 0.6 forall -c "git log -1" | 11.3 | 11.1 | 0.6 | 0.6 with branches: start BRANCH --all | 21.9 | 20.3 | 13.6 | 2.6 checkout BRANCH | 29.1 | 27.8 | 1.1 | 1.0 branches (2) | 28.0 | 28.6 | 1.5 | 1.3 abandon BRANCH | 29.2 | 27.5 | 9.7 | 2.2 Bug: b/371638995 Change-Id: I53989a3d1e43063587b3f52f852b1c2c56b49412 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/440221 Reviewed-by: Josip Sokcevic <sokcevic@google.com> Tested-by: Kuang-che Wu <kcwu@google.com> Commit-Queue: Kuang-che Wu <kcwu@google.com>
* isort: format codebasev2.36Mike Frysinger2023-08-221-1/+2
| | | | | | | | Change-Id: I6f11d123b68fd077f558d3c21349c55c5f251019 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383715 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* Format codebase with black and check formatting in CQGavin Mak2023-03-221-38/+47
| | | | | | | | | | | | Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* status, diff: display correct path for multi-manifestLaMont Jones2022-07-141-3/+6
| | | | | | | | | | | | | | Display the project path relative to the outermost manifest by default, and relative to the sub manifest only when --this-manifest-only is specified. For project-related diagnostic messages, use the outermost manifest for messages. Change-Id: I4537d7dd412a2c182e77d6720e95c1b0ef70eb0e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/340754 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: LaMont Jones <lamontjones@google.com>
* Add multi-manifest support with <submanifest> elementv2.22LaMont Jones2022-02-171-1/+1
| | | | | | | | | | | To be addressed in another change: - a partial `repo sync` (with a list of projects/paths to sync) requires `--this-tree-only`. Change-Id: I6c7400bf001540e9d7694fa70934f8f204cb5f57 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/322657 Tested-by: LaMont Jones <lamontjones@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* commands: document the "common" class attributeMike Frysinger2021-06-151-1/+1
| | | | | | | | | | Switch it to uppercase to make it clear it's a constant, and add documentation so its usage is clear. Change-Id: I6d281a66a90b5908b3131585c9945e88cfe815ea Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/309322 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* subcmds: force consistent help text formatMike Frysinger2021-05-041-1/+1
| | | | | | | | | | | | We're inconsistent with help text as to whether it uses title case and whether it ends in a period. Add a test to enforce a standard, and use the style that Python optparse & argparse use themselves (e.g. with the --help option): always lowercase, and never trailing period. Change-Id: Ic1defae23daeac0ac9116aaf487427f50b34050d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305144 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* command: add a helper for the parallel execution boilerplateMike Frysinger2021-04-151-18/+15
| | | | | | | | | | | Now that we have a bunch of subcommands doing parallel execution, a common pattern arises that we can factor out for most of them. We leave forall alone as it's a bit too complicated atm to cut over. Change-Id: I3617a4f7c66142bcd1ab030cb4cca698a65010ac Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/301942 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
* command: make --verbose/--quiet available to all subcommandsMike Frysinger2021-04-131-1/+0
| | | | | | | | | | | Add new CommonOptions entry points to move the existing --jobs to, and relocate all --verbose/--quiet options to that. This provides both a consistent interface for users as well as for code. Change-Id: Ifaf83b88872421f4749b073c472b4a67ca6c0437 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/303224 Reviewed-by: Raman Tenneti <rtenneti@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* diff: add --jobs supportMike Frysinger2021-02-231-4/+38
| | | | | | | | | Use multiprocessing to run diff in parallel. Change-Id: I61e973d9c2cde039d5eebe8d0fe8bb63171ef447 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297483 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
* strip python2-only coding:utf-8 & print_function settingsMike Frysinger2021-01-061-2/+0
| | | | | | | | | | We're committed to Python 3 at this point, so clean up boilerplate. Bug: https://crbug.com/gerrit/10418 Change-Id: Ib1719ba2eb65c53b94881a1a1bf203ddfcaaafed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/292382 Reviewed-by: Chris Mcdonald <cjmcdonald@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* diff: delete unused nested funcMike Frysinger2020-02-171-4/+0
| | | | | | | Change-Id: I43ab4bc944269e43a6cd7b2ac350c09b7c700a6c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255492 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* Fix blank line issues reported by flake8David Pursehouse2020-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* diff: handle errors gracefullyMike Frysinger2019-10-011-1/+4
| | | | | | | | | | | | If `git diff` fails in any project checkout (e.g. an incomplete sync), make sure we print that error clearly rather than blowing up, and exit non-zero in the process. Bug: https://crbug.com/gerrit/11613 Change-Id: I12f278427cced20f23f8047e7e3dba8f442ee25e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239236 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* set default file encoding to utf-8Mike Frysinger2019-06-131-0/+1
| | | | | | | | There's no reason to support any other encoding in these files. This only affects the files themselves and not streams they open. Bug: https://crbug.com/gerrit/10418 Change-Id: I053cb40cd3666ce5c8a0689b9dd938f24ca765bf
* Option for 'repo diff' to generate output suitable for 'patch' cmdpelya2012-04-131-1/+14
| | | | | | | | | | | | | | The -u option causes 'repo diff' to generate diff output with file paths relative to the repository root, so the output can be applied to the Unix 'patch' command. The name '-u' was selected for convenience, because both 'diff' and 'git diff' accept the option with the same name to generate an 'unified diff' output suitable for 'patch' command. Change-Id: I79c8356db4ed20ecaccc258b3ba139db76666fe0 Reviewed-on: https://gerrit-review.googlesource.com/34380 Reviewed-by: Shawn Pearce <sop@google.com> Tested-by: Shawn Pearce <sop@google.com>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+27