| Submitter | Tom Rini |
|---|---|
| Date | May 10, 2011, 6:55 p.m. |
| Message ID | <1305053706-19572-1-git-send-email-tom_rini@mentor.com> |
| Download | mbox | patch |
| Permalink | /patch/3673/ |
| State | New, archived |
| Headers | show |
Comments
On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: > Add a -l switch that takes an argument of either github or gitorious > and will make the cover letter have a fill-in-the-blank of where the > changes are on either github or gitorious. Another possibility would be to use git config interface to store those. You might have something like: [oe-core-pull-request] mode = github user = foo or [oe-core-pull-request] mode = gitorious user = bar This could be used to fill the fields in a proper way since those are predictable.
On 05/10/2011 12:18 PM, Otavio Salvador wrote: > On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: >> Add a -l switch that takes an argument of either github or gitorious >> and will make the cover letter have a fill-in-the-blank of where the >> changes are on either github or gitorious. > > Another possibility would be to use git config interface to store > those. You might have something like: > > [oe-core-pull-request] > mode = github > user = foo > > or > > [oe-core-pull-request] > mode = gitorious > user = bar > > This could be used to fill the fields in a proper way since those are > predictable. If I had a good bit more time, I might re-write the script in python and parse .ini files (same syntax as gitconfig) so that lots of useful defaults could be saved. But here's the real test, given that you're an intended user, would you use the -l switch or just make a local change to the script like Martin showed?
On 05/10/2011 12:18 PM, Otavio Salvador wrote: > On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: >> Add a -l switch that takes an argument of either github or gitorious >> and will make the cover letter have a fill-in-the-blank of where the >> changes are on either github or gitorious. > > Another possibility would be to use git config interface to store > those. You might have something like: > > [oe-core-pull-request] > mode = github > user = foo > > or > > [oe-core-pull-request] > mode = gitorious > user = bar > > This could be used to fill the fields in a proper way since those are > predictable. I was going to suggest something similar.
On Tue, May 10, 2011 at 04:01:06PM -0700, Tom Rini wrote: > On 05/10/2011 12:18 PM, Otavio Salvador wrote: > > On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: > >> Add a -l switch that takes an argument of either github or gitorious > >> and will make the cover letter have a fill-in-the-blank of where the > >> changes are on either github or gitorious. > > > > Another possibility would be to use git config interface to store > > those. You might have something like: > > > > [oe-core-pull-request] > > mode = github > > user = foo > > > > or > > > > [oe-core-pull-request] > > mode = gitorious > > user = bar > > > > This could be used to fill the fields in a proper way since those are > > predictable. > > If I had a good bit more time, I might re-write the script in python and > parse .ini files (same syntax as gitconfig) so that lots of useful > defaults could be saved. But here's the real test, given that you're an > intended user, would you use the -l switch or just make a local change > to the script like Martin showed? I would still use local copy of script just because in this case it has selective name and I can find it already with right params in bash history. To have the same comfort with -l switch you would have to provide bash completition config :). And yes -l switch is good thing, I can replace my copies with simple alias now.. Regards,
On Tue, 2011-05-10 at 16:01 -0700, Tom Rini wrote: > On 05/10/2011 12:18 PM, Otavio Salvador wrote: > > On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: > >> Add a -l switch that takes an argument of either github or gitorious > >> and will make the cover letter have a fill-in-the-blank of where the > >> changes are on either github or gitorious. > > > > Another possibility would be to use git config interface to store > > those. You might have something like: > > > > [oe-core-pull-request] > > mode = github > > user = foo > > > > or > > > > [oe-core-pull-request] > > mode = gitorious > > user = bar > > > > This could be used to fill the fields in a proper way since those are > > predictable. > > If I had a good bit more time, I might re-write the script in python and > parse .ini files (same syntax as gitconfig) so that lots of useful > defaults could be saved. But here's the real test, given that you're an > intended user, would you use the -l switch or just make a local change > to the script like Martin showed? FWIW, we could at least extract a url from the .config of the git repository with a command like "git remote -v show oe-core-pull-request" Cheers, Richard
On 05/11/2011 10:03 AM, Richard Purdie wrote: > On Tue, 2011-05-10 at 16:01 -0700, Tom Rini wrote: >> On 05/10/2011 12:18 PM, Otavio Salvador wrote: >>> On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: >>>> Add a -l switch that takes an argument of either github or gitorious >>>> and will make the cover letter have a fill-in-the-blank of where the >>>> changes are on either github or gitorious. >>> >>> Another possibility would be to use git config interface to store >>> those. You might have something like: >>> >>> [oe-core-pull-request] >>> mode = github >>> user = foo >>> >>> or >>> >>> [oe-core-pull-request] >>> mode = gitorious >>> user = bar >>> >>> This could be used to fill the fields in a proper way since those are >>> predictable. >> >> If I had a good bit more time, I might re-write the script in python and >> parse .ini files (same syntax as gitconfig) so that lots of useful >> defaults could be saved. But here's the real test, given that you're an >> intended user, would you use the -l switch or just make a local change >> to the script like Martin showed? > > FWIW, we could at least extract a url from the .config of the git > repository with a command like "git remote -v show oe-core-pull-request" It just depends on specific naming... hrm... or we could specify the remote on the command line instead of the full URL. That would make the specification each time much less onerous. We would have to rewrite 'ssh://git@' to 'git://' for some URLs as I suspect most users don't have different push/fetch URLs (I don't).
On Tue, May 10, 2011 at 20:01, Tom Rini <tom_rini@mentor.com> wrote: > On 05/10/2011 12:18 PM, Otavio Salvador wrote: >> On Tue, May 10, 2011 at 15:55, Tom Rini <tom_rini@mentor.com> wrote: >>> Add a -l switch that takes an argument of either github or gitorious >>> and will make the cover letter have a fill-in-the-blank of where the >>> changes are on either github or gitorious. >> >> Another possibility would be to use git config interface to store >> those. You might have something like: >> >> [oe-core-pull-request] >> mode = github >> user = foo >> >> or >> >> [oe-core-pull-request] >> mode = gitorious >> user = bar >> >> This could be used to fill the fields in a proper way since those are >> predictable. > > If I had a good bit more time, I might re-write the script in python and > parse .ini files (same syntax as gitconfig) so that lots of useful > defaults could be saved. But here's the real test, given that you're an > intended user, would you use the -l switch or just make a local change > to the script like Martin showed? (devel)~/hacking/el/openembedded-core% git config --add --path oe-pull-request.mode github (devel)~/hacking/el/openembedded-core% git config --get oe-pull-request.mode github This does the trick! ;-)
Patch
diff --git a/scripts/create-pull-request b/scripts/create-pull-request index 784b48c..2e02d82 100755 --- a/scripts/create-pull-request +++ b/scripts/create-pull-request @@ -18,6 +18,7 @@ Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to -b contrib_branch Branch-name in the $PULL_URL -s subject The subject to be inserted into the summary email -p prefix Use [prefix N/M] instead of [PATCH N/M] as the subject prefix + -l location The location (github or gitorious) where the changes are if not in the default contrib repository Examples: $CMD -b nitin/basic @@ -28,7 +29,7 @@ EOM } # Parse and validate arguments -while getopts "b:hi:m:o:r:s:p:" OPT; do +while getopts "b:hi:i:l:m:o:r:s:p:" OPT; do case $OPT in b) CONTRIB_BRANCH="$OPTARG" @@ -40,6 +41,22 @@ while getopts "b:hi:m:o:r:s:p:" OPT; do i) COMMIT_ID="$OPTARG" ;; + l) + case $OPTARG in + github) + PULL_URL="git://github.com/PROJECT/REPO.git" + WEB_URL_PREFIX="https://github.com/PROJECT/REPO/tree/" + ;; + gitorious) + PULL_URL="git://gitorious.org/PROJECT/REPO.git" + WEB_URL_PREFIX="http://gitorious.org/PROJECTS/REPO/commits/" + ;; + *) + echo "ERROR: Unknown location where the changes are hosted" + exit 1 + ;; + esac + ;; m) BODY="$OPTARG" if [ ! -e "$BODY" ]; then
Add a -l switch that takes an argument of either github or gitorious and will make the cover letter have a fill-in-the-blank of where the changes are on either github or gitorious. Signed-off-by: Tom Rini <tom_rini@mentor.com> --- scripts/create-pull-request | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-)