Patchwork [RFC,03/10] create-pull-request: use git request-pull and arbitrary remotes

login
register
mail settings
Submitter Darren Hart
Date May 14, 2011, 3:19 a.m.
Message ID <4DCDF4BA.1000909@linux.intel.com>
Download mbox | patch
Permalink /patch/4019/
State New, archived
Headers show

Comments

Darren Hart - May 14, 2011, 3:19 a.m.
>> +# Set WEB_URL from known remotes
>> +case "$REMOTE_URL" in
>> +	*git.yoctoproject.org*)
>> +		WEB_URL="http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
>> +		;;
>> +	*git.pokylinux.org*)
>> +		WEB_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
>> +		;;
>> +esac
> 
> Nit: what about if this is a remote branch on that server but not for
> that repo?


I'll roll a fix into V2, how about this:
Joshua Lock - May 16, 2011, 4:31 p.m.
On Fri, 2011-05-13 at 20:19 -0700, Darren Hart wrote:
> >> +# Set WEB_URL from known remotes
> >> +case "$REMOTE_URL" in
> >> +	*git.yoctoproject.org*)
> >> +		WEB_URL="http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
> >> +		;;
> >> +	*git.pokylinux.org*)
> >> +		WEB_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
> >> +		;;
> >> +esac
> > 
> > Nit: what about if this is a remote branch on that server but not for
> > that repo?
> 
> 
> I'll roll a fix into V2, how about this:
> 
> diff --git a/scripts/create-pull-request b/scripts/create-pull-request
> index 43a4b74..869e6e8 100755
> --- a/scripts/create-pull-request
> +++ b/scripts/create-pull-request
> @@ -70,6 +70,7 @@ while getopts "b:chi:m:o:p:r:s:u:" OPT; do
>                         echo "ERROR: git config failed to find a url for '$REMOTE'"
>                         exit 1
>                 fi
> +               REMOTE_REPO=$(echo $REMOTE_URL | sed "s#.*/\(.*\)\(.git\)#\1#")
>  
>                 # Rewrite known private URLs to public URLs
>                 case "$REMOTE_URL" in
> @@ -97,10 +98,10 @@ fi
>  # Set WEB_URL from known remotes
>  case "$REMOTE_URL" in
>         *git.yoctoproject.org*)
> -               WEB_URL="http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
> +               WEB_URL="http://git.yoctoproject.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
>                 ;;
>         *git.pokylinux.org*)
> -               WEB_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
> +               WEB_URL="http://git.pokylinux.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
>                 ;;
>  esac
> 

Looks good to me.

Acked-by: Joshua Lock <josh@linux.intel.com>

Cheers,
Joshua

Patch

diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 43a4b74..869e6e8 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -70,6 +70,7 @@  while getopts "b:chi:m:o:p:r:s:u:" OPT; do
                        echo "ERROR: git config failed to find a url for '$REMOTE'"
                        exit 1
                fi
+               REMOTE_REPO=$(echo $REMOTE_URL | sed "s#.*/\(.*\)\(.git\)#\1#")
 
                # Rewrite known private URLs to public URLs
                case "$REMOTE_URL" in
@@ -97,10 +98,10 @@  fi
 # Set WEB_URL from known remotes
 case "$REMOTE_URL" in
        *git.yoctoproject.org*)
-               WEB_URL="http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
+               WEB_URL="http://git.yoctoproject.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
                ;;
        *git.pokylinux.org*)
-               WEB_URL="http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=$BRANCH"
+               WEB_URL="http://git.pokylinux.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
                ;;
 esac