Skip to content

Instantly share code, notes, and snippets.

@vishvananda
Last active October 2, 2015 07:58

Revisions

  1. vishvananda revised this gist Jul 3, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -30,8 +30,8 @@ git checkout $BRANCH
    git pull
    git branch -D bp-$1
    git checkout -b bp-$1
    git review -X $BRANCH
    git review
    git review -X $1
    git review $BRANCH
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
    HOST=`echo $REMOTE | cut -d':' -f1`
  2. vishvananda revised this gist Jul 3, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bp.sh
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@ git pull
    git branch -D bp-$1
    git checkout -b bp-$1
    git review -X $BRANCH
    git review $BRANCH
    git review
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
    HOST=`echo $REMOTE | cut -d':' -f1`
  3. vishvananda revised this gist Jul 3, 2013. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -28,11 +28,9 @@ BRANCH=${2-milestone-proposed}

    git checkout $BRANCH
    git pull
    git review -d $1
    git checkout $BRANCH
    git branch -D bp-$1
    git checkout -b bp-$1
    git cherry-pick -x HEAD@{2}
    git review -X $BRANCH
    git review $BRANCH
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
  4. vishvananda revised this gist Jun 26, 2012. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion bp.sh
    Original file line number Diff line number Diff line change
    @@ -26,9 +26,10 @@ fi

    BRANCH=${2-milestone-proposed}

    git review -d $1
    git checkout $BRANCH
    git pull
    git review -d $1
    git checkout $BRANCH
    git branch -D bp-$1
    git checkout -b bp-$1
    git cherry-pick -x HEAD@{2}
  5. vishvananda revised this gist Jun 11, 2012. 1 changed file with 6 additions and 15 deletions.
    21 changes: 6 additions & 15 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,10 @@
    #!/usr/bin/env bash
    # This is a little script to make backporting patches.
    # This little script is to make backporting patches easier.
    # Instructions
    # ------------
    # Make sure that milestone-proposed exists and is up to date:
    # git branch -D milestone-proposed
    # Make sure that <btranch> exists:
    # git branch -D <branch>
    # git checkout -b <branch> origin/<branch>
    # git pull
    # Grab the file and stick it in your <project> directory:
    # curl -OL https://raw.github.com/gist/2206428/bp.sh
    # Make sure the script is runnable:
    @@ -14,19 +13,9 @@
    # ./bp.sh <review_number>
    # Recovering from errors
    # ----------------------
    # If you have previously downloaded a branch you will see a failure
    # from git-review -d that branch xxxx/xxxx/xxxx already exists
    # to recover you will need to delete two branches:
    # git branch -D xxxx/xxxx/xxxx
    # git branch -D bp-<review_number>
    # If your branch fails to merge cleanly it is usually due to
    # a dependent branch not being in yet. In that case your best bet
    # is to wait for the dependent branch to merge, then:
    # git checkout <branch>
    # git pull
    # git branch -D xxxx/xxxx/xxxx
    # git branch -D bp-<review_number>
    # and rerun the script
    # is to wait for the dependent branch to merge and rerun the script.

    if [ -z "$1" ]; then
    echo "Usage: $0 <review_number> [branch]"
    @@ -39,6 +28,8 @@ BRANCH=${2-milestone-proposed}

    git review -d $1
    git checkout $BRANCH
    git pull
    git branch -D bp-$1
    git checkout -b bp-$1
    git cherry-pick -x HEAD@{2}
    git review $BRANCH
  6. vishvananda revised this gist Jun 11, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bp.sh
    Original file line number Diff line number Diff line change
    @@ -35,7 +35,7 @@ if [ -z "$1" ]; then
    exit 1
    fi

    BRANCH=${1-milestone-proposed}
    BRANCH=${2-milestone-proposed}

    git review -d $1
    git checkout $BRANCH
  7. vishvananda revised this gist May 10, 2012. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # ------------
    # Make sure that milestone-proposed exists and is up to date:
    # git branch -D milestone-proposed
    # git checkout -b milestone-proposed origin/<branch>
    # git checkout -b <branch> origin/<branch>
    # git pull
    # Grab the file and stick it in your <project> directory:
    # curl -OL https://raw.github.com/gist/2206428/bp.sh
    @@ -29,11 +29,13 @@
    # and rerun the script

    if [ -z "$1" ]; then
    echo "Usage: $0 <review_number> [<branch=milestone-proposed>]"
    echo "Usage: $0 <review_number> [branch]"
    echo " review_number: numeric review number from gerrit"
    echo " branch: target gerrit branch (defaults to milestone-proposed)"
    exit 1
    fi

    $BRANCH=${1-milestone-proposed}
    BRANCH=${1-milestone-proposed}

    git review -d $1
    git checkout $BRANCH
  8. vishvananda revised this gist May 10, 2012. 1 changed file with 9 additions and 7 deletions.
    16 changes: 9 additions & 7 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    #!/usr/bin/env bash
    # This is a little script to make backporting patches to milestone proposed.
    # This is a little script to make backporting patches.
    # Instructions
    # ------------
    # Make sure that milestone-proposed exists and is up to date:
    # git branch -D milestone-proposed
    # git checkout -b milestone-proposed origin/milestone-proposed
    # git checkout -b milestone-proposed origin/<branch>
    # git pull
    # Grab the file and stick it in your <project> directory:
    # curl -OL https://raw.github.com/gist/2206428/bp.sh
    @@ -22,22 +22,24 @@
    # If your branch fails to merge cleanly it is usually due to
    # a dependent branch not being in yet. In that case your best bet
    # is to wait for the dependent branch to merge, then:
    # git checkout milestone-proposed
    # git checkout <branch>
    # git pull
    # git branch -D xxxx/xxxx/xxxx
    # git branch -D bp-<review_number>
    # and rerun the script

    if [ -z "$1" ]; then
    echo "Usage: $0 <review_number>"
    echo "Usage: $0 <review_number> [<branch=milestone-proposed>]"
    exit 1
    fi

    $BRANCH=${1-milestone-proposed}

    git review -d $1
    git checkout milestone-proposed
    git checkout $BRANCH
    git checkout -b bp-$1
    git cherry-pick HEAD@{2}
    git review milestone-proposed
    git cherry-pick -x HEAD@{2}
    git review $BRANCH
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
    HOST=`echo $REMOTE | cut -d':' -f1`
  9. vishvananda revised this gist Apr 4, 2012. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -16,9 +16,7 @@
    # ----------------------
    # If you have previously downloaded a branch you will see a failure
    # from git-review -d that branch xxxx/xxxx/xxxx already exists
    # to recover you will need to delete the branch
    # git branch -D xxxx/xxxx/xxxx
    # If you are re-backporting a branch you will need to do:
    # to recover you will need to delete two branches:
    # git branch -D xxxx/xxxx/xxxx
    # git branch -D bp-<review_number>
    # If your branch fails to merge cleanly it is usually due to
  10. vishvananda revised this gist Apr 4, 2012. 1 changed file with 17 additions and 0 deletions.
    17 changes: 17 additions & 0 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,23 @@
    # chmod 755 bp.sh
    # Start backporting reviews:
    # ./bp.sh <review_number>
    # Recovering from errors
    # ----------------------
    # If you have previously downloaded a branch you will see a failure
    # from git-review -d that branch xxxx/xxxx/xxxx already exists
    # to recover you will need to delete the branch
    # git branch -D xxxx/xxxx/xxxx
    # If you are re-backporting a branch you will need to do:
    # git branch -D xxxx/xxxx/xxxx
    # git branch -D bp-<review_number>
    # If your branch fails to merge cleanly it is usually due to
    # a dependent branch not being in yet. In that case your best bet
    # is to wait for the dependent branch to merge, then:
    # git checkout milestone-proposed
    # git pull
    # git branch -D xxxx/xxxx/xxxx
    # git branch -D bp-<review_number>
    # and rerun the script

    if [ -z "$1" ]; then
    echo "Usage: $0 <review_number>"
  11. vishvananda revised this gist Apr 4, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,6 @@ git review milestone-proposed
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
    HOST=`echo $REMOTE | cut -d':' -f1`
    SHA=`git show-ref HEAD | cut -d' ' -f1`
    SHA=`git rev-parse HEAD`
    echo "Use the following line to approve the review"
    echo "ssh -p $PORT $HOST gerrit approve --submit $SHA"
    echo "ssh -p $PORT $HOST gerrit review --code-review +2 --approved +1 $SHA"
  12. vishvananda revised this gist Mar 30, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -26,6 +26,6 @@ git review milestone-proposed
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
    HOST=`echo $REMOTE | cut -d':' -f1`
    SHA=`git show-ref HEAD | cut -d' ' -f1`"
    SHA=`git show-ref HEAD | cut -d' ' -f1`
    echo "Use the following line to approve the review"
    echo "ssh -p $PORT $HOST gerrit approve --submit $SHA
    echo "ssh -p $PORT $HOST gerrit approve --submit $SHA"
  13. vishvananda revised this gist Mar 28, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bp.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@
    # Make sure that milestone-proposed exists and is up to date:
    # git branch -D milestone-proposed
    # git checkout -b milestone-proposed origin/milestone-proposed
    # git pull
    # Grab the file and stick it in your <project> directory:
    # curl -OL https://raw.github.com/gist/2206428/bp.sh
    # Make sure the script is runnable:
    @@ -19,7 +20,6 @@ fi

    git review -d $1
    git checkout milestone-proposed
    git pull
    git checkout -b bp-$1
    git cherry-pick HEAD@{2}
    git review milestone-proposed
  14. vishvananda revised this gist Mar 26, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion bp.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,8 @@
    #!/usr/bin/env bash
    # This is a little script to make backporting patches to milestone proposed.
    # Make sure that milestone-proposed exists and is up to date
    # Instructions
    # ------------
    # Make sure that milestone-proposed exists and is up to date:
    # git branch -D milestone-proposed
    # git checkout -b milestone-proposed origin/milestone-proposed
    # Grab the file and stick it in your <project> directory:
  15. vishvananda revised this gist Mar 26, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion bp.sh
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    # git branch -D milestone-proposed
    # git checkout -b milestone-proposed origin/milestone-proposed
    # Grab the file and stick it in your <project> directory:
    # curl -OL
    # curl -OL https://raw.github.com/gist/2206428/bp.sh
    # Make sure the script is runnable:
    # chmod 755 bp.sh
    # Start backporting reviews:
  16. vishvananda created this gist Mar 26, 2012.
    29 changes: 29 additions & 0 deletions bp.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #!/usr/bin/env bash
    # This is a little script to make backporting patches to milestone proposed.
    # Make sure that milestone-proposed exists and is up to date
    # git branch -D milestone-proposed
    # git checkout -b milestone-proposed origin/milestone-proposed
    # Grab the file and stick it in your <project> directory:
    # curl -OL
    # Make sure the script is runnable:
    # chmod 755 bp.sh
    # Start backporting reviews:
    # ./bp.sh <review_number>

    if [ -z "$1" ]; then
    echo "Usage: $0 <review_number>"
    exit 1
    fi

    git review -d $1
    git checkout milestone-proposed
    git pull
    git checkout -b bp-$1
    git cherry-pick HEAD@{2}
    git review milestone-proposed
    REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
    PORT=`echo $REMOTE | cut -d':' -f2`
    HOST=`echo $REMOTE | cut -d':' -f1`
    SHA=`git show-ref HEAD | cut -d' ' -f1`"
    echo "Use the following line to approve the review"
    echo "ssh -p $PORT $HOST gerrit approve --submit $SHA