summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* docs: add deprecated branch bannerHEADmasterMike Frysinger2024-01-049-0/+27
| | | | | | | | | | The master branch is dead. Add banners to all the docs in case people try referring to these and don't realize they're on the wrong branch. Change-Id: I3488d0d96df25fafd7285848fe9f519b4205519c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/400918 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
* manifest_xml: correct project revisionId for extend-projectMiguel Gaio2020-11-121-1/+5
| | | | | | | | | | | | | | | | Using sha1 manifest, project's revisionId is initialized first by the manifest. An update of a projet revision by extend-project node does not apply to the revisionId which is therefore kept to the initial value. Resets revisionId value when revision is updated by an extend-project node. Change-Id: I873af283890cebaeaabde966f04b125642af929f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/275715 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Miguel Gaio <miguel.gaio@renault.com>
* Move RepoHook class from project.py file to dedicated fileRemy Bohmer2020-11-035-443/+493
| | | | | | | | | | | | The project.py file is huge and contains multiple classes. By moving it to seperate class files the code becomes more readable and maintainable. Signed-off-by: Remy Bohmer <github@bohmer.net> Change-Id: Ida9d99d31751d627ae1ea0373418080696d2e14b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/281293 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Remy Bohmer <linux@bohmer.net>
* launcher: simplify .repo search ceiling checkJonathan Nieder2020-11-031-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the .repo discovery loop while curdir != '/' and curdir != olddir: ... break if we found .repo ... olddir = curdir curdir = os.path.dirname(curdir) the "while" condition is meant to avoid searching forever if we do not find .repo before reaching the top-level directory of the filesystem. For that purpose, the first half of the condition is redundant; once we reach "/", the parent directory will be "/" again and the curdir != olddir check would suffice to terminate the search. Simplify by removing the redundant first half of the check. Noticed by code inspection. The first half of the check was retained when introducing the second half in df14a70c ("Make path references OS independent", 2011-01-09), in an excess of caution. This also improves consistency a little: if I start with curdir = '/home/me', then with the redundant check in place we search /home/me /home before hitting / and giving up. On Windows, if I start with 'c:/users/me', then we search c:/users/me c:/users c:/ before hitting a repetition and giving up. Fortunately it is not common for people to set up repo clients at the top level of filesystems, but consistently following the latter behavior should make debugging a little easier in case it comes up. Link: https://gerrit-review.googlesource.com/id/Ib9e830e3b9adfb1c4e56f3bcfba4746c401fb84f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/286002 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Jonathan Nieder <jrn@google.com>
* init: use the remote default manifest branchMike Frysinger2020-09-092-11/+36
| | | | | | | | | | | | | | | | Instead of hardcoding "master" as our default, use the remote server's default branch instead. For most people, this should be the same as "master" already. For projects moving to "main", it means we'll use the new name automatically rather than forcing people to use -b main. For repositories that never set up a default HEAD, we should still use the historical "master" default. Bug: https://crbug.com/gerrit/13339 Change-Id: I4117c81a760c9495f98dbb1111a3e6c127f45eba Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/280799 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* status: Use multiprocessing for `repo status -j<num>` instead of threadingKimiyuki Onaka2020-09-092-33/+22
| | | | | | | | | | | | | This change increases the speed of the command with parallelization with processes. The parallelization with threads doesn't work well, and increasing the number of jobs to many (8 threads ~) didn't increase the speed. Possibly, the global interpreter lock of Python affects. Bug: https://crbug.com/gerrit/12389 Change-Id: Icbe5df8ba037dd91422b96f4e43708068d7be924 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/279936 Tested-by: Kimiyuki Onaka <kimiyuki@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* manifest: drop support for local_manifest.xmlMike Frysinger2020-09-083-18/+8
| | | | | | | | | | We deprecated this 8 years ago. Time to drop it to simplify the code as it'll help with refactoring in this module to not migrate it. Change-Id: I2deae5496d1f66a4491408fcdc95cd527062f8b6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/280798 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Michael Mortensen <mmortensen@google.com>
* stop testing Python 2.7v2.9Mike Frysinger2020-09-062-11/+2
| | | | | | | | | | | A recent change broke `repo version` on Python 2.7. Rather than fix it, lets drop Python 2.7 support so it can slowly rot. Bug: https://crbug.com/gerrit/10418 Change-Id: I5c6e3d18e4a193b0a978062c23f7cea392e95d0f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259155 Reviewed-by: David Pursehouse <david.pursehouse@gmail.com> Tested-by: Mike Frysinger <vapier@google.com>
* init: reject unknown argsMike Frysinger2020-09-023-0/+95
| | | | | | | | | | | If you pass args to `repo init` when first creating a checkout, the repo launcher throws an error. But the init subcommand that runs in an existing checkout silently ignores them. Throw a proper error. Change-Id: I433bfcc73902d25f6b6a2974e77f6a977a75ed16 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/279696 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Fix Git base version for worktreeconfig extensionAdrien Bioteau2020-07-301-1/+1
| | | | | | | | | worktreeconfig extension only appears with version Git 2.20.0 Change-Id: I3ea8b7d9f8a1f7953e536edd77b09cbc4f8f3158 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/276700 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Adrien Bioteau <adrien.bioteau@gmail.com>
* upload: exit non-zero when preupload hooks failMike Frysinger2020-07-251-1/+1
| | | | | | | | Bug: https://crbug.com/gerrit/13159 Change-Id: Id140b619242c841223c6bc5d4aa0c37a7ce0219d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/276294 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* release-process: document schedule (including freezes) publiclyMike Frysinger2020-07-232-5/+33
| | | | | | | Change-Id: Ic037b54630017740d7859292b32b8c57f4af7854 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/274772 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* subcmds/sync.py: Fix typo in helpRoger Shimizu2020-06-061-1/+1
| | | | | | | | Change-Id: I70b63477241284249e395b8b0a220cb6f44f836b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/270183 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai> Tested-by: David Pursehouse <dpursehouse@digital.ai>
* manifest: normalize name & path when constructing fs pathsMike Frysinger2020-05-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the manifest uses a trailing slash on the name attribute, repo will construct bad internal filesystem paths which confuses tools later on. For example, this manifest entry: <project name="aosp/platform/system/libhidl/" ... will cause repo to use paths like: .repo/project-objects/aosp/platform/system/libhidl/.git/ when it really should be using: .repo/project-objects/aosp/platform/system/libhidl.git Apply the normalization when we construct the local filesystem paths as we cannot guarantee that the remote URL constructed from these will behave the same. A server might really want: https://example.com/aosp/platform/system/libhidl/ and would throw an error if we instead tried to fetch: https://example.com/aosp/platform/system/libhidl Unfortunately, any existing repo client checkouts that use such a manifest will hit a one-time sync error as the internal git location has changed. I'm not sure there's a way to cleanly migrate that. Bug: https://crbug.com/1086043 Change-Id: I30bea0ffd23e478de89a035f408055e48a102658 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268742 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
* sync: fix duplicate word in descriptionMike Frysinger2020-05-241-1/+1
| | | | | | | | Bug: https://crbug.com/gerrit/12814 Change-Id: Id722eec9a59dded588f13bc605ce2c94b4047265 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268739 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
* launcher: fix version to latestv2.8Mike Frysinger2020-05-211-1/+1
| | | | | | | | | | We've already released 2.7, and the next tag is 2.8, so this should be pulled up to 2.8 so it'll stay in sync. Change-Id: Id47bdbdb8050b29ea36442ac2149dd948648237f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268572 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
* launcher: bump version for cli changesMike Frysinger2020-05-211-1/+1
| | | | | | | | Change-Id: I9b2194df0c1af3bc5b42115a25992747368a7383 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268532 Reviewed-by: Xin Li <delphij@google.com> Tested-by: Xin Li <delphij@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Make partial clone imply no-clone-bundle by default.Xin Li2020-05-215-6/+31
| | | | | | | | | | | | | | | | | | For large projects, clone bundle is useful because it provided a way to efficiently transfer a large portion of git objects through CDN, without needing to interact with git server. However, with partial clones, the intention is to not download most of the objects, so the use of clone bundles would defeat the space savings normally seen with partial clones, as they are downloaded before the first fetch. A new option, --clone-bundle is added to override this behavior. Add a new repo.clonebundle variable which remembers the choice if explicitly given from command line at repo init. Change-Id: I03638474af303a82af34579e16cd4700690b5f43 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268452 Tested-by: Xin Li <delphij@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* Fix how we format the full destination branch when uploading.Sean McAllister2020-05-191-1/+5
| | | | | | | | | | | | | | | | If the dest-branch attribute is set in the project manifest, then we need to push to that branch. Previously, we would unconditionally pre-pend the refs/heads prefix to it. The dest-branch attribute is allowed to be a ref expression though, so it may already have it. Simple fix is to check if it already has the prefix before adding it. Bug: crbug.com/gerrit/12770 Change-Id: I45d6107ed6cf305cf223023b0ddad4278f7f4146 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/268152 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Sean McAllister <smcallis@google.com>
* repo info findRemoteLocalDiff use short branchDaniel Kutik2020-05-121-2/+5
| | | | | | | | | | | | | When running repo info -d an error would be thrown saying: fatal: bad revision 'refs/remotes/m/refs/heads/master..' Using the short branch name here instead, like 'refs/remotes/m/master..' resolves this issue. Signed-off-by: Daniel Kutik <daniel.kutik@lavawerk.com> Change-Id: I50ea92c45c011b2c3e3a63803decb88e7837a380 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/266578 Reviewed-by: Mike Frysinger <vapier@google.com>
* project.py: Fix check for wild cardsv2.7Angel Petkov2020-05-051-3/+3
| | | | | | | | | | | | | | The intention of the check is to verify whether the target file name contains a wild card. The code, however, assumes that if the file is non-existent - it contains a wild card. This has the side effect that a target file that does not exist at the moment of the check is considered to contain a wild card, this leads itself to softlink not being created. Change-Id: I4e4cd7b5e1b8ce2e4b2edc9abf5a1147cd86242f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/265736 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Angel Petkov <apetkov86@gmail.com>
* Parse included files when reading git config filesUlrik Laurén2020-04-291-1/+1
| | | | | | | | | | | | | Git config files may have an include tag pointing to another file. The included file is not parsed unless “git config --list” is explicitly told to follow includes by adding the argument ”--includes”. This change add the "--includes" when parsing the global gitconfig file. Change-Id: I892c9a3a748754c1eb8c9e220578305ca5850dd5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/264759 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Ulrik Laurén <ulrik.lauren@gmail.com>
* repo: exit on missing entry pointKonrad Weihmann2020-04-281-0/+4
| | | | | | | | | | | | | | exit if no repo_main can be found right before executing the command. This happens for instance when 'repo init' is run on root path (for example in a container). Without this counter measure the tool will crash at exec_command with TypeError: sequence item 1: expected str instance, NoneType found Change-Id: Ia8480cfe2151c3b35c9572789ad8cb619288cce1 Signed-off-by: Konrad Weihmann <kweihmann@outlook.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263457 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
* main: re-exec self with the current interpMike Frysinger2020-04-281-1/+1
| | | | | | | | | | | | The launcher already raised itself up to use Python 3 on the fly, and the main.py script uses a plain `python` shebang. So make sure we use the active interpreter when re-execing ourselves to avoid falling back down to Python 2 (which then triggers warnings). Change-Id: Ic53c07dead3bc9233e4089a0a422f83bb5ac2f91 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263272 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
* When writing manifest, set the dest-branch attribute for projectsSean McAllister2020-04-202-3/+17
| | | | | | | | | | | | | | When generating a revision locked manifest, we need to know what ref to push changes to when doing 'repo upload'. This information is lost when we lock the revision attribute to a particular commit hash, so we need to expose it through the dest-branch attribute. Bug: https://crbug.com/1005103 Test: manual execution Change-Id: Ib31fd77ad8c9379759c4181dac1ea97de43eec35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263572 Tested-by: Sean McAllister <smcallis@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Expose upstream and dest-branch attributes through environmentSean McAllister2020-04-162-0/+9
| | | | | | | | | | | | | | | | | | | | | | Recent changes in ChromeOS Infra to ensure we're reading from snapshot manifests properly have exposed several bugs in our assumptions about manifest files. Mainly that the revision field for a project does _not_ have to refer to a ref, it can just be a commit hash. Several places assume that the revision field can be parsed as a ref to get the branch the project is on, which isn't true. To fix this we need to be able to look at the upstream and dest-branch attributes of the repo, so we expose them through the environment variables set in `repo forall`. Test: manual 'repo forall' run Bug: https://crbug.com/1032441 Change-Id: I2c039e0f4b2e0f430602932e91b782edb6f9b1ed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263132 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Sean McAllister <smcallis@google.com>
* project.py: Remove extraneous ','v2.6George Engelbrecht2020-04-151-1/+1
| | | | | | | | | | Bug: https://crbug.com/1061473 Change-Id: I0f02f122d6313679c1ae5ad6fb4e05f68b764186 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263112 Tested-by: George Engelbrecht <engeg@google.com> Reviewed-by: George Engelbrecht <engeg@google.com> Reviewed-by: SPA SARC <spanc.sarc@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Revert "commit-msg: Insert Change-Id at start of trailers"Mike Frysinger2020-04-151-1/+1
| | | | | | | | | | | | | | This reverts commit 653f8b711be3344e8c617512629270661b24fa86. Reason for revert: This requires git-2.15 which is much newer than repo itself requires. Lets pull it until we can figure out something on the Gerrit side. Bug: https://crbug.com/gerrit/12546 Change-Id: I5148f8a9cab5f0c305c020e31627b4af88cd5c95 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263012 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* project: have clone.bundle failures print better diagnosticsGeorge Engelbrecht2020-04-151-1/+3
| | | | | | | | | Bug: https://crbug.com/1061473 Change-Id: If066dc56ca575720bfb25c1a9892dbd6f4af15c6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261852 Tested-by: George Engelbrecht <engeg@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Use hash for ControlPath instead of full variablesAnders Björklund2020-04-152-1/+62
| | | | | | | | | | | | | | | | | The generated socket path can be too long, if your FQDN is very long... Typical error message from ssh client: unix_listener: path "/tmp/ssh-fqduawon/master-USER@HOST:PORT.qfCZ51OAZgTzVLbg" too long for Unix domain socket Use a hashed version instead, to keep within the socket file path limit. This requires OpenSSH_6.7p1, or later. Change-Id: Ia4bb9ae8aac6c4ee31d5a458f917f3753f40001b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/255632 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Anders Björklund <anders.bjorklund.2@volvocars.com>
* forall.py: Close file after removing the streamKarsten Pfeiffer-Raddatz2020-04-141-1/+1
| | | | | | | | | | | | In order to remove the stream fileno() will be called on the filedescriptor. If the file is already closed fileno() will raise an error and forall will fail. Bug: https://crbug.com/gerrit/12563 Change-Id: Ib7b895fe881c844e3eb3672b011fdcdbdae63024 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/262838 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Karsten Pfeiffer-Raddatz <raddatz.karsten@gmail.com>
* tests: fix SetupGnuPG testMarcos Marado2020-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | The SetupGnuPG test tries to test the full setup, including the creation of the directories. In order to do that, it create a temporary directory, and redefines the home_dot_repo to point there. When a home_dot_repo directory does not exist, it should be created. The gpg_dir, which should exist inside home_dot_repo, also needs to be created if it does not exist. However, since the gpg_dir path is relative to home_dot_repo, once we redefine one, we need to redifine the other. The failure of this test might have gone unnoticed so far, since in only fails if you do not have a ~/.repoconfig/gnupg/ on the environment you are running the tests on. Change-Id: Ic69d59e56137eea43349a61b5cf81f215c6a7f9a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/262573 Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Marcos Marado <mindboosternoori@gmail.com>
* commit-msg: Insert Change-Id at start of trailersDavid Pursehouse2020-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | In older versions of Gerrit the Change-Id field was inserted at the start of the trailers. Commit 68296f71804feab2e0ae18ae33f834a8a41621e4 simplified the trailers code by using git trailers instead of custom code but now inserts Change-Id at the end of the trailers section. A consequence of this is that folks who sign-off their commits using `git commit -s` now has the sign-off appear first followed by Change-Id. If the user then runs `git commit -s --amend` to update the change because the Sign-off-by line is not last, git inserts a 2nd duplicate Signed-off-by line. This patch simply restores the previous behaviour of the Gerrit commit-msg hook where Change-Id would be inserted before the Sign-off-by line to avoid this issue. Backported from [1] by Thanh Ha. [1] https://gerrit-review.googlesource.com/c/gerrit/+/262072 Bug: https://crbug.com/12546 Change-Id: I1406c763a3935761247f6771f55e02367f698e6e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/262352 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* sync: add retry to fetch operationsGeorge Engelbrecht2020-04-022-9/+46
| | | | | | | | | | | | | Add retries with exponential backoff and jitter to the fetch operations. By default don't change behavior and enable behind the new flag '--fetch-retries'. Bug: https://crbug.com/1061473 Change-Id: I492710843985d00f81cbe3402dc56f2d21a45b35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261576 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: George Engelbrecht <engeg@google.com>
* version: include tag commit date for easy referenceMike Frysinger2020-03-311-0/+1
| | | | | | | | | | This is more for users trying to get a sense of how old/new their current version of repo is when debugging issues. Change-Id: Ifb413c679bb8c8dbf4f9334137adf086bb000a68 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/261192 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* launcher: bump version for accumulated fixesv2.5Mike Frysinger2020-03-251-1/+1
| | | | | | | Change-Id: I45da9facb525355c4963735e087d87024dea2017 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/260232 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* launcher: avoid crash when executing out of checkoutMike Frysinger2020-03-251-6/+12
| | | | | | | | | | | | | When developing repo itself, it helps to run repo directly out of it and to run bisection tools. The current _SetDefaultsTo logic fails in that situation though as it wants a branch, but the source isn't checked out to one. Now that we support tracking commits via the --repo-rev setting, fall back to using the current HEAD commit. Change-Id: I37d79fd9f7bea87d212421ebed6c8267ec95145f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/260192 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* version: fix running under Python 2Mike Frysinger2020-03-252-6/+14
| | | | | | | | | This gets the unittests passing again for now. Change-Id: Ibed430a305bc26b907ad0ea424c7eec7de37e942 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259994 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* init: respect --repo-rev changesMike Frysinger2020-03-253-22/+195
| | | | | | | | | | | | | | We respect this option when running the first `repo init`, but then silently ignore it once the initial sync is done. Make sure users are able to change things on the fly. We refactor the wrapper API to allow reuse between the two init's. Bug: https://crbug.com/gerrit/11045 Change-Id: Icb89a8cddca32f39a760a6283152457810b2392d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/260032 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* init: allow REPO_REV/--repo-rev to specify commits/tagsMike Frysinger2020-03-242-23/+167
| | | | | | | | | | | | | | While the help/usage suggested that revisions would work, they never actually did, and just throw confusing errors. Now that we warn if the checkout isn't tracking a branch, allow people to specify commits or tags explicitly. Hopefully our nags will be sufficient to keep most people on the right path. Bug: https://crbug.com/gerrit/11045 Change-Id: I6ea32c677912185f55ab20faaa23c6c0a4c483b3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259492 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* tests: add more wrapper unittestsMike Frysinger2020-03-242-1/+90
| | | | | | | Change-Id: Ic6b4eb96b871793bc9463c9047674cf3cfbe4b5e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259993 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Jonathan Nieder <jrn@google.com>
* download: add a --branch optionMike Frysinger2020-03-231-1/+11
| | | | | | | | | | | This allows people to quickly create new branches when pulling down changes rather than having to juggle the git calls themselves. Bug: https://crbug.com/gerrit/11609 Change-Id: Ie6a4d05e9f4e9347fe7f7119c768e6446563ae65 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259855 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* download: unify error handling with sub git callsMike Frysinger2020-03-231-11/+21
| | | | | | | | | | | | We gracefully handle cherry-pick errors, but none of the others which means people get confusing Python tracebacks. Move the main logic in a single GitError try block so we can show pretty error messages for all of them. Change-Id: I52cdf6468d21a98de7f65b86d5267b3caabd5af8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259854 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* download: support -x when cherry-pickingMike Frysinger2020-03-232-2/+15
| | | | | | | | | | | This is a pretty common option for people to want too use, so include it as a pass-thru option when cherry-picking. Bug: https://crbug.com/gerrit/9418 Change-Id: I2a24c1ed7544541719caa4d3c0574347a151a1b0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259853 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* download: support --ff when cherry-pickingMike Frysinger2020-03-232-2/+4
| | | | | | | | | | | The git cherry-pick already supports this, so plumb the existing repo option down. Otherwise it's confusing when people use -c --ff and it doesn't use that behavior. Change-Id: Id68932ffa09204bb30b92a21aff185c00394a520 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259852 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* init: rename --repo-branch to --repo-revMike Frysinger2020-03-185-10/+13
| | | | | | | | | | | | We refer to this as "revision" in help text, and in REPO_REV envvar, so rename to --repo-rev to be consistent. We keep --repo-branch for backwards compatibility, but as a hidden option. Bug: https://crbug.com/gerrit/11045 Change-Id: I1ecc282fba32917ed78a63850360c08469db849a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259352 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* launcher: init: stop passing --repo-url/--repo-branch downMike Frysinger2020-03-171-12/+2
| | | | | | | | | | | | | | | | | | | | | When the launcher handles the init subcommand, it takes care of setting the repo url & branch itself when cloning. So we don't need to pass them down to the checked out init subcommand. Further, the init subcommand has never actually done anything with those options, so there's no point in passing them. We'll be changing the latter behavior so that init will reset the url/branch when specified with an existing repo checkout which means passing them through adds overhead: the launcher will checkout to the right value, then chain to the sub-init which will then reset the checkout to the same value. Bug: https://crbug.com/gerrit/11045 Change-Id: Ia2a4ab9d86febc470aea4abd73d75bb10e848b56 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259312 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* init: respect --repo-url changesMike Frysinger2020-03-171-0/+8
| | | | | | | | | | | | We respect this option when running the first `repo init`, but then silently ignore it once the initial sync is done. Make sure users are able to change things on the fly. Bug: https://crbug.com/gerrit/11045 Change-Id: I129ec5fec43a85067d555bb60c0d1ae02465f139 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258893 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* sync: warn if not tracking a branchMike Frysinger2020-03-171-0/+7
| | | | | | | | | | | Since tracking a branch prevents repo from updating, make sure we warn people about the situation when using `repo sync`. Bug: https://crbug.com/gerrit/11045 Change-Id: I966513f510827cc93194f8df176c6745946bd739 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/258892 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* subcmds: stop instantiating at import timeMike Frysinger2020-03-174-8/+9
| | | | | | | | | | | | | | | | | | The current subcmds design has singletons in all_commands. This isn't exactly unusual, but the fact that our main & help subcommand will then attach members to the classes before invoking them is. This makes it hard to keep track of what members a command has access to, and the two code paths (main & help) attach different members depending on what APIs they then invoke. Lets pull this back a step by storing classes in all_commands and leave the instantiation step to when they're used. This doesn't fully clean up the confusion, but gets us closer. Change-Id: I6a768ff97fe541e6f3228358dba04ed66c4b070a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/259154 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>