Commit Graph

824 Commits (7149d2362165cedd74d69f4c78822cb65147b836)

Author SHA1 Message Date
Edward Lemur d6186f9936 depot_tools: Run Python scripts using vpython (Part 1)
Tbr: iannucci@chromium.org
Bug: 984182
Change-Id: If36722e190d305f89d63dce91d0a600ddc34ebe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1748589
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
James Darpinian f994d87e56 Revert "Reland "depot_tools: Move six to depot_tools' .vpython""
This reverts commit d52b306f84.

Reason for revert: Broke ANGLE CQ with "ImportError: No module named six"
Example: https://ci.chromium.org/p/angle/builders/try/mac-dbg/6758

Original change's description:
> Reland "depot_tools: Move six to depot_tools' .vpython"
> 
> This is a reland of 3a98df0bdd
> 
> Original change's description:
> > depot_tools: Move six to depot_tools' .vpython
> > 
> > Bug: 984182
> > Change-Id: I34a242c8607624beb0f06a27c563e413dec99790
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1717492
> > Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> > Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> > Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> > Reviewed-by: Michael Moss <mmoss@chromium.org>
> 
> Bug: 984182
> Change-Id: Ibf7034201e65a18f833cf1e7432f81a903a99aae
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1732880
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=iannucci@chromium.org,mmoss@chromium.org,tandrii@chromium.org,ehmaldonado@chromium.org

Change-Id: Id4488249b607441df9f00aa51f4a1f2bc4ad5cfd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 984182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1739582
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
6 years ago
Edward Lemur d52b306f84 Reland "depot_tools: Move six to depot_tools' .vpython"
This is a reland of 3a98df0bdd

Original change's description:
> depot_tools: Move six to depot_tools' .vpython
> 
> Bug: 984182
> Change-Id: I34a242c8607624beb0f06a27c563e413dec99790
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1717492
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Reviewed-by: Michael Moss <mmoss@chromium.org>

Bug: 984182
Change-Id: Ibf7034201e65a18f833cf1e7432f81a903a99aae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1732880
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 364640e249 depot_tools: Remove unused files.
- appengine_mapper.py
- checkout.py
- patch.py
- testing_support/gerrit_test_case.py
- testing_support/patches_data.py
- tests/checkout_test.py
- tests/patch_test.py

Bug: 984182
Change-Id: I2d1ccb1dc41d7034f63043aa87bca3bca4e18294
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1727401
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lesmes 365720e237 Revert "depot_tools: Move six to depot_tools' .vpython"
This reverts commit 3a98df0bdd.

Reason for revert:
Can't roll into skia and build_internal

Original change's description:
> depot_tools: Move six to depot_tools' .vpython
> 
> Bug: 984182
> Change-Id: I34a242c8607624beb0f06a27c563e413dec99790
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1717492
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Reviewed-by: Michael Moss <mmoss@chromium.org>

TBR=iannucci@chromium.org,mmoss@chromium.org,tandrii@chromium.org,ehmaldonado@chromium.org

Change-Id: I51e502e6f7633a6f26898f1ecbcd86ccf9c7c123
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 984182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1718996
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 3a98df0bdd depot_tools: Move six to depot_tools' .vpython
Bug: 984182
Change-Id: I34a242c8607624beb0f06a27c563e413dec99790
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1717492
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
6 years ago
Quinten Yearsley d242ed7a0e [git-cl] Proofread docstrings for consistency
Change-Id: I5195762d493e3c00d1656004fb2e800524ee9637
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1710950
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Quinten Yearsley <qyearsley@chromium.org>
6 years ago
Quinten Yearsley c420221f1d [git-cl] Proofread error messages for consistency
Change-Id: I6a4bbd300e8343671c9d595844de2c6ab24a00d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1710941
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Quinten Yearsley 0a0fbf143a [git-cl] Remove apparently effect-less import
Change-Id: Ief9948f5331945359696de8e158af021a6ade7ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1709804
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
6 years ago
Andrii Shyshkalov 71f0da3e93 git-cl: add --preserve-tryjobs option for upload command.
CQ will soon start canceling tryjobs it triggered on no-longer-latest
patchsets if these tryjobs won't be re-used. New option can be used by
developers who upload new patchsets but actually care for prior
CQ-triggered tryjobs to complete.

This footer is effectively sticky, unless someone removes it by hand later.
We need to have the footer one way or another to tell the CQ what to do
(and provide a visible audit trail).

We may revisit the stickiness later based on accumulated usage data s.t.
the following uploads remove the footer unless the flag is passed.

Bug: 909895
Test: git cl upload --preserve-tryjobs
Change-Id: Ibbc6e917504c31eab8ab85296b3ecafd3add46df
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1701506
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Andrii Shyshkalov 0e889b7298 git-cl: rebrand "Commit-Queue" as "CQ".
Change-Id: If61260b1f4951d3c881fff46a0bde2dac47d593b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1701503
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Yang Guo 6e269a0bab Extend git-cl-owners to show all owners for a file
Change-Id: Ie1109c3da9c687a9543c0cfb91f8660c29fb36c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1664391
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 2c48f24c7f git-cl: Report presubmit execution time.
Bug: 970113
Change-Id: Iff31287d1ab8f683f7745fd0abc62b138ffcf219
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1642649
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Eric Boren 67c4820073 [git-cl] Fix crash in "git cl upload"
This occurs when the command is run on autorollers.

Change-Id: I264b85e906617412538b333b06414479b4acc386
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1637360
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Eric Boren <borenet@chromium.org>
6 years ago
Jonathan Nieder 9779b146cd git-cl: Use modern environment variable name to trigger tracing
In git.git commit e4b75d6a1d31 (trace2: rename environment variables
to GIT_TRACE2*, 2019-05-19), the GIT_TR2_EVENT environment variable
is being renamed to GIT_TRACE2_EVENT.

Set both environment variables so that Git versions with and without
that change will both write traces to the tr2-event file.

The trace2 facility was introduced in Git 2.22.0.  rc0 and rc1 use the
more cryptic GIT_TR2* name; rc2 and later (and in particular Git
2.22.0 final) will only support GIT_TRACE2*.  In a week or so, once
this change finishes rolling out to the Googler population, we can
simplify "git cl" by only using the modern GIT_TRACE2_EVENT envvar and
GIT_TR2* will be lost to history.

Change-Id: Iade2ebfd4aff27270688d94514f5f35a4e34a29b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1636277
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jonathan Nieder <jrn@google.com>
6 years ago
sangwoo.ko 7a6143385d Decode datetime string when it's not utf-8
If the encoding is not utf-8, datatime_now() will yield

> 'now': '2019-05-17 \xbf\xc0\xc0\xfc 11:28:31'(with CP949),

and it fails to decode it with utf-8 afterward.

>  traces_readme, TRACES_README_FORMAT % git_push_metadata)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbf in position 17: invalid start byte

For further information, please check out
https://bugs.chromium.org/p/chromium/issues/detail?id=955206#c16

Bug: 955206
Change-Id: I2733849735adc0361140b042ce617522c58fcc78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1621576
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Sang Woo Ko <sangwoo108@chromium.org>
6 years ago
Daniel Cheng cf6269b441 [git-cl] Handle non-HTTPS repositories gracefully in EnsureAuthenticated
There are some Google-internal repos that use a custom scheme. Having
any remotes pointing to these URLs breaks git cl archive.

Change-Id: Ibd686c5cd11e090f0821ff2b412540138252dfce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1614946
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur 5737f025b5 git-cl: Only display a detailed message when git-cl fails.
git-cl will print the path to the collected traces and git info,
but will only display the detailed message when git-cl fails.

Bug: 961663, 955206
Change-Id: I0a4d470aba24d696bdd5e02e069833f47cf56c02
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1615665
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Edward Lemur 75391d46d0 git-cl: Reword the message when surfacing traces to the user.
In crbug.com/955206 they pointed out that:
- It's not clear when to upload the issue
- It's not clear where to report it, or where to look for existing issues.
- It's not made clear that the traces can contain information the user might not want to share.

I've reworded the message to address those concerns

Bug: 955206
Change-Id: Ia1426007d389328eac52babeee1ec3782c2b104e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1606608
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Edward Lemur 1b52d87ab5 Reland "git-cl: Keep git push traces"
This is a reland of dc8e23d356

Original change's description:
> git-cl: Keep git push traces
> 
> Keep the last N git push traces.
> Name them after the time when they were collected, and add a
> README file to each one to provide some context to developers.
> 
> Bug: 955206
> Change-Id: Ib5fcf2f78fb65f6ddd80a93619c14e1ef70c5564
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595108
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>

Bug: 955206
Change-Id: Ie63a3ebfe3024d48ad7e0c8492a2939e635371aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1600246
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Michael Moss e7f0b4c62c Revert "git-cl: Keep git push traces"
This reverts commit dc8e23d356.

Reason for revert: Breaking chrome releases crbug.com/960638

Original change's description:
> git-cl: Keep git push traces
> 
> Keep the last N git push traces.
> Name them after the time when they were collected, and add a
> README file to each one to provide some context to developers.
> 
> Bug: 955206
> Change-Id: Ib5fcf2f78fb65f6ddd80a93619c14e1ef70c5564
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595108
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>

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

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

Bug: 955206
Change-Id: Id56dfb1b32a54070d761ef75bc26bbb9081f86fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1600535
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Michael Moss <mmoss@chromium.org>
6 years ago
Edward Lemur dc8e23d356 git-cl: Keep git push traces
Keep the last N git push traces.
Name them after the time when they were collected, and add a
README file to each one to provide some context to developers.

Bug: 955206
Change-Id: Ib5fcf2f78fb65f6ddd80a93619c14e1ef70c5564
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595108
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Raul Tambre 80ee78e7fa Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Bruce Dawson 9c06201209 Fix multiple confusingly escaped regex strings
Python (prior to 3.8) treats meaningless string escape sequences as if
they were a slash followed by the character. That is, '\w' == '\\w'.
Python 3.8 rejects this, and it's confusing. This change fixes seven of these
regex strings found in depot_tools (through a regex search, natch). Most of
the fixes don't actually change the value of the strings, and this was
manually verified:

>>> '(/c(/.*/\+)?)?/(\d+)(/(\d+)?/?)?$' == r'(/c(/.*/\+)?)?/(\d+)(/(\d+)?/?)?$'
True
>>> '#\s*OWNERS_STATUS\s+=\s+(.+)$' == r'#\s*OWNERS_STATUS\s+=\s+(.+)$'
True
>>> 'COM\d' == r'COM\d'
True
>>> '^\s+Change-Id:\s*(\S+)$' == r'^\s+Change-Id:\s*(\S+)$'
True
>>> 'ETag:\s+([a-z0-9]{32})' == r'ETag:\s+([a-z0-9]{32})'
True

Two exceptions were the regex expressions in filter_demo_output.py and scm.py.
These were turned into raw strings despite this changing the value of the
string passed to re. This works because re supports the \x, \d, \w, \t, and
other escape sequences needed to make this work.

TL;DR - use raw strings for regex to avoid melting your brain. If bulk changing
regex strings to raw watch out for double-slashes.

Bug: 958138
Change-Id: Ic45264cfc63e8bae9cfcffe2cd88a57c2d3dcdae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1590534
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Raul Tambre fe1dbe120c Fix always false 'is not' comparison with a literal
The 'is' operator compares references, so a comparison with a string literal will always be false.

Found while using Python 3.8:

C:\Google\depot_tools/git_cl.py:1265: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if remote is not '.':
Change-Id: Ia77a1b350a3f0a2fe3c398e9a3b9aac8cfe38d4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1591516
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
6 years ago
Edward Lemur 0f58ae4d2d git-cl: Always collect git traces.
Collect git traces and prompt the user to upload them
when filling a bug.

Change-Id: Ic89fc848fdbfd497bd220dd54abf4ba35f40c39a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1555513
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Andrii Shyshkalov b8268cad11 Reland "git cl status: differentiate "dry-run" from generic "commit"."
This is a reland of 3c830222ae with a fix.
Previous CL relied on summary data of CQ votes provided by Gerrit,
which apparently isn't always present in the way I expected.
This resulted in "git cl status" returning "lgtm" instead of "commit"
on Skia recipe roll CLs, which resulted in recipe roller abandoning CLs,
and creating new ones (there might be a bug in recipe roller, too).

The fix is to iterate over all votes on CQ label and finding the highest
score, and then deciding on the state.

Original change's description:
> git cl status: differentiate "dry-run" from generic "commit".
>
> CQ vote       now       before
>   +2       "commit"    "commit"
>   +1       "dry-run"   "commit"
>
> R=ehmaldonado
>
> Tested: manual "git cl status" run locally.
> Change-Id: I342a3ac0830a67bf0e722c737ef00460a0df4b98
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1548287
> Auto-Submit: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: If9af5a2bf8f21d203b7a62740a27916eca0838ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1549640
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Andrii Shyshkalov c1e4405da9 Revert "git cl status: differentiate "dry-run" from generic "commit"."
This reverts commit 3c830222ae.

Reason for revert: broke recipe roller.

Original change's description:
> git cl status: differentiate "dry-run" from generic "commit".
> 
> CQ vote       now       before
>   +2       "commit"    "commit"
>   +1       "dry-run"   "commit"
> 
> R=​ehmaldonado
> 
> Tested: manual "git cl status" run locally.
> Change-Id: I342a3ac0830a67bf0e722c737ef00460a0df4b98
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1548287
> Auto-Submit: Andrii Shyshkalov <tandrii@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>

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

Change-Id: I1c7597e52f860c9b03c9f9505bda274bed32fc2a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1549639
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Andrii Shyshkalov 3c830222ae git cl status: differentiate "dry-run" from generic "commit".
CQ vote       now       before
  +2       "commit"    "commit"
  +1       "dry-run"   "commit"

R=ehmaldonado

Tested: manual "git cl status" run locally.
Change-Id: I342a3ac0830a67bf0e722c737ef00460a0df4b98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1548287
Auto-Submit: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raul Tambre b946b2389c Improve gclient Python 3 compatibility
This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Lei Zhang 5a368d4dd9 Make git cl issue handle bad arguments more gracefully.
Running "git cl issue -r invalid_input" will now produce an error
message and continue, instead of crashing with a stacktrace.

Change-Id: I17626a513df904a1a3ff725ec7a17e8541db6bf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1538978
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
6 years ago
Raul Tambre ba35c7f8ce Fix possible use of unassigned local variable in git_cl.py
When an exception occurs in CheckCallAndFilter the push_returncode variable is used in the finally block without being initialized.

Traceback (most recent call last):
  File "C:\Google\depot_tools\metrics.py", line 266, in print_notice_and_exit
    yield
  File "C:\Google\depot_tools\git_cl.py", line 5647, in <module>
    sys.exit(main(sys.argv[1:]))
  File "C:\Google\depot_tools\git_cl.py", line 5629, in main
    return dispatcher.execute(OptionParser(), argv)
  File "C:\Google\depot_tools\subcommand.py", line 252, in execute
    return command(parser, args[1:])
  File "C:\Google\depot_tools\git_cl.py", line 4641, in CMDupload
    return cl.CMDUpload(options, args, orig_args)
  File "C:\Google\depot_tools\git_cl.py", line 1623, in CMDUpload
    ret = self.CMDUploadChange(options, git_diff_args, custom_cl_base, change)
  File "C:\Google\depot_tools\git_cl.py", line 2746, in CMDUploadChange
    'exit_code': push_returncode,
UnboundLocalError: local variable 'push_returncode' referenced before assignment

Change-Id: Ife0e5226aa7e6127e8a508adb747f2c653ed8351
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1536033
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
6 years ago
Jonas Termansen d0f7911725 Support bug prefixes when stripping away empty bug in git-cl-upload.
For instance, if the bug-prefix is set to "b/", git cl upload will offer a
line with "Bug: b/", however it won't get stripped away if it's left blank,
unlike the default "Bug:" line. This change fixes that inconsistency by
also taking the bug-prefix into account when stripping.

Change-Id: Ib6e4d18c1ff52ec77cd1422be15b1e6920332238
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1528972
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jonas Termansen <sortie@google.com>
6 years ago
Karen Qian 40c19421b4 Disabling bypass CQ warning message for refs/branch-heads/* of chromium/src.
Warning message appears when trying to cherry-pick into a Chromium branch,
but doesn't actually mean anything right now.
"""
About to land on 3163. Continue (y/n)? y

It seems this repository has a Commit Queue, which can test and land changes for you.
Are you sure you wish to bypass it?
Press Enter to bypass CQ, or Ctrl+C to abort
"""

We want to disable until CQ for branches is fully developed.

Bug: 753213
Change-Id: I1cdfa084a6bad1be56b85a56e94e2dd27a099b2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1518291
Commit-Queue: Karen Qian <karenqian@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Sergiy Belozorov 0668403dfd Also redirect stderr from the browser since Chrome recently started using it too
Example stderr output from Chrome:

  [24599:24650:0306/123817.372418:ERROR:browser_process_sub_thread.cc(209)]
  Waited 3 ms for network service

R=nodir@chromium.org

Change-Id: Idb71c9f3a2c735ee49b886896f55bdede559137c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1505792
Reviewed-by: Nodir Turakulov <nodir@chromium.org>
Commit-Queue: Sergiy Belozorov <sergiyb@chromium.org>
6 years ago
Alan Cutter a3be9a522b Add --no-branch-color option to git cl status
Change-Id: Ieebdb32ac316a443789e26f3be8d5dcb4f94c4b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1470404
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Alan Cutter <alancutter@chromium.org>
6 years ago
Edward Lemur 298f2cf820 git cl: Print a clear error message when we fail to find the remote url.
Bug: 914655
Change-Id: I06a3ff39d884327fd407a5c50cc9730a375bef0b
Reviewed-on: https://chromium-review.googlesource.com/c/1382974
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Quinten Yearsley 0e617c0294 Change git cl comments to list robot comments.
In particular, only show robot comments from the latest patchset.

Bug: 924780
Change-Id: I12038ddd2d90a5cb561b248de3fd37908d5b927e
Reviewed-on: https://chromium-review.googlesource.com/c/1457282
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
6 years ago
Takuto Ikuta 51eca59ff6 Support --enable-auto-submit in `git cl split`
With default True.

This CL was uploaded by git cl split.

R=jochen@chromium.org
Bug: 927178
Change-Id: Ie0a68ed7ca381e1bb33341badca153bf409bb376
Reviewed-on: https://chromium-review.googlesource.com/c/1470402
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
6 years ago
Daniel McArdle 452a49f4b6 Fix colorized branch alignment in 'git cl status'
Change-Id: Ie32057ecabc3839273c74c08bef95515b7522ea4
Reviewed-on: https://chromium-review.googlesource.com/c/1468381
Commit-Queue: Daniel McArdle <dmcardle@chromium.org>
Auto-Submit: Daniel McArdle <dmcardle@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raul Tambre 5a52587030 Support Git editor paths with spaces
Git requires single quotes for paths with spaces.
We however need to convert single quotes to double quotes for Windows to treat such paths as a single path.

Bug: 916922
Change-Id: I89b23552a2a32d5aa58ea4f207690595823692d5
Reviewed-on: https://chromium-review.googlesource.com/c/1467301
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Raul Tambre <raul@tambre.ee>
6 years ago
Sylvain Defresne b1f865dac5 Add a --ignore-self parameter to "git cl owners"
Sometimes CL author is also listed as OWNERS but want to find a co-owner
to review CL. Currently "git cl owners" is unhelpful as it consider the
author's ownership as enough.

Add a --ignore-self parameter to "git cl owners" that will cause the
tool to ignore author's ownership when looking for a reviewer.

Bug: none
Change-Id: Iba110a465a552cd6befb46c77b2e65f60b663a13
Reviewed-on: https://chromium-review.googlesource.com/c/1459625
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
6 years ago
Daniel McArdle a23bf5951d Colorize the current branch in 'git cl status'
Change-Id: I5cdb484ae4b6829aeeb83924fb464939cdb4298b
Reviewed-on: https://chromium-review.googlesource.com/c/1464776
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Daniel McArdle <dmcardle@chromium.org>
6 years ago
Bryce Thomas cfc9712bc8 Fix git cl format following removal of Rietveld.
Commit a185e2e3c8 removed the Rietveld code review
implementation, albeit hasn't expunged all references to Rietveld.  This leads
to an assertion error when running |git cl format| on a non-Gerrit change.
There appears to have been a recent attempt to articulate this error better in
a185e2e3c8, albeit not fix the underlying issue.
This change addresses the immediate issue by defaulting the code review
implementation to Gerrit rather than Reitveld.

R=joenotcharles@google.com, tandrii@chromium.org

Bug: 914150
Change-Id: I64d33e5a172cc43339ec417f7f0a7820e0337772
Reviewed-on: https://chromium-review.googlesource.com/c/1372928
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Bryce Thomas <bryct@amazon.com>
6 years ago
Edward Lemur 687ca907fd git-cl: Set Code-Review label as a git push argument.
Bug: 877717
Change-Id: I6541a971068aae662b086eba84448bd0769f1a09
Reviewed-on: https://chromium-review.googlesource.com/c/1362405
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Joe Mason d87b09662e More context when _load_codereview_impl asserts
Bug: 908466
Change-Id: I715633c64fff343d07dbcf50c261e686d77e8c44
Reviewed-on: https://chromium-review.googlesource.com/c/1351511
Reviewed-by: Andy Perelson <ajp@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Joe Mason <joenotcharles@google.com>
6 years ago
Edward Lemur 61ea30737c git-cl: Remove unused settings.
Bug: 770408
Change-Id: Ic5029d6b12cdb6ea30704d90229ab7e365dc7273
Reviewed-on: https://chromium-review.googlesource.com/c/1354384
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Aiden Benner 6c18a1afa1 Fix git cl format --python when diff.noprefix flag is set
Adding the diff.noprefix flag to .gitconfig broke python
formatting because git diffs were being parsed with regex
that relied on the default git diff prefixs.

This CL fix's this issue by always specifying prefix flags
for git diffs when formatting python.

Bug:846432
Change-Id: Ifde305da9574e6b46455a0237703b7364fac77e4
Reviewed-on: https://chromium-review.googlesource.com/c/1349809
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
Commit-Queue: Marc-Antoine Ruel <maruel@chromium.org>
7 years ago
Andrii Shyshkalov a185e2e3c8 git cl: remove Rietveld implementation entirely.
R=ajp, ehmaldonado

Change-Id: I59859048d64902669479e666c6c3d37c1fb1394c
Reviewed-on: https://chromium-review.googlesource.com/c/1344642
Auto-Submit: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Andrii Shyshkalov 0a264d861b git cl: remove Rietveld import and things it depends on.
On my machine, saves 0.16s of time while loading git cl:
from 0.32s to 0.16s.

R=ajp, ehmaldonado

Change-Id: I0febca43f11514da3e3f7be7e2c0184fb9e17409
Reviewed-on: https://chromium-review.googlesource.com/c/1344641
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago