summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* Add PyCharm project directory into the .gitignoreRostislav Krasny2020-01-241-0/+3
| | | | | | | Change-Id: I9a785a9d045e44c6ec8bd4bd8d0169a81d5ccfde Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/251835 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Rostislav Krasny <rostigm@gmail.com>
* Make _preserve_encoding in platform_utils_win32 compatible with Python 3Rostislav Krasny2020-01-241-0/+5
| | | | | | | | Bug: https://crbug.com/gerrit/12145 Change-Id: I01d1ef96ff7b474f55ed42ecc13bd5943006d3b5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/251833 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Rostislav Krasny <rostigm@gmail.com>
* repo: Do not even try to set up GPG with opt.no_repo_verifySebastian Schuberth2020-01-241-4/+7
| | | | | | | | | | | | | | In order to be able to use "--no-repo-verify" to work around an issue with gpg-agent and long socket paths (see e.g. [1]), this change avoids GPG being set up at all if that option is passed. [1] https://github.com/elastic/elasticsearch/issues/17053 Change-Id: I1e5cbd8be2dc0084f12afe0ca33c789fdbc6fef9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/251108 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: Add '-c' as an alias to '--current-branch'Diogo Ferreira2020-01-241-1/+1
| | | | | | | | | | | This makes it consistent with the short option for current-branch in repo sync. Change-Id: I2848e87f45a66ef8d829576d0c0c4c0f7a8636a0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/241700 Tested-by: Diogo Ferreira <deovferreira@gmail.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* info: Add the manifest revisionDiogo Ferreira2020-01-241-0/+4
| | | | | | | | | | | | | | After Ib546f5ebbc8a23875fbd14bf166fbe95b7dd244e, repo info now displays the current project revision in the 'Current revision' field. While the output is more consistent, there are use cases for the revision expression as shown in the manifest. This patch re-adds the manifest revision as a new 'Manifest revision' field. Change-Id: I50c1559dcb7ceb69af07352b956d78f85b8f592e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/240799 Tested-by: Diogo Ferreira <deovferreira@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Port _FileDescriptorStreamsNonBlocking to use poll()Theodore Dubois2019-12-181-3/+15
| | | | | | | | | | | select() has a limit of FD_SETSIZE file descriptors. If you run repo sync -j500 you'll pretty quickly hit this limit and get "file descriptor out of range for select" errors. poll() has no such limit. Change-Id: I21f350e472bda1db03dcbcc437645c23dbc7a901 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/248852 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Theodore Dubois <tbodt@google.com>
* repo: include subcommands in --help outputMike Frysinger2019-12-051-2/+13
| | | | | | | | | | Also point people to `repo help` so it's easier to navigate the tool. Bug: https://crbug.com/gerrit/12022 Change-Id: Ib3be331a2cef32caa193640bf8d54bd1443fce60 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247292 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* docs: add Windows support infoMike Frysinger2019-12-052-0/+145
| | | | | | | Change-Id: I82a1bec3a29d622c76b5709b96bbe8bff8aa427f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247573 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* help: unify command displayMike Frysinger2019-12-031-17/+9
| | | | | | | | | No functional changes, just unifying duplicate code paths. Change-Id: I6afa797ca1e1eb90abdc0236325003ae070cbfb3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247293 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* tox: add & document tox usageMike Frysinger2019-12-023-3/+55
| | | | | | | | | | This makes it easy to run all the tests against multiple versions of Python. We want to make sure Python 2.7 & 3.6+ work. Change-Id: Ia7b16eb46a2aa7c240f03bb291987fa8cb215267 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247174 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* setup.py: add basic packaging filesMike Frysinger2019-12-024-0/+72
| | | | | | | | | | This is needed to use tox, and tox lets us test multiple Python versions easily. Change-Id: I813c418a8f7109294a4adb9f6b21be459cbeca70 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247173 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* run_tests: improve exit code behaviorMike Frysinger2019-12-021-3/+2
| | | | | | | | | | Rather than throw an exception when pytest itself exits non-zero, pass that back up. The traceback is never useful, only confusing. Change-Id: I0cd7bea730e13c9969154326057196295e550843 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/247175 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Fix repo mirror with --current-branchKuang-che Wu2019-11-251-23/+28
| | | | | | | | | | | | | | | | | | | | | | Before a2cd6aeae8, "repo mirror with --current-branch" fetches git data using command git fetch --progress --update-head-ok cros --tags No refspec is specified, thus it fetches default refspec, which is +refs/heads/*:refs/heads/* After a2cd6aeae8, the fetch command became git fetch --progress --update-head-ok cros --tags +refs/tags/*:refs/tags/* It did not only add tags refspec, but also suppressed the fetching of default refspec. In other words, repo mirrors doesn't work if current_branch_only=True. This CL explicitly adds the default refspec to command line if none is specified. Bug: https://crbug.com/gerrit/11990 Change-Id: Iadcf7b9aa50f53c47132cfe6c53b3fb2076ebca2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/246632 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Kuang-che Wu <kcwu@chromium.org>
* README: add install detailsv1.13.8Mike Frysinger2019-11-181-0/+19
| | | | | | | Change-Id: I57043449a7927068fa5735cb71633353e1039532 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/245816 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* upload/editor: fix bytes/string confusionMike Frysinger2019-11-163-12/+70
| | | | | | | | | | | | | | | | The upload module tries to turn the strings into bytes before passing to EditString, but it combines bytes & strings causing an error. The return value might be bytes or string, but the caller only expects a string. Lets simplify this by sticking to strings everywhere and have EditString take care of converting to/from bytes when reading/writing the underlying files. This also avoids possible locale confusion when reading the file by forcing UTF-8 everywhere. Bug: https://crbug.com/gerrit/11929 Change-Id: I07b146170c5e8b5b0500a2c79e4213cd12140a96 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/245621 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* prune: handle branches that track missing branchesMike Frysinger2019-11-163-12/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | Series of steps: * Create a local "b1" branch with `repo start b1` that tracks a remote branch (totally fine) * Manually create a local "b2" branch with `git branch --track b1 b2` that tracks the local "b1" (uh-oh...) * Delete the local "b1" branch manually or via `repo prune` (....) * Try to process the "b2" branch with `repo prune` Since b2 tracks a branch that no longer exists, everything blows up at this point as we try to probe the non-existent ref. Instead, we should flag this as unknown and leave it up to the user to resolve. This probably could come up if a local branch was tracking a remote branch that was deleted from the server, and users ran something like `repo sync --prune` which cleaned up the remote refs. Bug: https://crbug.com/gerrit/11485 Change-Id: I6b6b6041943944b8efa6e2ad0b8b10f13a75a5c2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236793 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Kirtika Ruchandani <kirtika@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* sync: try to fast forward merge branches before checking published stateMike Frysinger2019-11-131-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | If the local branch changed state since its last upload, the data cached in .git/config related to the last uploaded CL might not be that relevant. If we're able to fast forward merge to the latest tree state, then let's do that. This would be akin to checking out a detached head before syncing where we already switch state. If we aren't able to fast forward merge, then it's not a big deal as we'll continue on to the existing branch checking logic. This would be easy to reproduce by doing something like: $ repo start foo . $ git revert HEAD $ repo upload --cbr . $ git reset --hard HEAD^ <CL is merged> $ repo sync . <we can fast forward> Change-Id: I7d62f3d1ba5314a349d85b4dbb0ec8352eca18bb Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238552 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Michael Mortensen <mmortensen@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: merge project updates with status barMike Frysinger2019-11-122-13/+7
| | | | | | | | | | | | | | The current sync output displays "Fetching project" and "Checking out project" messages and progress bar updates independently leading to a lot of spam. Lets merge these periodic outputs with the status bar to get a little bit tighter output in the normal case. This doesn't solve all our problems, but gets us closer. Bug: https://crbug.com/gerrit/11293 Change-Id: Icd627830af4dd934a9355b7ace754b56dc96cfef Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244934 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: add sanity check for local checkouts missing networkMike Frysinger2019-11-121-0/+7
| | | | | | | | | | | If you run `repo sync -l foo` without first `repo sync -n foo`, repo sets up an invalid gitdir tree that gets wedged and requires manual recovery. Add a sanity check to abort cleanly first. Change-Id: Iad865ea860a3f1fd2f39ce683fe66bd4380745a5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244732 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: report list of failing git treesVadim Bendebury2019-11-121-2/+11
| | | | | | | | | | | | | | | | | | When repo sync fails because some git trees are not in clean state and as such can not be rebased automatically, it is a pain to figure out which trees are the culprits. With this patch the list of offending trees is printed when repo sync reports checkout errors. TEST=ran 'repo sync' and observed the proper list of directories show up after the final error message Bug: https://crbug.com/gerrit/11293 Change-Id: Icdf1a03e9014ecb184f331f513cc9a2efc7d11ed Signed-off-by: Vadim Bendebury <vbendeb@google.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244053 Reviewed-by: Mike Frysinger <vapier@google.com>
* use open context managers in more placesMike Frysinger2019-11-127-66/+21
| | | | | | | | | | Use open() as a context manager to simplify the close logic and make the code easier to read & understand. This is also more Pythonic. Change-Id: I579d03cca86f99b2c6c6a1f557f6e5704e2515a7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244734 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: make .git init more robustMike Frysinger2019-11-122-34/+39
| | | | | | | | | | | | | | | | Hitting Ctrl-C in the middle of this func will leave the .git in a bad state that requires manual recovery. The code tries to catch all exceptions and recover by deleting the incomplete .git dir, but it omits KeyboardInterrupt which Exception misses. We could add that to the recovery path, but we can make this more robust with a different approach: set up everything in .git.tmp/ and only move it to .git/ once we've fully initialized it. Change-Id: I0f5b97f2e19fc39cffc3e5e23993a2da7220f4e3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244733 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* forall: add an --ignore-missing optionv1.13.7.1Mike Frysinger2019-10-221-0/+7
| | | | | | | | | | | | | | | In CrOS, our infra has to deal with partial checkouts constantly (for a variety of reasons). To help reset back to a good state, we run git commands via `repo forall`, but don't care about the missing checkouts. Add a flag so we can disambiguate between missing repos and failing git subcommands. Bug: https://crbug.com/1013377 Bug: https://crbug.com/1013623 Change-Id: Ie3498c6d111276c60d2ecedbba21bfa778588d50 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/241935 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* python-support: adjust major versionsMike Frysinger2019-10-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The plan previously documented was <=1.13.x is Python 2 and >=1.14.x is Python 3. Other projects that migrated Python versions and drop support for older have tended to take a more drastic version jump to make it clearer to users. So lets adjust the plan to say <=1.x will support Python 2, and >=2.x will be Python 3-only. This also allows us to harmonize the repo launcher version. It is currently sitting at v1.26 and has been incremented independently of the repo version for the life of the project. While we might know these lower nuances, pretty much no one else does and it just leads to confusion: do I know version 1.26 or version 1.13.7? Or do I have both? What does that even mean? Once we update the major version to 2.0.0, we can also adjust the launcher script to 2.0.0, and then the launcher release process will be tied to a new repo release in general. Bug: https://crbug.com/gerrit/10418 Change-Id: Idb2257371a06e56d2923cf717345c028f49176a2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/240372 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* command: filter projects by active manifest groupsv1.13.7Mike Frysinger2019-10-081-2/+5
| | | | | | | | | | | | | | | | | | | `repo forall <proj>` will look up all <proj> in the manifest for all manifest groups regardless of which are active. If <proj> is checked out to different locations depending on the group, this ultimately fails as we're unable to locate all of them. Simple fix is to only include projects that match the manifest groups that we already passed down & initialized to the active set, and that we already use when getting the default project list. Bug: https://crbug.com/gerrit/11677 Bug: https://crbug.com/1011226 Change-Id: I975f10f9a9e5a1cad7d87344123f8003732dab27 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239652 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* info: fix "current" outputMike Frysinger2019-10-051-2/+8
| | | | | | | | | | | | | The "Current revision" field shows the revision as listed in the manifest. I think most users expect this to show the revision that the git tree is checked out to instead. Switch the output to show that revision instead, and add a "Current branch" if it matches a local branch. Change-Id: Ib546f5ebbc8a23875fbd14bf166fbe95b7dd244e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239240 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Only import imp on py2Rashed Abdel-Tawab2019-10-051-1/+1
| | | | | | | | | | | | imp is deprecatedon py3. It's also not used with py3, so just move it to the py2 import block Test: run `repo` command and verify warning is no longer present Test: verify `repo sync` and `repo upload` function as expected Change-Id: I9d59403d7819c4a478c9f54cbef114f8a96486a5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239713 Tested-by: Rashed Abdel-Tawab <rashedabdeltawab@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* project: allow CurrentBranch to return None on errorsMike Frysinger2019-10-011-3/+10
| | | | | | | | | | | If the repo client checkout is in an incomplete sync state, the work git repo might be in a bad way. Turn errors parsing HEAD into None since callers of CurrentBranch already need to account for it. Change-Id: Ia7682e29ef4182006b1fb5f5e57800f8ab67a9f4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239239 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* info: allow NoSuchProjectError to bubble upMike Frysinger2019-10-011-5/+2
| | | | | | | | | | | If the user passes in bad projects like `repo info asdf`, we currently silently swallow those and do nothing. Allow NoSuchProjectError to bubble up to main which will handle & triage this correctly for us. Change-Id: Ie04528e7b7a164293063a636813a73eaabdd5bc3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239238 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* version: add source versions & User-Agents to the outputMike Frysinger2019-10-011-2/+10
| | | | | | | | | | | | | | | | Depending on where/how repo is invoked, the active version might be from a git tree, and it might be different from the .repo/repo.git/ version in the current repo client checkout. Report both if they're different so it's clearer. Lets also include the two different User-Agent's that we set up when talking to networked services. Bug: https://crbug.com/gerrit/11144 Change-Id: I2ebb6e3ac30e374a8406cab3e4438087246a8c57 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239234 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* git_command: set GIT_HTTP_USER_AGENT on all requestsMike Frysinger2019-10-012-0/+21
| | | | | | | | | | | | | | | | | We've been setting the User-Agent header when making connections from repo itself, but not when running git (as the latter will set up User-Agent itself). Our Gerrit/Git admins say it'll be helpful if we pass through the repo version settings even when running git. We currently set GIT_HTTP_USER_AGENT and not GIT_USER_AGENT as it's unclear if the extended form works over all protocols. We can wait for a user request. Bug: https://crbug.com/gerrit/11144 Change-Id: I21d293f49534058dbc23225152451df26c5b7bef Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239233 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* grep: handle errors gracefullyMike Frysinger2019-10-011-7/+23
| | | | | | | | | | | | If `git grep` 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: I31de1134fdcc7aaa9814cf2eb6a67d398eebf9cf Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239237 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* diff: handle errors gracefullyMike Frysinger2019-10-012-6/+18
| | | | | | | | | | | | 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>
* forall: exit 1 if we skip any reposMike Frysinger2019-10-011-3/+3
| | | | | | | | | | If a repo doesn't exist (e.g. an incomplete sync), make sure we exit non-zero when they get skipped. Change-Id: Ifff711e374416b1e6b9b8da4fdc6f14b27ced450 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239235 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* git_command: refactor User-Agent settingsMike Frysinger2019-10-013-57/+95
| | | | | | | | | | | | | | | Convert the RepoUserAgent function into a UserAgent class. This makes it cleaner to hold internal state, and will make it easier to add a separate git User-Agent, although we don't do it here. We make the RepoSourceVersion independent of GitCommand so that it can be called by the class (later). Bug: https://crbug.com/gerrit/11144 Change-Id: Iab4e1f974b8733a36b243b2d03f5085a96effa19 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/239232 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* move UserAgent to git_command for wider userMike Frysinger2019-10-013-45/+62
| | | | | | | | | | | We can't import the main module, so move the UserAgent helper out of it and into the git_command module so it can be used in more places. Bug: https://crbug.com/gerrit/11144 Change-Id: I8093c8a20bd1dc7d612d0e2a85180341817c0d86 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/231057 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* rebase: add basic coloring outputMike Frysinger2019-09-241-3/+20
| | | | | | | | | This uses coloring style like we use in grep/forall already. Change-Id: I317e2e47567a30c513083c48e7c7c40b091bb29a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238555 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* rebase: add --fail-fast supportMike Frysinger2019-09-241-3/+16
| | | | | | | | | | | | Lets switch the default rebase behavior to align with our new sync behavior: we try to rebase all projects by default and exit/summarize things at the very end if there were any errors. Or if people want to exit immediately, they can use the new --fail-fast option. Change-Id: I436ac563f972b45de6ce9ad74da1e4870e584902 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/238553 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: create dedicated manifest project update funcMike Frysinger2019-09-191-24/+28
| | | | | | | | | | | Cut out some more standalone code from Execute to make this func a bit more manageable. The manifest project update is pretty simple and standalone, but still takes up a good chunk of what's left. Change-Id: Idc2442d9def495eccd0a49cda203c44aef16f129 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236614 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* repo: bump wrapper versionMike Frysinger2019-09-181-1/+1
| | | | | | | | | | We've rolled quite a number of fixes since the last update, including a lot of Python 3 improvements. Lets bump the wrapper version for it. Change-Id: I6c6c04c3c8241bf8e8bcf26603549ae4595fede8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/237812 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Fix tag clobbering when -c is used.v1.13.6Xin Li2019-09-161-3/+3
| | | | | | | | Bug: b/140189154 Change-Id: I8861a6115b20c9a3d88ddec5344c75326ae44823 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/237572 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
* sync: improve output with intermingled progress bars and statusMike Frysinger2019-09-132-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When displaying progress bars, we use \r to reset the cursor to the start of the line before showing the new update. This assumes the new line will fully erase whatever was displayed there previously. The "done" codepath tries to handle this by including a few extra spaces at the end of the message to "white out" what was there. Lets replace that hack with the standard ECMA escape sequence that clears the current line completely. This is the CSI "erase in line" sequence that the terminal will use to delete all content. The \r is still needed to move the cursor to the start of the line. Using this sequence should be OK since we're already assuming the terminal is ECMA compliant with our use of coloring sequences. We also put the \r after the CSI sequence on the off chance the terminal can't process it and displays a few bytes of garbage. The other improvement is to the syncbuffer API. When it dumps its status information, it almost always comes after a progress bar update which leads to confusing comingled output. Something like: Fetching projects: 100% (2/2) error: src/platform2/: branch ... Since the progress bar is "throw away", have the syncbuffer reset the current output to the start of the line before showing whatever messages it has queued. Bug: https://crbug.com/gerrit/11293 Change-Id: I6544d073fe993d98ee7e91fca5e501ba5fecfe4c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236615 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* repo: decode/encode all the subprocess streamsMike Frysinger2019-09-121-5/+6
| | | | | | | | | | | | | We use subprocess a lot in the wrapper, but we don't always read or write the streams directly. When we do, make sure we convert to/from bytes before trying to use the content. Change-Id: I318bcc8e7427998348e359f60c3b49e151ffbdae Reported-by: Michael Scott <mike@foundries.io> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236612 Reviewed-by: Michael Scott <mike@foundries.io> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Michael Scott <mike@foundries.io>
* sync: create dedicated smart sync funcMike Frysinger2019-09-111-96/+100
| | | | | | | | | | | | The smart sync logic takes up about 45% of the overall Execute func and is about 100 lines of code. The only effect it has on the rest of the code is to set the manifest_name variable. Since this func is already quite huge, split the smart sync logic out. Change-Id: Id861849b0011ab47387d74e92c2ac15afcc938ba Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234835 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* repo: fix unused variable usageMike Frysinger2019-09-111-1/+1
| | | | | | | | | | | The refactoring here left behind a variable reference that no longer exists. Clean it up. Bug: https://crbug.com/gerrit/11144 Change-Id: Ifdb7918b37864c48f3deef27c8bae3f793275d35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236613 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Add repo start option to create the branch based off HEADTheodore Dubois2019-09-042-3/+12
| | | | | | | | | | | | This makes it way easier to recover from forgetting to run repo start before committing: just run `repo start -b new-branch`, instead of all that tedious mucking around with reflogs. Change-Id: I56d49dce5d027e28fbba0507ac10cd763ccfc36d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/232712 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* sync: fix deprecated command line option -fv1.13.5.1Stefan Müller-Klieser2019-08-301-0/+1
| | | | | | | | | | | | | | | | | In commit d9e5cf0e ("sync: invert --force-broken with --fail-fast") the force-broken option has been deprecated. Accidentally the option has been changed from Boolean to Value. This breaks all users of repo with: main.py: error: -f option requires an argument This is easy to avoid by keeping the type. Signed-off-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de> Change-Id: Ia8b589cf41ac756d10c61e17ec8d76ba8f7031f9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/235043 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* split out cli validation from executionv1.13.5Mike Frysinger2019-08-2812-52/+55
| | | | | | | | | | | | | | | | | | | A common pattern in our subcommands is to verify the arguments & options before executing things. For some subcommands, that check stage is quite long which makes the execution function even bigger. Lets split that logic out of the execute phase so it's easier to manage these. This is most noticeable in the sync subcommand whose Execute func is quite large, and the option checking makes up ~15% of it. The manifest command's Execute can be simplified significantly as the optparse configuration always sets output_file to a string. Change-Id: I7097847ff040e831345e63de6b467ee17609990e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234834 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* add a --trace-python optionMike Frysinger2019-08-271-3/+20
| | | | | | | | | | This can help debug issues by tracing all the repo python code with the standard trace module. Change-Id: Ibb7f4496ab6c7f9e130238ddf3a07c831952697a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234833 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* rename local trace moduleMike Frysinger2019-08-277-11/+15
| | | | | | | | | | There is a standard Python "trace" module, so having a local trace.py prevents us being able to import that. Rename the module to avoid. Change-Id: I23e29ec95a2204bb168a641323d05e76968d9b57 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234832 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>