Commit Graph

9 Commits (master)

Author SHA1 Message Date
Mike Kaganski c13fa52613 Use custom local branch name as explicit remote user branch name for PR
In a scenario where onee has several parallel PRs, one needs to use
several local branches, and when updating PRs, _needs to provide PR
branch name explicitly_ each time (my-PR-name-* in the example):

  git checkout featureFoo
  [ edit session ]
  git commit
  ./g review my-PR-name-1
  git checkout featureBar
  [ edit session ]
  git commit
  ./g review my-PR-name-2

This changes the processing, so that when the user's local branch name
is different from the tracked branch name, it is treated as if user
used that name explicitly in a call:

  git checkout -b featureFoo origin/master
  git checkout -b featureBar origin/distro/collabora/co-6-4
  [ ... ]
  git checkout featureFoo
  [ edit session ]
  git commit
  ./g review # this uses "featureFoo" as implicit second argument
  git checkout featureBar
  [ edit session ]
  git commit
  ./g review # this uses "featureBar" as implicit second argument

so no need to remember which PR name was used where.
This only works for local branch names that are not equal to a remote
branch name, or to the last part (after last /) of any distro branch.

Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I8b95f92f6e205e3c93ef30f4813f3549c2315872
2021-07-16 08:53:58 +02:00
Miklos Vajna b47a4e7f53 g review: fix advice on how to update the existing PR ...
In case the local branch name and the remote branch name is different.

E.g. if you had co-6-4 tracking origin/distro/collabora/co-6-4, then the
correct advice is './g review distro/collabora/co-6-4', not './g review
co-6-4'.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I6b5556f992e30756542ed8e1f1cc15e61ce9bffa
2020-12-18 19:09:23 +01:00
Miklos Vajna a4becf39ab g backport: fix a temp file leak
And make the pull request query a bit more generic, so this can be
reused for other repos as well.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic231367bcf50f86b41430b48f752bb05d4e8d25f
2020-11-27 10:16:13 +01:00
Miklos Vajna 947781ddd6 g backport: add a subcommand to easily backport all commits of a PR
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie48782075d7ebed245577ae1c0db63bc557fa57a
2020-11-26 17:13:07 +01:00
Miklos Vajna 3859ca3119 g review: check if 'gh' is authenticated already
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I689348489f89d74b10782302d7bea57a845e36d4
2020-10-26 11:03:32 +01:00
Miklos Vajna 85e51bbb53 g review: update list of remote branches before checking for branch existence
This helps in case you deleted a remote branch using the GitHub web UI,
so the local view is outdated.

Change-Id: I98be33ea5712c66589f42b64e3462b76b84fbcc5
2020-10-22 14:32:55 +02:00
Miklos Vajna a1ff7a7fee ./g review: don't assume that local and tracked branch is the same
E.g. local branch is OK to be 'co-4-2' while it tracks
origin/distro/collabora/co-4-2.

Previously this was only working when the local branch was not renamed.

Change-Id: I11c24d71e903d27d34ec498604190d6b436b593d
2020-10-14 09:39:29 +02:00
Miklos Vajna b35b2448ab ./g review: add an optional 'name' parameter
Use-case: create a commit, submit to CI, then forget about it (git reset
--hard origin/master). Then create a next commit, and submit that to CI
as well -- instead of silently updating the previous PR.

Now the silent update doesn't happen anymore:

- If the update is intentional, have to specify the same branch name
explicitly. (E.g. you're on master, then specify 'master'.)

- If the update is not intentional, choose a different name.

Change-Id: Iee9d9ef13286a6a5083c6f9a28682ba65b8504ff
2020-10-09 15:51:19 +02:00
Miklos Vajna 2ca8cf9f7e Add a './g review' script to trigger CI for a commit in an easy way
Similar to gerrit's 'git review' which creates/updates a change without
clicking anywhere in a browser.

Also add a './g pull' to help those who are used to that.

Change-Id: I240ff55c7480d0a2cd6de3f2ea3cd84ca0556af4
2020-10-09 11:58:43 +02:00