summaryrefslogtreecommitdiffstats
path: root/bin/git_gpush.pm
Commit message (Collapse)AuthorAgeFilesLines
* gpush/gpick: fix a few typosOswald Buddenhagen2025-03-171-1/+1
| | | | | Change-Id: I665620a532b686c8f1b9573d6f6fe8459af226a6 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: handle Changes w/o target branch on disappeared branchesOswald Buddenhagen2024-06-241-1/+2
| | | | | | | | | | | | | in source_map_traverse(), we try to find Changes in the upstream of their target branch, in case they were already integrated. but Changes that were never pushed (and weren't --group'd with --branch) don't have a target branch, so we'd get complaints about indexing by undef. we should just filter them out, as they don't have a base commit, either, and will therefore be skipped by the subsequent loop we're collecting the data for, too. Change-Id: Ic8fea075ff0b8cb6cb44db3353a9cdb4d52e276b Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: make chaining series comfortableOswald Buddenhagen2024-01-091-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is for series that have local dependencies, but are nonetheless logically separate. a base that refers to a local Change will now get translated to that Change's latest PatchSet at the time the push happens, regardless of whether it was actually specified as that PatchSet's sha1, the Change-Id, or the current sha1 of the local commit. i can't think of a reason why that would be undesirable, so there is no opt-out from that. we don't auto-rebase when the parent is re-pushed, to minimize churn. instead, the new option --rebase-chained needs to be used for that. this is in the spirit of --minimal (it may make sense to link the behavior to that option, but things get a bit messy then). we don't automatically push the parent series, either. but if we did, in combination with auto-rebasing, this would effectively create atomic series whose parts can have different attributes, for example different reviewers (but note that we currently don't persist these locally anyway). however, such auto-chaining would be rather tricky in conjunction with --minimal when a series has multiple children. and realistically, push --all mode should be adequate in practice. Change-Id: I7a9608c99091a8a373c36af8ba95559234a5857c Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: try to preserve group idsOswald Buddenhagen2024-01-091-2/+35
| | | | | | | | | | | | | | | | a subsequent commit will require the gids to stay stable. it also improves the optics, making debugging somewhat easier: git diff refs/gpush/state@{1}..refs/gpush/state now returns something that actually looks sane in most cases. if we actually versioned the state file, this would also save space, but as there is no need for versioning beyond what the reflog provides, this is kinda moot. Change-Id: If222c4763527bcfe3629bc181339176de095db39 Reviewed-by: Alexandru Croitor <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: enable specifying 'all' with --move/--copy/--hideOswald Buddenhagen2024-01-091-6/+31
| | | | | Change-Id: Id6c00ac74b8892f498e70a23e65a143ca79753c7 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: compress output from local branch trackingOswald Buddenhagen2024-01-091-38/+70
| | | | | | | | | | | | | | it is rather common that many Changes are affected by the same event/ error, so reporting them individually would lead to quite noisy output. so instead collect them in hashes indexed by the event, and output them only at the end. "regular" error reports are now also delayed, so notices are always printed prior to error messages, so the actionable items are most likely to remain in view. Change-Id: I2c130fe3f5053283e9ee4bfb66d67bbb5beb2716 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush: introduce option to add missing Change-Id footersOswald Buddenhagen2024-01-091-5/+22
| | | | | | | | | | it's not exactly rare to try to push something to Gerrit, only to discover that the commit-msg hook wasn't installed. of course one can fix that and then simply run 'git rebase -i' and 'reword' each commit, but that gets a bit tedious with a lot of Changes ... Change-Id: I5a47f615452cc929dacbe621cc3116d2d8cc7b2d Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: split analyze_local_branch()Oswald Buddenhagen2024-01-091-4/+9
| | | | | | | | | | this is preparatory refactoring, but it has an immediate side effect on gpick: we now process the branch tracking options (--move & co.) even if there are no local Changes, so we can print error messages about their over-use. Change-Id: If1bb8a3734234d90d5121a3286a9c94e4b96b86e Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: reshuffle sanity check in analyze_local_branch() somewhatOswald Buddenhagen2024-01-091-18/+19
| | | | | | | | | | | run it on the re-enumerated commits rather than the raw ones. most visibly, this saves one loop. it also has the effect of checking only along the 1st parents, which is consistent with the overall operation of the scripts. another effect will manifest only after a subsequent patch: no double-examination of some commits. Change-Id: I60b612a52b9e86470f7b75241e45dae4e8637e77 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: resolve branch names internallyOswald Buddenhagen2024-01-091-1/+3
| | | | | | | | | | | | we have the local refs loaded up, so we can resolve them in-process, just like we already did with HEAD. this is an optimization, but the real intent is a prospective bug fix (if we manipulated the refs only in memory (due to --dry-run) prior to using them). consequently, we don't do ancestry traversal (e.g., HEAD~3) in-process (yet). Change-Id: I1930c61c986d846b37f02ca00aaa5a6c6a5d9bac Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: revamp initialize_get_changes()Oswald Buddenhagen2024-01-091-68/+25
| | | | | | | | | | | | try to extract the branch from the $from revspec prior to trying to resolve it. this has roughly the same cost in case of expected failure (that is, when the revspec uses a Change-Id), but it is a lot cleaner, as we need only a little more code in determine_local_branch() (and by extension branch_for_commit()), while parse_local_rev_id() disappears, which enables a massive consolidation of parse_local_rev(). Change-Id: If864848c302809e3ba444be9f4ac2a4133e26111 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: revamp querying value of HEADOswald Buddenhagen2024-01-091-8/+34
| | | | | | | | | | | | | | don't invoke git symbolic-ref on-demand, but just load it up in-process in load_state(), which is a lot cheaper. in conjunction with the local branch heads which we already loaded up, we can simplify quite some code at no runtime cost. this also fixes the corner case of _parse_local_rev_sym() returning the tip of the wrong branch for a plain HEAD revspec when the $from revspec refers to another branch than HEAD does. Change-Id: Iffcb153f5888293c7df7a62dc692bb6196b18c93 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: return found commits from analyze_local_branch()Oswald Buddenhagen2024-01-091-2/+2
| | | | | | | | | | ..., so gpick doesn't need to invoke get_commits_free($local_tip) again. the historical reason for this apparent sillyness is that prior to a3a05fe72, we returned the raw rev-list without --first-parent (and in 97259060d, we stopped returning commits altogether). Change-Id: I1fb8f636019f86214ac320d2ecc4ee7128cd4523 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpick: fix incorrect rejection of ROOT and @{upstream} parent commitsOswald Buddenhagen2024-01-091-2/+2
| | | | | | | | | don't try to validate 'ROOT' and '' (upstream) as real commits, as this would obviously fail. this would affect only the use as SPEC_PARENT, as SPEC_BASE is whitelisted anyway. Change-Id: I7a4f76c5e6a550c03d58f9042bd0f911c39007c0 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: add option to include range-diff into patch re-rollsOswald Buddenhagen2024-01-091-2/+2
| | | | | | | | | | unlike on gerrit for two PatchSets, one cannot simply view the diff between two patch versions. to address this issue, git format-patch has the --range-diff option to include the delta into the new version of the patch series itself. Change-Id: I3f044fe0da36c0e309701b5bb17f0f05956b5db1 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: save tip Change of each pushOswald Buddenhagen2024-01-091-1/+1
| | | | | | | | for the time being, this only enables more accurate reconstruction of the pushed series in gpick in case Changes were dropped from the end. Change-Id: I1f1ef9a8b1108e9a425db8cdeff6253c6b7ef7ff Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: make setting the In-Reply-To: header in mail mode comfortableOswald Buddenhagen2024-01-091-2/+2
| | | | | | | | | | | unlike the generic format options that should persist, this is a one-shot parameter that should auto-destruct after each roll. i pondered coupling the application and reset to --keep-version, but was unable to come up with sensible semantics. Change-Id: I9524ce5138fe62166c6a2d7e4685b20e4690d7a9 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush: make it possible to set a description on each seriesOswald Buddenhagen2024-01-091-3/+55
| | | | | | | | this can be much more verbose than a topic name, and is aimed at authoring cover letters in mail mode. Change-Id: I65f769ee0c018e840a7561065f6da0da3bb94417 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush: make it possible to set format-patch options in mail modeOswald Buddenhagen2024-01-091-6/+48
| | | | | | | | | | | this is required for setting mail receivers and actual patch formatting options. the relevant options are identical for send-email and format-patch, so we don't differentiate these. Change-Id: Ie7f35b3402531ecec7762e07b32526c909589809 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: introduce infra for indirect propertiesOswald Buddenhagen2024-01-091-0/+31
| | | | | | | | | | | | | | | | | | | | | | | rather than having the same (potentially big) value in each Change it was assigned to, duplicate only a small id. an arguably cleaner way to approach this would be saving actual group properties rather than aggregating them on the fly from Change properties. but when i implemented this, it turned out that we'd have to be able to resolve conflicts resulting from merging groups in rather inopportune places: gpick calls assign_series() from deduce_series() (though a conflict occurring due to this is a rather academical case) and from _source_map_finish_initial() via analyze_local_branch(). this means that we'd have to add the property-overriding command line options to gpick (which is ugly) or we'd have to croak in gpick and tell the user to use gpush first instead (which is also ugly). more broadly, group properties aren't a very good fit for gerrit, where groups aren't even a thing. this is why we don't use them in the first place. Change-Id: I555360de0fc08b698213e56045ca408c1ee47851 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: add patch series versioning in mail modeOswald Buddenhagen2024-01-091-2/+3
| | | | | | | | | it's customary to tag re-rolls of patch series with a modified subject like "[PATCH v2 1/13]", which this implements. this is equivalent to Gerrit's PatchSet numbers. Change-Id: I1ad34e90956835a6b4540ce93c0a2633e1455522 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush: introduce "mail" modeOswald Buddenhagen2024-01-091-4/+16
| | | | | | | | | | | i work on the linux kernel and git, both of which still use patch-based workflows, at least for non-maintainer contributions. there are various other tools which support the "stacked branches" workflow gpush centers around, but none of them is nearly as comfortable as gpush. so there we go: a gerrit-free mode in "git-gerrit-push". Change-Id: Ifb2d603a06d0b7825392a37967a5f6c28ed79455 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush: cache rebased commits more aggressivelyOswald Buddenhagen2024-01-091-1/+3
| | | | | | | | | | | we now save the rebased commits even if they are not actually pushed out, which is the case with --list-online, and even on a regular push attempt that errors out due to failing to rebase another series. this vastly accelerates repeated listing and the subsequent push for series that are not rebased meanwhile. Change-Id: I1c9df94193a07d827d7cfea5a51980ff3f47f58a Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush: inline get_1st_commit()Oswald Buddenhagen2024-01-091-7/+0
| | | | | | | it's trivial and there was only one caller. Change-Id: If1c1d925470a377e08ade71bdf888161fd798970 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpull: return ROOT early in get_1st_parent_tree()Oswald Buddenhagen2024-01-091-1/+2
| | | | | | | | this clarifies the code by not pretending that we may get a commit for it. Change-Id: I4d76b914774c5dae0b5c57720071faacca689aac Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: clear $curr_tree when creating new indexOswald Buddenhagen2024-01-091-1/+2
| | | | | | | | | the former should represent the state of the latter. otherwise, we get an unexpected failure when the first patch application with the new index is based on the tree produced last with the previous index. Change-Id: Ic37ea5286171ab6820439f7bcfab486903bbdcef Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: centralize Change lookup by pushed commitOswald Buddenhagen2024-01-091-13/+6
| | | | | | | a followup commit will need this, and it's cleaner this way anyway. Change-Id: Ia97de9197032daabb31399d02db9d834d5800f54 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: improve debug info in apply_diff()Oswald Buddenhagen2023-06-011-1/+4
| | | | | Change-Id: I35bd8dee8d4d10d5470d7247969c7a96858001db Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: factor out commit_metas_equal()Oswald Buddenhagen2023-06-011-0/+8
| | | | | | | for de-duplication and improved legibility. Change-Id: I677e2f726207c9597d52c53248590573bc409259 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: heed --dry-run more carefullyOswald Buddenhagen2023-06-011-2/+2
| | | | | | | | | | skip saving the state also after branch tracking activity (both local and remote), to make the operation truly read-only (and thus reproducible) - the remaining exception are the PatchSet refs gpick fetches from Gerrit, but this is basically a cache. Change-Id: I8e3f708945ee0e6d33483177b394de90e833edc2 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: fix width of flowed text in reportsOswald Buddenhagen2023-06-011-1/+1
| | | | | | | | | we didn't set the width for Text::Wrap, so it defaulted to 72, while the other parts are targeting 80 columns. call a function that already does the right thing instead of invoking wrap() directly. Change-Id: If7a0c2e0439f7136065092600a755a884035b822 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: make sure that git errors during state saving are visibleOswald Buddenhagen2023-06-011-5/+6
| | | | | Change-Id: I626eecd0c4158713b9d9362d863d319e8305dc40 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: heed git's ssh configOswald Buddenhagen2023-02-201-2/+12
| | | | | | | Fixes: QTQAINFRA-5398 Change-Id: Ia5a5ec3b0cf005ab4271e2418bd4a45743fa9f9c Reviewed-by: Tor Arne Vestbø <[email protected]> Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: change how unspecified reviewer type is representedOswald Buddenhagen2022-03-011-2/+3
| | | | | | | | in preparation of supporting both specified (via REST) and unspecified (via SSH) reviewer types. Change-Id: I79cf8200d9d9a717e6b65ecd17ead88c39879cec Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpick: fix --move/--copy/--hide with no local commitsOswald Buddenhagen2022-01-211-28/+36
| | | | | | | | | | | | | | | _source_map_prepare() was never called when no local commits are present, as analyze_local_branch() exits early in this case. unfortunately, this skipped the preparation of remote ids and 'new' as well. fix by factoring out source_map_validate() and calling it right after the local branch was determined. i opted against calling it at the top of analyze_local_branch(), as it seemed too cryptic, so instead gpick & gpush have their own calls. Change-Id: Ib8ec9997a127b2e639532b700e0f5f67de1bcdd9 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush/gpick: Use resolved Gerrit URL for both pushing and fetching changesTor Arne Vestbø2021-08-131-0/+3
| | | | | | | | | | | | | | | | | The user might have set up a remote with a separate push URL, e.g.: [url "git://code.qt.io/"] insteadOf = qt-project: [url "ssh://codereview.qt-project.org/"] pushInsteadOf = qt-project: We resolve the Gerrit URL and host in set_gerrit_config(), by taking insteadOf and pushInsteadOf into account. By using the resolved URL instead of the remote name when fetching we ensure that we always hit the Gerrit server. Without this git-gpick will fail. Change-Id: I580f01b8615c9d9fe5961036b8bb260ef62c8261 Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpick: fix filtering of locally excluded ChangesOswald Buddenhagen2021-05-181-1/+1
| | | | | | | | | | | the commits of the assembled series have Changes assigned only after filtering+sorting, so we need to query by Change id instead of using Change links. amends 143b73c1. Change-Id: I30984ae86a48ad8d28899a3d5cb437bb2c76d064 Reviewed-by: Alexandru Croitor <[email protected]>
* ggc: prune fetched refs more aggressivelyOswald Buddenhagen2021-05-181-2/+8
| | | | | | | | | | keep only refs which are not older than the ones reachable from the pushed revision of each still active change. this has the biggest impact after gpush --rebase'ing a partially integrated series (which one shouldn't do unless necessary, but anyway). Change-Id: I2cf26aeca997f24da6747bf588eeb24c424b7af4 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: restructure loop to avoid copying dataOswald Buddenhagen2021-05-181-5/+7
| | | | | Change-Id: I74aec34e93c1077e81e5d28b7aa21e5c73a96d1e Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: prune pointless return value from close_process()Oswald Buddenhagen2021-05-181-2/+1
| | | | | Change-Id: Ia6d8613a9f3822235d89e4e86b19a4559acfca48 Reviewed-by: Alexandru Croitor <[email protected]>
* gpush: Respect pushInsteadOf when mapping remote.foo.urlTor Arne Vestbø2021-03-081-6/+6
| | | | | | | | | Both remote.foo.url and remote.foo.pushurl should respect pushInsteadOf when the url is used to push, which is how we use it. Change-Id: I6dfa7f78eeeeada6b760280c0c7f41f779f689cb Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpush: allow configuring branch-specific remotesTor Arne Vestbø2021-01-291-10/+46
| | | | | | Change-Id: I2723e0d4a2e26b9de6a1d1895d6b9e2f11f58f20 Reviewed-by: Oswald Buddenhagen <[email protected]> Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: add support for url.*.{push,}insteadOfOswald Buddenhagen2020-06-261-3/+29
| | | | | | Started-by: Tor Arne Vestbø <[email protected]> Change-Id: I00e15103c0341c0a197681161605c24f70e080be Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: add support for remote.*.pushUrlOswald Buddenhagen2020-06-261-1/+2
| | | | | | | | | | in principle, a user could use pushUrl instead of a separate gerrit remote. this is mostly hypothetical, as the Qt mirrors are only partial, while this would work only with a full mirror, as gpick fetches patchsets from gerrit (where pushUrl is obviously ignored). Change-Id: I52287f1ce72b058672dd320e97455aee572d01f1 Reviewed-by: Tor Arne Vestbø <[email protected]>
* gpush/gpick: implement local branch trackingOswald Buddenhagen2020-04-011-28/+511
| | | | | | | this helps dealing with cherry-picks between local branches. Change-Id: Ie3f7567639cc05e03257cd5bac133714e5c4f068 Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpush: add possibility to exclude series from push-all modeOswald Buddenhagen2020-04-011-1/+3
| | | | | | | | some work is just too preliminary to push it out, or even meant to be never pushed. Change-Id: I5c08d75a433f15f4b27fdebc32c9f5b8ababcb48 Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpush: add mode which pushes all seriesOswald Buddenhagen2020-04-011-2/+4
| | | | | | | this is useful for quickly ensuring that one has no unpushed local work. Change-Id: I807c9fb6d389439a14fb183373251b36838dd747 Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpush: add mode which designates series without pushing yetOswald Buddenhagen2020-04-011-2/+10
| | | | | | | | | | | | | | it sometimes makes sense to postpone pushing a series. however, leaving the changes unassociated may be confusing or cause them being forgotten. the --group option allows assigning them to a series without pushing them already. change classification will now differentiate between 'new' (explicitly associated but not yet pushed) and 'loose' (not explicitly associated) changes. Change-Id: I22615b67d336aed37f90915bd94034f1d0849880 Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpush: add option to capture leading loose ChangesOswald Buddenhagen2020-04-011-6/+11
| | | | | | | | | | | | | | | | | we don't automatically capture leading loose Changes because that would lead to a significant rate of false positives, but the case of prepending new Changes to a series is common enough to provide a shortcut for explicit capture (the "verbose" approach is to simply regroup the series from scratch). we complain when encountering leading loose Changes but no capture is requested, to avoid false negatives in turn. however, until the later introduction of grouping mode this is somewhat annoying, because the only ways to make it shut up are to a) capture the loose Changes, b) push them separately right away, or c) rebase them out of the way. Change-Id: I128999d06561c24b4f9130b9950106aa142ab64d Reviewed-by: Oswald Buddenhagen <[email protected]>
* gpush: add option to append loose Changes to a seriesOswald Buddenhagen2020-04-011-11/+14
| | | | | | | extending existing series is rather tedious without it. Change-Id: If4bac3c356d9bc94b29407870b13ec2cf38b0f13 Reviewed-by: Oswald Buddenhagen <[email protected]>