Skip to contentSkip to conversation

create-pull-request: fix for newer git

PATCH New Robert Yang 1 participant 2 messages Apr 6, 2016

lore
Share & tools
lore
#0 lore raw

cover create-pull-request: fix for newer git

The following changes since commit b2dc5a68e74dafedf7960ef77ad3d73912ed7960:

bdwgc: use github repo for source location (2016-04-05 11:48:09 +0100)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib rbt/pull
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/pull

Robert Yang (1):
create-pull-request: fix for newer git

 scripts/create-pull-request | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
Signature · 1 line
2.8.0
#1 lore raw

PATCH 1/1 create-pull-request: fix for newer git

Fixed when git > 2.1.0:

$ ./scripts/create-pull-request -r HEAD^ -u contrib -b rbt/git
fatal: Not a valid revision: rbt/git
ERROR: git request-pull reported an error

This is because newer git requires both local and remote branch named as rbt/git, but usually, we only named the remote branch as rbt/foo, and foo for local branch.

Add a option '-l' to fix the problem, default is HEAD.

---
 scripts/create-pull-request | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
scripts/create-pull-request +12 -2
index dd66dfe..479ad6e 100755
@@ -36,6 +36,7 @@ CMD=$(basename $0)
 cat <<EOM
 Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to] [-i commit_id] [-d relative_dir] -u remote [-b branch]
   -b branch           Branch name in the specified remote (default: current branch)
+  -l local branch     Local branch name (default: HEAD)
   -c                  Create an RFC (Request for Comment) patch series
   -h                  Display this help message
   -i commit_id        Ending commit (default: HEAD)
@@ -50,6 +51,7 @@ Usage: $CMD [-h] [-o output_dir] [-m msg_body_file] [-s subject] [-r relative_to
  Examples:
    $CMD -u contrib -b nitin/basic
    $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro
+   $CMD -u contrib -r distro/master -i nitin/distro -b nitin/distro -l distro
    $CMD -u contrib -r master -i misc -b nitin/misc -o pull-misc
    $CMD -u contrib -p "RFC PATCH" -b nitin/experimental
    $CMD -u contrib -i misc -b nitin/misc -d ./bitbake
@@ -57,11 +59,14 @@ EOM
 }
 
 # Parse and validate arguments
-while getopts "b:cd:hi:m:o:p:r:s:u:" OPT; do
+while getopts "b:cd:hi:m:o:p:r:s:u:l:" OPT; do
 	case $OPT in
 	b)
 		BRANCH="$OPTARG"
 		;;
+	l)
+		L_BRANCH="$OPTARG"
+		;;
 	c)
 		RFC=1
 		;;
@@ -130,6 +135,11 @@ if [ -z "$BRANCH" ]; then
 	echo "NOTE: Assuming remote branch '$BRANCH', use -b to override."
 fi
 
+if [ -z "$L_BRANCH" ]; then
+	L_BRANCH=HEAD
+	echo "NOTE: Assuming local branch HEAD, use -l to override."
+fi
+
 if [ -z "$REMOTE_URL" ]; then
 	echo "ERROR: Missing parameter -u, no git remote!"
 	usage
@@ -203,7 +213,7 @@ NEWER_GIT_VERSION=210
 if [ $GIT_VERSION -lt $NEWER_GIT_VERSION ]; then
 	git request-pull $RELATIVE_TO $REMOTE_URL $COMMIT_ID >> "$PM"
 else
-	git request-pull $RELATIVE_TO $REMOTE_URL $BRANCH:$BRANCH >> "$PM"
+	git request-pull $RELATIVE_TO $REMOTE_URL $L_BRANCH:$BRANCH >> "$PM"
 fi
 if [ $? -ne 0 ]; then
 	echo "ERROR: git request-pull reported an error"
Signature · 1 line
2.8.0