All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] create-pull-request: generalize the repository URL parsing
@ 2011-05-23 20:06 Darren Hart
  2011-05-23 20:06 ` [PATCH 1/1] " Darren Hart
  2011-05-25 17:18 ` [PATCH 0/1] " Saul Wold
  0 siblings, 2 replies; 3+ messages in thread
From: Darren Hart @ 2011-05-23 20:06 UTC (permalink / raw)
  To: openembedded-core, raj.khem; +Cc: Darren Hart

I noticed the REMOTE_REPO was not being properly parsed by the
create-pull-request script in a pull recently sent from Khem. This should
address the issue with the added benefit of treating each of pokylinux,
yoctoproject, openembedded, and github with a single regex for determining
REMOTE_REPO and public'ifying the URL. Most other repositories are also likely
covered by the new regex for generating the public URL. Specific cases are still
obviously required for generating a browsable web URL.

The following changes since commit ed8646e257ad84b017e5295b892eeb44bcef0483:

  *pull-request: add copyright, license, and descriptions (2011-05-16 15:18:20 -0700)

are available in the git repository at:
  git://git.pokylinux.org/poky-contrib dvhart/git-pull
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/git-pull

Darren Hart (1):
  create-pull-request: generalize the repository URL parsing

 scripts/create-pull-request |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] create-pull-request: generalize the repository URL parsing
  2011-05-23 20:06 [PATCH 0/1] create-pull-request: generalize the repository URL parsing Darren Hart
@ 2011-05-23 20:06 ` Darren Hart
  2011-05-25 17:18 ` [PATCH 0/1] " Saul Wold
  1 sibling, 0 replies; 3+ messages in thread
From: Darren Hart @ 2011-05-23 20:06 UTC (permalink / raw)
  To: openembedded-core, raj.khem; +Cc: Darren Hart

The existing REMOTE_URL and REMOTE_REPO parsing made assumptions regarding
the git URL format used for the known repository types. In fact, both of
these ssh URL formats are valid for all the known repositories. Specifically:

  ssh://git@server/repository/path
  git@server:repository/path

Generalize the parsing to work with each of these for all push URLs matching
*@*. Tested with the following URLs:

  ssh://git@git.pokylinux.org/poky-contrib
  ssh://git@git.pokylinux.org/poky-contrib.git
  git@git.pokylinux.org:poky-contrib
  git@git.pokylinux.org:poky-contrib.git

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 scripts/create-pull-request |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index b808146..19b640f 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -97,28 +97,22 @@ while getopts "b:chi:m:o:p:r:s:u:" OPT; do
 			exit 1
 		fi
 
-		# Rewrite known private URLs to public URLs
+		# Rewrite private URLs to public URLs
 		# Determine the repository name for use in the WEB_URL later
 		case "$REMOTE_URL" in
-		ssh://git@git.pokylinux.org*)
-			REMOTE_REPO=$(echo $REMOTE_URL | sed "s#.*/\(.*\)#\1#")
-			REMOTE_URL=${REMOTE_URL/'ssh://git@'/'git://'}
+		*@*)
+			USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_.@-]*\$\?"
+			PROTO_RE="[a-z][a-z]*://"
+			GIT_RE="\(^\($PROTO_RE\)\?$USER_RE@\)\([^:/]*\)[:/]\(.*\)"
+			REMOTE_URL=${REMOTE_URL%.git}
+			REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\4#")
+			REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\3/\4#")
 			;;
-		ssh://git@git.yoctoproject.org*)
-			REMOTE_REPO=$(echo $REMOTE_URL | sed "s#.*/\(.*\)#\1#")
-			REMOTE_URL=${REMOTE_URL/"ssh://git@"/"git://"}
-			;;
-		*ssh://git@git.openembedded.org*)
-			REMOTE_REPO=$(echo $REMOTE_URL | sed "s#.*/\(.*\)#\1#")
-			REMOTE_URL=${REMOTE_URL/"ssh://git@"/"git://"}
-			;;
-		git@github.com:*)
-			REMOTE_REPO=$(echo $REMOTE_URL | sed 's#.*:\(.*\)\(\.git\)$#\1#')
-			REMOTE_URL=${REMOTE_URL/"git@github.com:"/"git://github.com/"}
+		*)
+			echo "WARNING: Unrecognized remote URL: $REMOTE_URL"
+			echo "         The pull and browse URLs will likely be incorrect"
 			;;
 		esac
-		# The .git suffix is optional in the URL, drop in for the REPO
-		REMOTE_REPO=${REMOTE_REPO%.git}
 		;;
 	esac
 done
@@ -134,6 +128,7 @@ fi
 
 
 # Set WEB_URL from known remotes
+WEB_URL=""
 case "$REMOTE_URL" in
 	*git.yoctoproject.org*)
 		WEB_URL="http://git.yoctoproject.org/cgit.cgi/$REMOTE_REPO/log/?h=$BRANCH"
-- 
1.7.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] create-pull-request: generalize the repository URL parsing
  2011-05-23 20:06 [PATCH 0/1] create-pull-request: generalize the repository URL parsing Darren Hart
  2011-05-23 20:06 ` [PATCH 1/1] " Darren Hart
@ 2011-05-25 17:18 ` Saul Wold
  1 sibling, 0 replies; 3+ messages in thread
From: Saul Wold @ 2011-05-25 17:18 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart

On 05/23/2011 01:06 PM, Darren Hart wrote:
> I noticed the REMOTE_REPO was not being properly parsed by the
> create-pull-request script in a pull recently sent from Khem. This should
> address the issue with the added benefit of treating each of pokylinux,
> yoctoproject, openembedded, and github with a single regex for determining
> REMOTE_REPO and public'ifying the URL. Most other repositories are also likely
> covered by the new regex for generating the public URL. Specific cases are still
> obviously required for generating a browsable web URL.
>
> The following changes since commit ed8646e257ad84b017e5295b892eeb44bcef0483:
>
>    *pull-request: add copyright, license, and descriptions (2011-05-16 15:18:20 -0700)
>
> are available in the git repository at:
>    git://git.pokylinux.org/poky-contrib dvhart/git-pull
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dvhart/git-pull
>
> Darren Hart (1):
>    create-pull-request: generalize the repository URL parsing
>
>   scripts/create-pull-request |   29 ++++++++++++-----------------
>   1 files changed, 12 insertions(+), 17 deletions(-)
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Merged into oe-core

Thanks
	Sau!



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-25 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 20:06 [PATCH 0/1] create-pull-request: generalize the repository URL parsing Darren Hart
2011-05-23 20:06 ` [PATCH 1/1] " Darren Hart
2011-05-25 17:18 ` [PATCH 0/1] " Saul Wold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.