Commit Graph

433 Commits (464e9ff4f3682426b0cb3b68ee38e7be6fa4a2be)

Author SHA1 Message Date
Josip Sokcevic 464e9ff4f3 Add support for git_cl_tests on Windows platform
Change-Id: I9d3d084e7f48ab991db3db16873f030890ad72d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2108981
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lemur 5a644f8276 Reland "git-cl: Refactor CMDUploadChange"
This is a reland of 9f29465e52

Original change's description:
> git-cl: Refactor CMDUploadChange
>
> Changes:
> - Add _GetDescriptionForUpload and _GetTitleForUpload.
> - Add ensure_change_id to ChangeDescription, that ensures the
>   description has a particular Change-Id.
> - If more than a Change-Id was entered on new issue upload, remove
>   all, and add a new one.
>
> Change-Id: I0eae474eb07ea3036973b18571f72a80da425b21
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101811
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: Ib2c0ad61b169f6b0c3141674591b0d3fa42bc664
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2103532
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lesmes c48fb8427c Revert "git-cl: Refactor CMDUploadChange"
This reverts commit 9f29465e52.

Reason for revert:
line 2302, in CMDUploadChange
    change_id = change_ids[0]
IndexError: list index out of range

Original change's description:
> git-cl: Refactor CMDUploadChange
> 
> Changes:
> - Add _GetDescriptionForUpload and _GetTitleForUpload.
> - Add ensure_change_id to ChangeDescription, that ensures the
>   description has a particular Change-Id.
> - If more than a Change-Id was entered on new issue upload, remove
>   all, and add a new one.
> 
> Change-Id: I0eae474eb07ea3036973b18571f72a80da425b21
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101811
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com

Change-Id: Ibb76539066c103ec951fa8d02684bc10f84549bf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2103531
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 9f29465e52 git-cl: Refactor CMDUploadChange
Changes:
- Add _GetDescriptionForUpload and _GetTitleForUpload.
- Add ensure_change_id to ChangeDescription, that ensures the
  description has a particular Change-Id.
- If more than a Change-Id was entered on new issue upload, remove
  all, and add a new one.

Change-Id: I0eae474eb07ea3036973b18571f72a80da425b21
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101811
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 2c62b334ea git-cl: Stop using Change class from presubmit support.
Bug: 1042324
Change-Id: I72db082f086f69bf49256d0613c39dc92ae0a07f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101471
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lemur 5fb2224974 git-cl: Set the right Change-Id footer automatically.
If the Change-Id in the description is different from the one fetched
from Gerrit, automatically set the right one instead of asking the
user to do so.

Change-Id: I0f681d9e7d98f3ed50adc4b6e4929981530e901c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2101368
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Andrii Shyshkalov 1ee78cdaac git cl: use short URLs in `git cl status`.
This also applies to git map-branches.

R=ehmaldonado

Change-Id: Ica9bc92660716c15cbdd6bfd77b93f08bd0d8f9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2099329
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Andrii Shyshkalov 8aa9d62e8e git cl: better detection of messages from CQ.
CQ added support to project-scoped accounts instead of previously
hardcoded commit-bot@ for working with Gerrit.

R=ehmaldonado

Test: `git cl status` on this very CL :)
Bug: 911811
Change-Id: I8f48a7bdc9dad9a5b71d266ccf7e9a493aa94aa9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2095986
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
5 years ago
Edward Lemur a12175c2a7 git-cl: Use _create_description_from_log instead of GetLocalDescription
Also refactor code to eliminate multiple calls to _create_description_from_log.

Change-Id: I113134fbd90f396bdb6d561ed0369ea5ee9c78ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2090448
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Quinten Yearsley ee8be8a368 git-cl: Don't throw AttributeError in git cl upload --retry-failed
Bug: 1057745
Change-Id: Ic1b977634e15b163e627c0f389047a26f7b0c7d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2083677
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
5 years ago
Edward Lemur 99df04e8aa git-cl: Check if author exists before adding to presubmit command line.
When user.email is not configured in git, git-cl tries to call
presubmit support with --author None, which makes git-cl crash.

Bug: b/150870673
Change-Id: Idc42ba2b970340ed93e1e92f65850fc1a12336d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2090375
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Quinten Yearsley 777660f33f depot_tools: git-cl: Rename try job to tryjob for consistency
Change-Id: I3310db47604dafead241db4d8d3540277daeb07c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2083675
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 1a83da1f41 git-cl: Fix Python 3 bugs
- Don't encode description when calling presubmit,
  codecs.open already takes care of that.
- Don't use raw_input on Python 3
- Encode stdin when calling clang-format.

Bug: 1058318, 1058318
Change-Id: I825422e160c00b33b2c52b6e64e5f0a3e44606f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2086631
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 4576851428 git-cl: Remove support for GetPreferredTryMasters.
Bug: 1042324
Change-Id: I9d554d8ffe5c17278d4cd90d2aa0a49fc329f695
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2075797
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip Sokcevic 953278adbf Print content of description backup on exit
Change-Id: I9607035c8ee5e5f4423b7526c67f384cfebb2f1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2079708
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 7552630e0d git-cl: Run PostUpload hooks via CLI.
Bug: 1042324
Change-Id: Iae90e632e9c1b2c798575ab940d82a145b47204a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2070681
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lemur 9468eba70d git-cl: Add tests for git-cl presubmit
Bug: 1056309, 1042324
Change-Id: I69815044c199f2321a66760bbdfe251ed916154a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2076037
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 227d510857 git-cl: Invoke presubmit checks via subprocess execution instead of via module.
PRESUBMIT.py scripts are executed in presubmit_support.py using exec().
Since PRESUBMIT.py scripts might not be yet compatible with python 3, we
have to execute presubmit_support.py using python 2.

git_cl.py imports presubmit_support.py, and executes presubmit checks using
presubmit_support as a module. This forces git_cl.py to be executed using
python 2 to maintain compatibility for PRESUBMIT.py scripts.

This change allows git_cl.py to be executed using python 3, while
presubmit_support.py is executed using python 2.

Similar changes for post-submit hooks and git-cl try masters will follow.

Bug: 1042324
Change-Id: Ic3bb1c2985459baf6aa04d0cc65017a1c2578153
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2068945
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 9aa1a9673a git-cl: Add GetAuthor method and cache GetLocalDescription results
Bug: 1051631
Change-Id: I5da32978bbed16bcc9854f15db91a901f5892cda
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2067402
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 61bf4177c4 git-cl: Fix get_cl_statuses for Python 3 and add tests.
In Python 3 the semantics of `raise StopIteration` inside a generator
function changed.

Bug: 1002209
Change-Id: I51222a5006c4024b3a6a06d344423ee36870825a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2071056
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 1773f37de6 gclient_utils: Add temporary_file method.
Useful when passing information to a subcommand via a temporary file.

Bug: 1051631
Change-Id: I0b8deda921effd24a37109544e1e7ca22e00ba4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2068942
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 8410164ab1 git-cl: Fix invocation of git new-branch
Bug: 1054787, 1051631
Change-Id: Ib36740a3f8158977897431c5b52e5ecbdaeb16b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2068506
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lemur d55c507713 git-cl: Mock DieWithError and GitSanityTests
Bug: 1051631
Change-Id: I20f68db7dd0a901ff53513998e148cf4ba2c3eaa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2065133
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 7677e5ccc0 git-cl: Mock GetChangeDetail on tests.
Mock GetChangeDetail instead of using self.calls to make the code
easier to change.

Bug: 1051631
Change-Id: I77361caccaf694644839825d890343864267688f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2062716
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lemur 269640724f git-cl: Use scm.GIT.GetConfig in more places.
Bug: 1051631
Change-Id: I43460b72dfbc9c8210c2d8fdf5d29e876a5637f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2056648
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 851532894f git-cl: Use scm.GIT.{Get,Set}BranchConfig and {Get,Set}BranchRef instead of git calls.
scm.GIT functions are tested, and using them makes it easier to mock
git calls on git-cl tests.

Bug: 1051631
Change-Id: If067aa3f71b7478cafd7985d3020dacc0c6a41c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2055464
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 15a9b8cc5d git-cl: Use scm.GIT.FetchUpstreamTuple.
scm:
- Add methods to deal with git configs and tests for them.
  Will make it easier to mock git config calls as opposed
  to all git calls.
- Add tests to FetchUpstreamTuple

git-cl:
- Mock out settings.GetChangeRoot()
- Use scm.GIT.FetchUpstreamTuple() to reduce code duplication,
  and mock it out on tests.

Bug: 1051631
Change-Id: I1a3220b4c0f3e6221b3c00550259a433c2775798
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2052552
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lemur da4b6c6e04 git-cl: Use mock.patch instead of custom mock.
Bug: 1051631
Change-Id: I0c8222f89477300e6a14296b72ecaa01d65ca32d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2052627
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 73c76703be git-cl: Don't use assertRegexpMatches on tests.
Is not needed, and it's deprecated on Python 3.

Change-Id: I040891ff74708c6606b8c216da3a0bb98d44d977
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2042281
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lemur 6c6827cbf2 git-cl: Simplify FetchDescription and UpdateDescription
- Merge GetDescription and FetchDescription, and remove unused `force` argument.
- Merge UpdateDescription and UpdateDescriptionRemote.

Bug: 1042324
Change-Id: Ia7a1b0aa1ea12a95bb6a19d9d3c9dd6aeb5bd2b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2039968
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lemur 6e9bfb0617 git-cl: Remove GetDescriptionFooters and UpdateDescriptionFooters
Unused after https://skia-review.googlesource.com/c/skia/+/265209

Bug: 1042324
Change-Id: I43a04d659e4d851e7b954cdd7dc0525490e3244c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2039969
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 7f6dec0169 git-cl: Simplify Change object construction.
The `author` parameter is never set.
The `local_description` parameter was only set with the
purpose of getting the local description, so separate it into its
own method and call that instead.
Use the absolute root when getting the list of modified files instead.

Bug: 1042324
Change-Id: I8505172edaacee0656dda98ebbd5f8ebfacb3cef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2038050
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 52969c9d10 git-cl: Remove _add_codereview_[issue_]select_options and _CODEREVIEW_IMPLEMENTATIONS.
Change-Id: I94922e1abab8acac132e16d255e1a9b95771ea5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2040572
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip 906bfde9b6 Use logger where unit test has coverage
Change-Id: I0a4d16fef3aed6bba0c6015fe861a2f11558e11b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2029114
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Florian Mayer ae510e8f08 Do not crash for non URL (i.e. SSH) remotes.
Without this change, having an SSH remote configured makes `git cl
archive` crash:

Traceback (most recent call last):
  File "/usr/local/google/home/fmayer/depot_tools/metrics.py", line 267, in print_notice_and_exit
    yield
  File "/usr/local/google/home/fmayer/depot_tools/git_cl.py", line 5553, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/google/home/fmayer/depot_tools/git_cl.py", line 5535, in main
    return dispatcher.execute(OptionParser(), argv)
  File "/usr/local/google/home/fmayer/depot_tools/subcommand.py", line 252, in execute
    return command(parser, args[1:])
  File "/usr/local/google/home/fmayer/depot_tools/metrics.py", line 252, in _inner
    return self._collect_metrics(func, command_name, *args, **kwargs)
  File "/usr/local/google/home/fmayer/depot_tools/metrics.py", line 232, in _collect_metrics
    gclient_utils.reraise(exception[0], exception[1], exception[2])
  File "/usr/local/google/home/fmayer/depot_tools/metrics.py", line 205, in _collect_metrics
    result = func(*args, **kwargs)
  File "/usr/local/google/home/fmayer/depot_tools/git_cl.py", line 3786, in CMDarchive
    for cl, status in statuses
  File "/usr/local/google/home/fmayer/depot_tools/git_cl.py", line 3599, in get_cl_statuses
    cl.EnsureAuthenticated(force=False, refresh=True)
  File "/usr/local/google/home/fmayer/depot_tools/git_cl.py", line 1757, in EnsureAuthenticated
    if urllib.parse.urlparse(self.GetRemoteUrl()).scheme != 'https':
  File "/usr/lib/python2.7/urlparse.py", line 143, in urlparse
    tuple = urlsplit(url, scheme, allow_fragments)
  File "/usr/lib/python2.7/urlparse.py", line 201, in urlsplit
    i = url.find(':')
AttributeError: 'NoneType' object has no attribute 'find'

Change-Id: I6f794f11d3ed5e3dbedfe278ded660fca32abda6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2030505
Commit-Queue: Florian Mayer <fmayer@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Josip e827b0f7ec Adds support to edit description on git cl upload
git cl upload gets a new flag --edit-description, which allows user to
edit git commit message. It only works when updating existing CL.

Bug: 739928
Change-Id: Ia501dc31f32e1887a937d5df39aed03745376827
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2020591
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Anthony Polito 1a5fe23592 add revision to scheduleBuild call for git cl try if needed.
Bug: 1043877
Change-Id: I5363dc1ad7f6b7e0ce9ce9885c86e357c3c65339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2016162
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
5 years ago
Jamie Madill 5e96ad12ac Re-land "git-cl: Fix format --dry-run not working with --full."
Re-land fixes format always saying the folder was dirty.

The --full option would skip setting the return value of the format
command when used with --dry-run. This in turn would cause the
presubmit check to always pass when --full was enabled in a repo by
default.

Was discovered in the ANGLE repository.

Bug: angleproject:4241
Change-Id: I986646336d1857af2826863ef4becbf2b9ee3049
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1993910
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Jamie Madill 177710b35f Revert "git-cl: Fix format --dry-run not working with --full."
This reverts commit fc132e61db.

Reason for revert: Causes all presubmit checks to return dirty
format because of a non-zero diff output.

Original change's description:
> git-cl: Fix format --dry-run not working with --full.
> 
> The --full option would skip setting the return value of the format
> command when used with --dry-run. This in turn would cause the
> presubmit check to always pass when --full was enabled in a repo by
> default.
> 
> Was discovered in the ANGLE repository.
> 
> Bug: angleproject:4241
> Change-Id: Ie6cb423a6818c1e26781d77938a0dd22c02b4c16
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1987835
> Commit-Queue: Jamie Madill <jmadill@chromium.org>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Auto-Submit: Jamie Madill <jmadill@chromium.org>

TBR=ehmaldonado@chromium.org,jmadill@chromium.org

Change-Id: I0a4c51117ab20606f6dbb1f7a3ba40f87da1e939
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: angleproject:4241
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1993907
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
5 years ago
Jamie Madill fc132e61db git-cl: Fix format --dry-run not working with --full.
The --full option would skip setting the return value of the format
command when used with --dry-run. This in turn would cause the
presubmit check to always pass when --full was enabled in a repo by
default.

Was discovered in the ANGLE repository.

Bug: angleproject:4241
Change-Id: Ie6cb423a6818c1e26781d77938a0dd22c02b4c16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1987835
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Jamie Madill <jmadill@chromium.org>
5 years ago
Edward Lemur a81450253f depot_tools: Use mock from vpython (or unittest.mock) instead of third_party/mock
Change-Id: I3a188b34ae5f62649108afe08fe0e389a408c2ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1947933
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Kevin Marshall 0e60ecd30e [git-cl] Add graceful error handling to "git cl archive".
Adds error handling logic for pre-existing tags (which can occur
if "archive" is CTRL-C aborted midway through) and for undeletable
branches (which can happen if they are currently checked out in a
working dir).

Change-Id: I27b6da9f5860c307f49cbeabb1b0ccf9cfb28eb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1930023
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Kevin Marshall <kmarshall@chromium.org>
5 years ago
Anthony Polito 02b5af3575 fix hashtags: double colons are not hashtags
Bug: 896110
Change-Id: Ibaf36df48d9ea25e8ee633ca505fa7f7c2063df4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1944639
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
5 years ago
Brian Sheedy b4307d5c14 Switch yapfignore to fnmatch
Switches the yapfignore implementation in git_cl to use fnmatch instead
of glob. This ends up bringing the .yapfignore file parsing in line with
yapf's actual implementation, namely allowing uses such as '*pb2.py'
instead of having to list out each directory manually.

Bug: 1027953
Change-Id: Ibb1cb4252c546de6f1b1af720c4c29ffd0f7be0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1938026
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
5 years ago
Anthony Polito 46689b09c5 Fix CMDUploadTestCase in presubmit
Bug: 1025293
Change-Id: I41ca2fba3855ecad3036e94a3bdc39b399c1a276
Recipe-Nontrivial-Roll: build_limited_scripts_slave
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1918609
Commit-Queue: Anthony Polito <apolito@google.com>
Auto-Submit: Anthony Polito <apolito@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 0db01f0fab git-cl: Make tests run on Python 3.
Bug: 1002209
Change-Id: I90de660afd901e544e5557f3af3a56cef4d6adaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891667
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
6 years ago
Edward Lemur 79d4f99506 Reland "git-cl: Fix some python3 compatibility errors."
This is a reland of c87ed60623
Fix on the reland: Encode change description before writing to temporary file.

Original change's description:
> git-cl: Fix some python3 compatibility errors.
>
> Also, fix bug in git cl status where the 'updated' field was used to compare messages, even though
> it doesn't exist (see [1]). This CL modifies it to use 'date', which does exist.
>
> [1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info
>
> Bug: 1002209
> Change-Id: I5a5e1193b8502c3ad35d94808ea178cad7f44ac6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891259
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Anthony Polito <apolito@google.com>

Bug: 1002209
Change-Id: I2f0fc779ea3e361e6d32ee7ce1e53cbddb5cfdea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1898702
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
6 years ago
Edward Lesmes f6a2232b48 Revert "git-cl: Fix some python3 compatibility errors."
This reverts commit c87ed60623.

Reason for revert: 
Causes a regressions for CL descriptions on Windows

Original change's description:
> git-cl: Fix some python3 compatibility errors.
> 
> Also, fix bug in git cl status where the 'updated' field was used to compare messages, even though
> it doesn't exist (see [1]). This CL modifies it to use 'date', which does exist.
> 
> [1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info
> 
> Bug: 1002209
> Change-Id: I5a5e1193b8502c3ad35d94808ea178cad7f44ac6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891259
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Anthony Polito <apolito@google.com>

TBR=ehmaldonado@chromium.org,apolito@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1002209
Change-Id: I004f202b12c6b99cb6b24cb12a14fba7898569e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1898547
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur c87ed60623 git-cl: Fix some python3 compatibility errors.
Also, fix bug in git cl status where the 'updated' field was used to compare messages, even though
it doesn't exist (see [1]). This CL modifies it to use 'date', which does exist.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-message-info

Bug: 1002209
Change-Id: I5a5e1193b8502c3ad35d94808ea178cad7f44ac6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891259
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
6 years ago
Jamie Madill dc4d19eeb6 git-cl: Add 'format-full-by-default' setting.
Lets the client repository make 'git cl format' use the
'--full' option by default. This solves issues when using less
common clang-format options that don't behave well with small
diffs. For example, AlignConsecutiveAssignments.

This is a replacement for the 'diff-lines-of-context' setting.

Bug: angleproject:4003
Change-Id: I81dc3b4992a7420e7235da88ec78e51ec4c0d24f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1879148
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
6 years ago