Android OS Forum banner
1 - 20 of 41 Posts

·
Premium Member
Joined
·
1,155 Posts
This guide assumes the followingFurther readingRegister and setup your username

First, you need to register at www.gerrit.sudoservers.com. Pick a username and remember it.

Alright, now on to the terminal commands

First, we need to set the username and email

git config --global review.gerrit.aokp.co.username <username you registered with>

git config --global review.gerrit.aokp.co.email <your email you registered with>

Next, we need to setup your SSH keys. First, test out if you have keys setup



You can see that I have keys already (the files id_rsa and id_rsa.pub indicate that you've already generated them). If you DO NOT see them continue reading. If you do see them, you can skip down.

Creating Keys

type this into your terminal

ssh-keygen -t rsa -C "[email protected]"

Checkout Github's OS X and Linux guides on setting up your SSH keys.

Adding Keys to Gerrit

After you've created your keys, you basically need to copy the contents of your ~/.ssh/id_rsa.pub file. You can do this a couple ways. Either open up the file in a text editor and copy the contents, or run this terminal command

cat ~/.ssh/id_rsa.pub

Then select all the text it give you.

See how I got everything it outputted to the last character? Do that. Copy it. Go to Gerrit > Settings > SSH Public Keys. Click Add Key, then paste what you copied into the box. Click save. Done.

Making Changes to Upload

I'm going to assume you have all of the source synced from this point out.

So to show you guys how to use this, I'm going to just make some dummy changes to ROM Control.

Let's say I'm going to write some translations for ROM Control. First thing I need to do is start a repo project that we can upload to gerrit later.


Here's how it works

repo start <BRANCH NAME> <Projects you wish to start this branch on>

Notice how when I go into ROMControl I'm already in the translations branch. You need to make sure your branch is clean, or doesn't have any unwanted changes. Please please make your gerrit submissions AS CLEAN AS POSSIBLE.

Alright, now let's assume you already made some changes and you haven't run repo start yet.

Notice it says I'm not on a branch, and when I typed in git status, it says I have changes. I've also ran git diff just to show you what's different.

Now, before committing the changes, we need to run repo start again, just as we would before.



This time, I typed in git start translations . since I was already in the ROMControl directory, I just need to tell repo that the project is in this directory.

Alright. Now we're ready to commit the change.

Committing to Github



First, add the files to the commit that you wish to include.

git add -A

Running this command will include ALL modified files in the commit. You can check what files will be committed by running git status. Next, we need to commit.

git commit -s

This will bring up the commit window allowing you to write a summary of your changes, followed by any details you wish to add. Your git commit command may bring up a different editor, that's beyond the scope of this tutorial if you don't know how to use it, but ask around and I'm sure people will help.

Once it's been committed, you'll be able to see the "commit successful" string and you'll be able to see your change at the top when you type in git log


So we've committed the change to your local git repository. Now we need to upload it to gerrit.

repo upload .

If it's successful, you will see a message like shown above. And you'll be able to see the commit on the gerrit site right after.



Making changes to your Gerrit commits

This is probably the most important part of the tutorial. Many times you need to make changes to your submission to fix a bug, or a typo or something. If you don't do it the right way, it is easily possible to upload a whole new change instead of updating the one that already exists.

So first let me make some changes to my files that I want to include in this specific commit.

I've just added another line to my strings.xml file.

Be very careful here. We need to do a few things. First, so that gerrit will recognize we are changing a change already present in its system, we need to get the change id.



You can click on the change-id itself to copy it, or you can just click the little copy button on the right. That's what I usually do. After clicking it, the following should be in your clipboard:

Change-Id: I2d15c15b07735dbf2d059d7a2e3eb21f330f2e9e

Back to the terminal/console now. We need to tell git which files we want changed. Type git status to see what's happening and what's added or not. Add your new changes as normal.

So now that we have the change ID, we need to AMEND our commit, not make a new one.


I just did a git add -A again. Ok. Now we're ready to amend our previous commit.

git commit --amend

You should get the your previous commit message ready for modifying. We need to add that commit-id we previously got to the very BOTTOM of the commit message so that gerrit can properly parse it.

Notice how my Change-Id is at the VERY BOTTOM of the commit message, below my sign-off. Now save the commit message and we can repo upload again.


After uploading, your changes should be in THE SAME gerrit submission page. This is extremely important that you do it this way and not just by submitting another commit.

 

·
Aspiring Android
Joined
·
324 Posts
I was having trouble getting my "repo upload ." command to work because

1. I hadn't set my username in the gerrit settings page, and
2. I needed to run the command "ssh-add" after configuring all the public key stuff.

Once I got that straightened out, I was able to upload my changes without problems. Thanks AOKP team!
 

·
App Developer
Joined
·
238 Posts
Can anyone help me out here? I'm familiar with Git/command line, but not Gerrit. I'm registered, my keys are registered on the website, but for the life of me, I can't get "repo upload." to work.

My error with Trackback:
Code:
<br />
Traceback (most recent call last):<br />
  File "/Volumes/AOKP/aokp/.repo/repo/main.py", line 385, in <module><br />
    _Main(sys.argv[1:])<br />
  File "/Volumes/AOKP/aokp/.repo/repo/main.py", line 365, in _Main<br />
    result = repo._Run(argv) or 0<br />
  File "/Volumes/AOKP/aokp/.repo/repo/main.py", line 137, in _Run<br />
    result = cmd.Execute(copts, cargs)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/subcmds/upload.py", line 386, in Execute<br />
    self._MultipleBranches(opt, pending, people)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/subcmds/upload.py", line 265, in _MultipleBranches<br />
    self._UploadAndReport(opt, todo, people)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/subcmds/upload.py", line 314, in _UploadAndReport<br />
    branch.UploadForReview(people, auto_topic=opt.auto_topic)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/project.py", line 182, in UploadForReview<br />
    auto_topic=auto_topic)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/project.py", line 906, in UploadForReview<br />
    raise GitError('remote %s has no review url' % branch.remote.name)<br />
error.GitError: remote gh has no review url<br />
Any help is greatly appreciated! I can't wait to get this sorted out so I can help contribute to AOKP!
 

·
Premium Member
Joined
·
1,812 Posts
Can anyone help me out here? I'm familiar with Git/command line, but not Gerrit. I'm registered, my keys are registered on the website, but for the life of me, I can't get "repo upload." to work.

My error with Trackback:
Code:
<br />
Traceback (most recent call last):<br />
  File "/Volumes/AOKP/aokp/.repo/repo/main.py", line 385, in <module><br />
	_Main(sys.argv[1:])<br />
  File "/Volumes/AOKP/aokp/.repo/repo/main.py", line 365, in _Main<br />
	result = repo._Run(argv) or 0<br />
  File "/Volumes/AOKP/aokp/.repo/repo/main.py", line 137, in _Run<br />
	result = cmd.Execute(copts, cargs)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/subcmds/upload.py", line 386, in Execute<br />
	self._MultipleBranches(opt, pending, people)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/subcmds/upload.py", line 265, in _MultipleBranches<br />
	self._UploadAndReport(opt, todo, people)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/subcmds/upload.py", line 314, in _UploadAndReport<br />
	branch.UploadForReview(people, auto_topic=opt.auto_topic)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/project.py", line 182, in UploadForReview<br />
	auto_topic=auto_topic)<br />
  File "/Volumes/AOKP/aokp/.repo/repo/project.py", line 906, in UploadForReview<br />
	raise GitError('remote %s has no review url' % branch.remote.name)<br />
error.GitError: remote gh has no review url<br />
Any help is greatly appreciated! I can't wait to get this sorted out so I can help contribute to AOKP!
When was the last time you repo sync'd or even checked the repo init? it looks like you don't have a review url set ... which tells me you are out of sync with AOKP platform_manifest
 

·
App Developer
Joined
·
238 Posts
When was the last time you repo sync'd or even checked the repo init? it looks like you don't have a review url set ... which tells me you are out of sync with AOKP platform_manifest
I synced previously before making the changes, and I literally just Repo sync'd, same error.
 

·
Premium Member
Joined
·
1,812 Posts
I synced previously before making the changes, and I literally just Repo sync'd, same error.
When you did your repo init .. did you use the -b master switch or -b ics .... not too long ago we switched a lot of the branches around. If you didn't re do your repo init at that time, you are still pulling the platform_manifest and other code from older branches.

I would suggest you manually compare your platform_manifest/default.xml to the one posted on our github. If they aren't the same (which includes the review url), then you like need to redo your repo init command.
 

·
App Developer
Joined
·
238 Posts
When you did your repo init .. did you use the -b master switch or -b ics .... not too long ago we switched a lot of the branches around. If you didn't re do your repo init at that time, you are still pulling the platform_manifest and other code from older branches.

I would suggest you manually compare your platform_manifest/default.xml to the one posted on our github. If they aren't the same (which includes the review url), then you like need to redo your repo init command.
I definitely did -b master. I just compared the default.xml and there lies my problem, they are different. Going to resync with -b ics now!

EDIT: Just want to say that using -b ics worked and I was able so successfully add some changes to Gerrit! Thanks Team AOKP, hope you like my first addition, hopefully many more to come in the future!
 

·
Dev and Samsung Leaker
Joined
·
332 Posts
Thanks romann. Gerrit and I have never gotten along, I always had to get Wes Garner to submit my changes to CM Gerrit for CM Kernel fixes. This guide will help me a lot.

I'll be submitting the device tree/vendor stuff for Encore (Nook Color) this week.
 

·
Premium Member
Joined
·
1,155 Posts
How do you go about pulling a change from say cyanogenmod and uploading it for review and giving the original author credit?

This is the change I want to submit but want to give proper credit to the author.

http://r.cyanogenmod.com/#/c/15588/

Sent from my Galaxy Nexus using Tapatalk 2
Good question,

repo start a new branch in the proper project, then cherry pick the change (it would be
Code:
git fetch [URL=http://r.cyanogenmod.com/CyanogenMod/android_packages_apps_Contacts]http://r.cyanogenmod.com/CyanogenMod/android_packages_apps_Contacts[/URL] refs/changes/88/15588/1 && git cherry-pick FETCH_HEAD
in this case) and then just do
Code:
repo upload .
 

·
Registered
Joined
·
9 Posts
Thanks Roman.

Ignore my previous entry on this post. Got it to upload and working perfectly now. Again thanks a bunch roman hopefully I can cherry pick a few more gems in the future. Having not coded in 10+ years, I think this is the best way for me to contribute!

Sent from my Galaxy Nexus using Tapatalk 2
 

·
Steel Droid ROM Developer
Joined
·
74 Posts
I have tried for two days to get my repo upload to work. I have read through multiple posts, and tried every guide I can find. I keep getting errors about "Permissions denied: Public key". I got an SSH test connection to WORK.....ONCE. But I dont know what I did. Im still stuck not being able to do the upload. I have everything else working, like git commit, add, and all that, just cant get it to upload. I want to help contribute to AOKP, but Im just not getting anywhere. Ughhhh
 

·
App Developer
Joined
·
238 Posts
I have tried for two days to get my repo upload to work. I have read through multiple posts, and tried every guide I can find. I keep getting errors about "Permissions denied: Public key". I got an SSH test connection to WORK.....ONCE. But I dont know what I did. Im still stuck not being able to do the upload. I have everything else working, like git commit, add, and all that, just cant get it to upload. I want to help contribute to AOKP, but Im just not getting anywhere. Ughhhh
You have copy/pasted your public key into your settings on the AOKP Gerrit website, right? The steps are similar to Github's: http://help.github.com/mac-set-up-git/
 

·
Steel Droid ROM Developer
Joined
·
74 Posts
Followed that to the T, and added my info to gerrit.sudoservers.com in the SSH-keys section, just like it said. Im new to gerrit and GIT as well, but Im usually very good with computers (certified technician for about 14 years). This just doesnt seem to work for me.
 

·
Registered
Joined
·
11 Posts
Good question,

repo start a new branch in the proper project, then cherry pick the change (it would be
Code:
git fetch [URL=http://r.cyanogenmod.com/CyanogenMod/android_packages_apps_Contacts]http://r.cyanogenmod.com/CyanogenMod/android_packages_apps_Contacts[/URL] refs/changes/88/15588/1 && git cherry-pick FETCH_HEAD
in this case) and then just do
Code:
repo upload .
I have a scenario...
suppose i have made changes to a project and also successfully uploaded the changes to sudo gerrit review. Now on the same project and the same branch, i made say, two more commits but i havent uploaded this commits to gerrit. Now I realize the commit which I uploaded to gerrit needs some change(patch set 2). Now if I make changes and do git commit --amend, it will show me the last commit. I want to amend the changes which is at HEAD~3..

how to achieve this?
 
1 - 20 of 41 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top