This was made by running `codespell` and `scspell`
and then checking the results.
Change-Id: I169fd5b40294f83015075b4a899fbca263821f25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2144602
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Auto-Submit: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
This is a reland of e3a49aa405
GetRelativeRoot was fixed to use '.' instead of None
Original change's description:
> git-cl: Remove unused and duplicate functions.
>
> Remove unused functions, and use scm.GIT where possible to reduce
> duplication.
>
> Change-Id: I24f05e7b3ae04743e97b6665ee668f44d6acc294
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116938
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Change-Id: I54bd1d34d3501a38bf8af2f9e70059d58fa538a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2125293
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
On an initial upload, git-cl upload -t <title> should append <title>
before the change description.
This broke because options.squash is set to a default value very late
into code execution, so its value was not available when computing the
initial description.
options.squash is now set when parsing the options, early into code
execution.
Bug: 1064905
Change-Id: I04a18c572dd5b04a3013d39f71bc43d026ea85d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2122324
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
This option lets users specify a format of the archive tags. E.g.
git cl archive -p 'archived/{issue}-{branch}'
makes tags in the format
archived/1234-foo-feature
Change-Id: Icb74cc68781cda21a70c802bd640543e92ae97a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116723
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Remove unused functions, and use scm.GIT where possible to reduce
duplication.
Change-Id: I24f05e7b3ae04743e97b6665ee668f44d6acc294
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116938
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
gclient_utils.AskForData will use raw_input on Python 2 and input on Python 3.
Bug: 1063976
Change-Id: I93c059c4e4454d01787716b5a0a2641ad5253f53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116370
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>