On Tue, Mar 27, 2018 at 02:16:32PM +0300, Ram Rachum wrote: > Hi, > > Is there a way to do `git review -d` without having it do a checkout? i.e. > I just want to have these commits in my Git database so I could cherrypick > them on some other branch. We've got tons of submodules so checking out > often creates problems. > > I tried `git fetch gerrit my_commit_hash:temporary_branch_name` but that's > insanely slow for some reason.
Thanks more or less what I do.
This is my ~bin/git-os-change
---
#!/usr/bin/env bash
review=$1
revision=${2:-1}
if [ -z "$review" ] ; then
echo Need an OpenStack gerrit review number >&2
exit 1
fi
ref=$(printf "refs/changes/%d/%d/%d" "${review: -2}" "${review}" "${revision}")
git fetch gerrit "${ref}:${ref}"
---
It's about the same speed as git review.
---
[tony@thor ~]$ cd tmp
/home/tony/tmp
[tony@thor tmp]$ cp -a ~/projects/openstack/openstack-dev/devstack devstack-1
[tony@thor tmp]$ cp -a ~/projects/openstack/openstack-dev/devstack devstack-2
[tony@thor tmp]$ cd devstack-1
/home/tony/tmp/devstack-1
[tony@thor devstack-1]$ time git review -d 554977
Downloading refs/changes/77/554977/3 from gerrit
Switched to branch "review/eric_berglund/etcd_version"
real 0m3.892s
user 0m0.508s
sys 0m0.225s
[tony@thor devstack-1]$ cd ../devstack-2
[tony@thor devstack-2]$ time git os-change 554977 3
remote: Counting objects: 7, done
remote: Finding sources: 100% (4/4)
remote: Total 4 (delta 3), reused 3 (delta 3)
Unpacking objects: 100% (4/4), done.
From ssh://review.openstack.org:29418/openstack-dev/devstack
* [new ref] refs/changes/77/554977/3 -> refs/changes/77/554977/3
real 0m2.813s
user 0m0.182s
sys 0m0.152s
---
Yours Tony.
signature.asc
Description: PGP signature
_______________________________________________ OpenStack-Infra mailing list [email protected] http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra
