How to commit changes using repo tool with gerrit?

1,342 views
Skip to first unread message

Baz

unread,
Jul 15, 2011, 2:12:55 AM7/15/11
to repo-d...@googlegroups.com
All,

Thank you for all the previous replies to help me setting up gerrit. I am now able to commit changes back to gerrit with git commands. I am reading some of the webpages and looks like I can use repo tool with gerrit as well. It seems to be a better way? Here is the web page that I read, http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit

Here is a list of what I have done, however, I failed to commit, why?

1. Create manifest.xml that point to gerrit...

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote  name="git"
           fetch="ssh://username@gerrit_host:29418/"
           review="ssh://username@gerrit_host:29418/" />

  <default revision="master"
           remote="git" />

   <project path="testrepo_gerrit3"  name="testrepo_gerrit3"   remote="git" revision="master" />
</manifest>

2. Initiate the repo in local workspace

repo init -u ssh://username@gerrit_host:29418/manifest

3. Get the project testrepo_gerrit3 from gerrit

repo sync

4. Make the changes by making a new branch using repo. This is the recommended way to do things?

repo start test_branch testrepo_gerrit3

5. Commit.

git commit -a

6. Upload the changes back to gerrit.

repo upload testrepo_gerrit3

Now I am having errors, why?

username@ubuntu:~/works/repo_gerrit$ repo upload testrepo_gerrit3
Upload project testrepo_gerrit3/:
  branch test_branch ( 1 commit, Tue Jul 12 07:47:51 2011 -0700):
         61339ee5 Added another test on 7/14.
to ssh://username@gerrit_host:29418/ (y/n)? yes
Traceback (most recent call last):
  File "/home/username/works/repo_gerrit/.repo/repo/main.py", line 238, in <module>
    _Main(sys.argv[1:])
  File "/home/username/works/repo_gerrit/.repo/repo/main.py", line 220, in _Main
    repo._Run(argv)
  File "/home/username/works/repo_gerrit/.repo/repo/main.py", line 125, in _Run
    cmd.Execute(copts, cargs)
  File "/home/username/works/repo_gerrit/.repo/repo/subcmds/upload.py", line 371, in Execute
    self._SingleBranch(opt, pending[0][1][0], people)
  File "/home/username/works/repo_gerrit/.repo/repo/subcmds/upload.py", line 183, in _SingleBranch
    self._UploadAndReport(opt, [branch], people)
  File "/home/username/works/repo_gerrit/.repo/repo/subcmds/upload.py", line 305, in _UploadAndReport
    branch.UploadForReview(people, auto_topic=opt.auto_topic)
  File "/home/username/works/repo_gerrit/.repo/repo/project.py", line 166, in UploadForReview
    auto_topic=auto_topic)
  File "/home/username/works/repo_gerrit/.repo/repo/project.py", line 853, in UploadForReview
    if branch.remote.ReviewProtocol == 'ssh':
  File "/home/username/works/repo_gerrit/.repo/repo/git_config.py", line 566, in ReviewProtocol
    info = urlopen(u).read()
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1185, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1126, in do_open
    h = http_class(host, timeout=req.timeout) # will parse host:port
  File "/usr/lib/python2.7/httplib.py", line 693, in __init__
    self._set_hostport(host, port)
  File "/usr/lib/python2.7/httplib.py", line 718, in _set_hostport
    raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port: ''

How should I fix it? Thanks. B.

Magnus Bäck

unread,
Jul 15, 2011, 4:53:15 AM7/15/11
to repo-d...@googlegroups.com
On Friday, July 15, 2011 at 08:12 CEST,
Baz <bazt...@gmail.com> wrote:

> Thank you for all the previous replies to help me setting up gerrit. I
> am now able to commit changes back to gerrit with git commands. I am
> reading some of the webpages and looks like I can use repo tool with
> gerrit as well. It seems to be a better way? Here is the web page
> that I read,
> http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
>
> Here is a list of what I have done, however, I failed to commit, why?
>
> 1. Create manifest.xml that point to gerrit...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <manifest>
> <remote name="git"
> fetch="ssh://username@gerrit_host:29418/"
> review="ssh://username@gerrit_host:29418/" />

The review attribute should point to the HTTP URL of your Gerrit. Repo
will tack on /ssh_info to that URL to obtain the SSH configuration. So,
assuming http://gerrit_host leads to your Gerrit UI:

<remote name="git"
fetch="ssh://username@gerrit_host:29418/"

review="http://gerrit_host" />

Or:

<remote name="git"
fetch="ssh://username@gerrit_host:29418/"

review="gerrit_host" />

Also, you don't want to specify the username in the manifest as it's
typically shared among all users. You can use the insteadOf feature
of .gitconfig and/or the SSH client's configuration to control this
so that you just need to enter the protocol and hostname in the
manifest.

[...]

> 6. Upload the changes back to gerrit.
>
> repo upload testrepo_gerrit3
>
> Now I am having errors, why?

The error is caused by the bad review attribute explained above.

[...]

--
Magnus Bäck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson

Baz

unread,
Jul 18, 2011, 2:02:52 PM7/18/11
to repo-d...@googlegroups.com
Any ideas?

Baz

unread,
Jul 19, 2011, 5:32:45 AM7/19/11
to Magnus Bäck, repo-d...@googlegroups.com
Magnus, sorry that i keep missing your replies. I am not sure what happen. I have all replies for everyone but you. Shouldn't your reply goes with this email thread? I will try to find it and let you know if i cannot find it.

On Tue, Jul 19, 2011 at 1:11 AM, Magnus Bäck <magnu...@sonyericsson.com> wrote:
On Monday, July 18, 2011 at 20:02 CEST,
    Baz <bazt...@gmail.com> wrote:

> Any ideas?

Again, I did respond to your question. Look in the archives.

Baz

unread,
Jul 19, 2011, 5:37:00 AM7/19/11
to Magnus Bäck, repo-d...@googlegroups.com
I don't see it from inbox and I have not archive anything. Would you please resend it to the group? Thank you. B.

Manuel Doninger

unread,
Jul 19, 2011, 6:42:55 AM7/19/11
to Baz, repo-d...@googlegroups.com

baztheman

unread,
Jul 19, 2011, 1:15:58 PM7/19/11
to repo-d...@googlegroups.com, repo-d...@googlegroups.com
After changing the review link, when commit, I have the following error... Does it require another set of ssh permission? I have tested the gerrit ssh/account access without any issues.

Here is how I tested the ssh/account access:

ssh -p 29418 username@gerrit_host

Commit error from repo tool:

username@ubuntu:~/works/repo_gerrit2/testrepo_3$ git commit -a
[topic_branch1 8138e0e] Workflow test 7/19.
 1 files changed, 2 insertions(+), 0 deletions(-)
username@ubuntu:~/works/repo_gerrit2/testrepo_3$ repo sync

username@ubuntu:~/works/repo_gerrit2/testrepo_3$ repo upload
Upload project testrepo_3/:
  branch topic_branch1 ( 1 commit, Tue Jul 12 18:27:21 2011 -0700):
         8138e0e1 Workflow test 7/19.
to http://gerrit_host.companyname.com:8080/ (y/n)? y
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

----------------------------------------------------------------------
[FAILED] testrepo_gerrit3/ topic_branch1   (Upload failed)

Baz

unread,
Jul 19, 2011, 3:24:38 PM7/19/11
to repo-d...@googlegroups.com
I used "repo --trace" trying to debug the issue, here is the last few lines from the output:

: git push --receive-pack=gerrit receive-pack ssh://firstname.lastname@gerrit_host.company_name.com:29418/testrepo_3 refs/heads/topic_branch1:refs/for/master
Permission denied (publickey).

Where is "firstname.lastname" in the "ssh://" line coming from? I checked the ~/.ssh/config and ~/.gitconfig files already but didn't affect the error. Any ideas?

--

Emmanuel Grumbach

unread,
Jul 20, 2011, 4:50:54 AM7/20/11
to Baz, repo-d...@googlegroups.com
On Tue, Jul 19, 2011 at 22:24, Baz <bazt...@gmail.com> wrote:
> I used "repo --trace" trying to debug the issue, here is the last few lines
> from the output:
>
> : git push --receive-pack=gerrit receive-pack
> ssh://firstname.lastname@gerrit_host.company_name.com:29418/testrepo_3
> refs/heads/topic_branch1:refs/for/master
> Permission denied (publickey).
>
> Where is "firstname.lastname" in the "ssh://" line coming from? I checked
> the ~/.ssh/config and ~/.gitconfig files already but didn't affect the
> error. Any ideas?
>

probably your EMAIL env variable
or your email in .gitconfig

Nasser Grainawi

unread,
Jul 20, 2011, 10:26:33 AM7/20/11
to Emmanuel Grumbach, Baz, repo-d...@googlegroups.com

I think it's either the first part of user.email in .git/config in testrepo_3 or that first part of user.email in ~/.gitconfig. You can override it using review."gerrit_host.comany_name.com".username as documented in 'repo help upload'.

Nasser

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

Reply all
Reply to author
Forward
0 new messages