Commit Graph

49 Commits

Author SHA1 Message Date
Chirayu Desai
0c5aab2704 repopick: unquote URL
Test: repopick -Q "status:open+-is:wip" works
Change-Id: I346c5c40e8197ad1c91235ee1cbacaa3d30c7b91
2024-12-22 17:42:42 +00:00
LuK1337
be60f23b63 repopick: Use add_mutually_exclusive_group() where possible
Change-Id: I7e38e2371d075afd53200d60703eb4466fff07e3
2024-12-09 19:19:23 +01:00
Michael Bestas
8e7b7795df repopick: Add support for hashtags
Test: repopick -H redbull
Change-Id: I1522be31e547a7f8917223e7eeae4389de083227
2024-12-09 19:19:23 +01:00
LuK1337
75b2afaadf repopick: Require python3
Change-Id: I95f598947a29b2095bd7539b1f279dccc1b25097
2024-03-26 20:09:48 +01:00
LuK1337
2a348e8e2b repopick: Use number instead of id for error msgs
Change-Id: I1ebfd8315d1dbbdbee2cd50095f5d7c6b98e7057
2024-03-11 11:58:11 +01:00
LuK1337
65498a79bd repopick: Skip commit_exists() check when using -p
Change-Id: I7b99e8c940bddad80e6362302f1ae24248e42faf
2024-02-12 21:45:28 +00:00
LuK1337
92ced50692 repopick: Fix logic for skipping already merged changes
We can't iterate a list and update it at the same time.

Test: Run `repopick -t XXI` twice
Change-Id: I85651783531b59fd4b48d54a663c22cb243edac7
2024-02-11 11:03:43 +01:00
dianlujitao
77e5f117f7 repopick: Use hostname of the URL to determine lineage gerrit
Change-Id: Ifd3883917bc4acd7d58179235d880f2e4a43b670
2024-02-08 20:26:58 +08:00
dianlujitao
12c5c7233e repopick: Clear Pyright warnings
Change-Id: I63962cc31820329a0fcf8ed96a13ef12a9f67875
2024-02-06 09:39:58 +00:00
dianlujitao
ce64349c54 repopick: Check fetch result based on the actual commit
Checking for FETCH_HEAD is not reliable when fetching in parallel.

Change-Id: I0c07f7c4bffb80e5d12b13f301ba684b95112272
2024-02-06 09:39:58 +00:00
dianlujitao
8a3a02e0b5 repopick: Apply change in parallel
Change-Id: Iafd803422082bcc17f2ad3300df3882d689f3674
2024-02-06 09:39:58 +00:00
dianlujitao
0b48b9b0c1 repopick: Avoid repeatedly performing the same check
Jobs such as check for already picked changes only need to be done once
for each git repository, but it was lunched every time picking a commit.

Change-Id: I87b3fea101dbcedb38502015fe9a9af5f25b397c
2024-02-06 09:39:58 +00:00
dianlujitao
6682b3f35a repopick: Use the builtin urllib to handle HTTP basic authentication
Also do proper URL encode while at it.

Change-Id: I64c0913eed535b109af2adc830288b3dd17c0cbb
2024-02-06 09:39:58 +00:00
dianlujitao
6f048e37fd repopick: Clean up subprocess calls
* Use the builtin approach to decode text output
 * Drop unnecessary system shell usage
 * Use subprocess.run when we don't need its stdout

Change-Id: Ibb2aeae442b5e97828fe4e0eb783e6512288d245
2024-02-06 09:39:58 +00:00
dianlujitao
c0fb88f19e repopick: Organize imports and format with black
Change-Id: I94080fb8adba0af83d86f0c67af8fac460ffbea0
2024-02-06 09:39:58 +00:00
dianlujitao
94b1026f1a repopick: Remove python2 support
Change-Id: I8f164eea3a17888bcf30ff649ddcf81a00bab582
2024-02-06 09:39:58 +00:00
Paul Keith
6b8c2baf9f lineage: s/master/main/
Change-Id: Ia922dd6b396627fea2c8e69f8a7d6bf025b80f7e
2023-10-18 11:57:14 -05:00
LuK1337
0ddf65dc8d repopick: Fix regex related SyntaxWarning on Python 3.12
Change-Id: I23f80997f34a158d564a2e41043242a5af9f2ac3
2023-09-20 20:29:28 +02:00
Chirayu Desai
11eaeaf039 repopick: Don't ignore change status for query mode (-Q)
* Why not just use force with it if you really want to
  pick abandoned changes?
* Avoids surprises

Change-Id: I7420e1c37cc127d1f74539d5685bd9bf77be44c3
2023-05-27 05:15:30 +05:30
Michael W
39881f863a repopick: Limit commit counting
* For every commit, repopick checks the last commits for the presence of
  the commits to be picked
* In every project a change should go in, it calls "git rev-list --count"
  to find the maximum amount of commits to be searched, but it only cares
  if there are less (or equal) commits at all than to be checked
* Therefore, we can limit the counting to one more than we want to check
* This is relevant for example for fw/b, where there is a huge amount of
  changes and therefore a lot of time used to count

* Example: fw/b
  git rev-list --count HEAD: 46.693s
  git rev-list --count --max-count=1000 : 0.019s
* Real-life example:
  repopick -t qs-lightmode
  Old: 2m33.375s
  New: 0m6.657s

Change-Id: If0500574fb282e332996b606dd9926841f8e0e88
2022-06-15 20:57:30 +02:00
LuK1337
a574c010d2 repopick: Use project revision if available
* Fixes repopicking from repos synced under multiple paths + branches.

Change-Id: Icb165f3d9df67f1b11304e8d7ed955464dcb57bc
2020-11-23 10:55:24 +01:00
Aayush Gupta
d395aa21eb repopick: Address PEP8 warnings regarding indentations and variable naming
- Format variables into snake case
- Add spacing between # and text
- Space after ','
- Test for membership with "not in" instead
- Remove too many empty lines

Ref:
[0]: https://www.python.org/dev/peps/pep-0008/#function-and-variable-names
[1]: https://www.python.org/dev/peps/pep-0008/#block-comments
[2]: http://pep8online.com/

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I16dedf465674056571782921983eb3ec4276a1f8
2020-08-08 21:23:41 +02:00
Aayush Gupta
5fd8e2b1ee repopick: Use empty metavar parameter to fix help's indentation
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
Change-Id: I05329c3e5d234846a65f230f69d6b36aa3cc6fa1
2020-08-08 21:23:27 +02:00
Aaron Kling
7d6601cf02 repopick: Use upstream instead of revision to determine branch
This is to allow repopick to determine a branch even on a
revision locked manifest. If upstream is not set, it falls
back to revision.

Per the repo manifest documentation:
Attribute upstream: Name of the Git ref in which a sha1 can be
found. Used when syncing a revision locked manifest in -c mode to
avoid having to sync the entire ref space. Project elements not
setting their own upstream will inherit this value.

Change-Id: I12876f7e3b440f9eab6d1b96eba9b18a13cff2e0
2020-07-20 19:23:05 +02:00
Aaron Kling
d97bfec63f repopick: Fallback to name when project path is empty
When a manifest project path and project name is identical, the
repo manifest parser returns None for the project path. Since
both name and path are required, fall back to using name for path
when path is None.

Change-Id: I2fb3cc0cc643808a3049171804742f249d737679
2020-06-28 18:38:47 +02:00
Simon Shields
d5e35c9dda repopick: fix --check-picked on Python 3
This is very subtly broken: we look for the string 'Change-Id:'
in an array of byte strings. Fix this by decoding the git output
to utf-8 strings.

Change-Id: I708ad0adacb61c89bfba0fd88eeb2e37648317af
2019-11-22 16:48:05 +01:00
Adrian DC
045f664a1a repopick: Support project paths detection on different branches
* When some projects are declared in the manifests with specific
    changes (revision="refs/changes/../....../."), the path
    detection does not work, while most cases have a unique paths

 * Allow projects with unique branches to select their paths
    upon repopick with a warning about the selection

Change-Id: Ic873d69f57c78f233db3d0de4ebd529f896799ea
2019-10-30 12:59:48 +01:00
LuK1337
c62a9fbc31 repopick: Print change subject as unicode
* This prevents from seeing stuff like
  "b'frameworks: Add unlinked ringtone and notification volumes'"
  when using python3 as default.

Change-Id: Ie1fa85681b648edcee65680d784da4dff1779616
2019-09-21 11:48:49 +02:00
Luca Weiss
5ee35ea356 repopick: cmp() is not available in Python 3, define it manually
Change-Id: I16a89aa555e62f105d888e87cb43afd26606076b
2019-06-08 00:01:05 +02:00
Tim Schumacher
49d26ba39a repopick: Try to fast-forward first
Change-Id: I4890ce8075556eb3f57d89c283543f620f39fa02
2018-10-27 21:57:56 +02:00
Adrian DC
0f8230b528 repopick: Warn about empty commits instead of failing
* If a cherry-pick results in an empty commit
    (hints about git commit --allow-empty),
    we should warn instead of failing all repopicks

Change-Id: I8410d7d02c4118c8072de609cf3c291e2d8523e6
2018-09-05 22:41:06 +02:00
Gabriele M
0fcc122018 repopick: Update SSH queries result to match HTTP queries
Needed after the recent repopick changes.

Change-Id: I14f57afefeb9579d1d9896d8dc4512645b5b68e9
2018-06-11 22:52:51 +02:00
Gabriele M
af970b695c repopick: Allow to pick changes by URL
Change-Id: I460c987cc03c4f6ff03ecab1bc39e52cec413c13
2018-04-05 17:34:16 +02:00
Gabriele M
88c0e5d1af repopick: Actually print the patchset number
We are printing the change number twice...

Change-Id: I4f63766d4162f5d016badad662842badd6da3588
2018-04-05 17:34:15 +02:00
Gabriele M
de9e0ae0a5 repopick: Ignore the trailing slash in change numbers
Trailing slashes cause 'patchset' to be an empty string, which
cannot be converted to an int. If we have a trailing slash, ignore
it and pick the current patchset.

Change-Id: Ifad60b7f6ff3dcfd9dd80b2e93b1f909aa360666
2018-04-05 17:34:15 +02:00
Gabriele M
5b610aede3 repopick: Try to keep the changes sorted
Sort the changes according to their parent first and then according
to their number.

Change-Id: Iebdb8789728b2ccd528e19437e162129eb27973c
2018-04-05 17:34:14 +02:00
nailyk
8ce26b3b51 tools: repopick: Correctly order changeset
* Without key=int sorting is done in alphabetical order.
       This cause 999 being picked after 1000.

Change-Id: I540f0e55093a33d80d78a0cf0c31dc83f7168279
2018-01-05 10:16:45 +00:00
Dan Pasanen
1cdd380e69 repopick: support auth'ing to gerrit and picking drafts
* Use requests if installed. If not fall back to urllib. This is
  done because users may or may not have requests installed and
  requiring them to do so for simple http stuff isn't really
  reasonable.

* If requests is installed and a .gerritrc file exists in the
  user's HOME directory, try to get credentials out of it
  for the given gerrit instance. If auth for the correct gerrit
  instance exists, use it to auth to gerrit. If no .gerritrc
  exists, just use requests with no auth.

  Example ~/.gerritrc entry:
  review.lineageos.org|invisiblek|httppasswordhere

Change-Id: I95be26d51bfd31b53f3613e8dbfb7bba46324571
2017-12-21 00:11:43 +00:00
Dan Pasanen
2965342b9a repopick: use https by default for repopicking
Change-Id: Iae1fde3515b0377a2b9253102c82d28b0fdaca4a
2017-12-15 16:50:12 +00:00
Adrian DC
df29022a38 repopick: Support overriding the default commits count to check
* Support passing -c 20 to consider 20 changes instead of 10

Change-Id: I2b36228fb0020501896c800b13713aef284a5772
2017-11-28 09:41:19 +00:00
Harry Youd
1c9c5a314d repopick: Add 'reset' option
In case of conflict, reset to initial state by aborting the cherry-pick,
leaving the working directory clean

Change-Id: I2353b92254b67ea49835bc88b6fc9bc3910b5107
2017-07-19 10:15:32 +00:00
Dan Pasanen
63f767edd9 repopick: don't bail on drafts
* When using an ssh gerrit instance (-g) it is perfectly
  reasonable to pick a draft commit. Don't require force
  picking (-f) in order to do so.

Change-Id: I420f566ee1bb1f0b0d2a2ef29d95e0545db70b89
2017-07-09 09:41:34 -05:00
LuK1337
ad5d9a0ff0 cm: build: Don't convert patchset to int if it's None
* donuts *

Change-Id: I65bfb1741481b01874f21d83b5a43b0902b7d8ea
2017-03-24 23:25:44 +01:00
LuK1337
2756418873 cm: build: Fix cherry picking specific patchsets
Change-Id: I396a1218f141a1ff4cb45252cc01a1487c2afd31
2017-03-24 21:49:55 +00:00
Dan Pasanen
d4ee2f6d04 repopick: encode commit subjects in utf-8 for printing
* Fixes errors like UnicodeEncodeError: 'ascii' codec can't encode
  character u'\xb0' in position 51: ordinal not in range(128) with weird
  characters in a commit message

Change-Id: I700198481630b4b29fd6d5d1f0c79bb94e59ad86
2017-03-16 20:30:41 +00:00
Dan Pasanen
0fdc085c2e build: repopick: point to LineageOS gerrit
Change-Id: Ibf58b111360c17cee919efd585f5ec48be1e2eec
2016-12-27 10:32:16 -06:00
Adrian DC
13b02ff101 repopick: Avoid failing on commits lookup
* Some projects with multiple merges and
    discountinuous histories could trigger
    an error here when the HEAD~{?} does
    not exist, hence avoid this by ignoring
    the commit and continue the search

Change-Id: Ice28c87d1bf8897da52236b637bbb0c5d349f848
2016-12-10 11:03:57 -08:00
Simon Shields
2bdb18f3cd repopick: fix indentation derp
Change-Id: I0673779363b1963219a2765399f2e20c9cdd78a8
2016-09-26 17:52:03 +10:00
Michael Bestas
3952f6cb0d Import CM build additions
Change-Id: Id1eb902129754e61dfcc2b5d95c3a75172ff0c5e
2016-09-25 22:32:37 -07:00