How to properly run repo sync after forking AOSP manifest? - android-source

Recently I decided to dive into the Android Open Source Project world. This is how I picture my life will be with AOSP:
In order to dig into the AOSP world, I need to get my hands dirty and modify code in the projects. And I am going to do it on three different computers so I need to store my work in remote git repositories. So I need to fork the AOSP manifest in my own github account and work from that.
Say later I try to play with the frameworks project, then I need to fork this project into my own github account as well:
<project path="frameworks/base" name="platform/frameworks/base" groups="pdk-cw-fs,pdk-fs" />
Ideally, when I do a local repo sync, the frameworks/base project will be fetched from my own github account and all other projects will be fetched from google git repo.
Here is what I did in action:
What I want to do is forking the AOSP manifest git repo to my github and work from there. Then I do:
repo sync -u git#github.com:my_own_github_account/platform_manifest.git
Then I do:
repo sync
However I received a lot of error in the console like:
fatal: remote error:
my_own_github_account/platform/external/libopus is not a valid repository name
Email support#github.com for help
It seems repo will assume the projects will come from the same base as the manifest project. I am not sure how to properly do a repo sync with a forked manifest.
Additionally, I am not sure if the way I tried to start work on AOSP is silly or unprofessional. If so I will appreciate it if you can point me to the right way of doing it. Thanks in advance.

Actually I found this post here almost perfectly answered my question: https://www.primianotucci.com/blog/fork-android-on-github.
The reason I cannot do repo sync is because of this line in repo file:
<remote name="aosp"
fetch=".."
review="https://android-review.googlesource.com/" />
The two dots means fetching projects relative to the repo manifest project itself. That's why repo is trying to sync from my_own_github_account
Then I changed it to
<remote name="aosp"
fetch="https://android.googlesource.com" />
Then the repo sync works properly.
What if for a specific project I want to sync from my own github account?
Of course you need to mirror that project to your own github account. Then modify the manifest file like this:
Add this line to manifest file:
<remote name="origin" fetch="https://github.com/my_own_github_account" />
The name is the remote fetching source you want to use for your own sub project.
Then add this:
<project path="frameworks/base" name="platform/base"
remote="origin" revision="your_default_revision" />
Note that in order to override the default remote fetching source you need to add remote="origin".
Then when you do repo sync, repo will fetch framework/base from your own github account and fetch other projects from google source.

Related

How to download and re-upload a repository?

I'm new to using GitHub and most of the resources online are beyond my understanding.
A few years ago I had to commit certain labs and assignments to GitHub, and the repositories were in a "classroom." Forking is disabled on these projects. I don't remember much, other than that we cloned the projects and edited/pushed from Eclipse.
I've long deleted the local copies of the projects I had, and I'm hoping to showcase some of them on my profile. However, even after a few tutorials from GitHub, I don't know how I'm supposed to download the "classroom" repository locally and then re-upload it to GitHub on my own account.
When I download a zip file of a given project, I re-attain a local copy of the project. But when I try to upload it via GitHub desktop, there are issues. I can't upload folders, which is a problem. When I try uploading everything inside the folders, github desktop buffers for ages and doesn't finish the task.
It feels like my question is so basic that I can't find pointers on it, since it's taken for granted that people know how to do this. Any pointers would be hugely appreciated.
You should be able to just fork it from the "classroom" repository again if you're just trying to get the original project. Then you can git clone your forked repo.
If that isn't an option you can git clone the "classroom" to your local machine. And create a new repo on your Github where you want the project to eventually be saved. Then go back to the local project you cloned and push the local copy back to your new repo:
git push --mirror <urlOfYourNewRepo>

Import existing file folder to IBM Watson Application

I have downloaded on my PC this IBM Watson project:
https://github.com/watson-developer-cloud/conversation-simple/
and following its tutorial I've uploaded it on my IBM dashboard.
The problem is that everytime I want to change somethink in the project I've to re-upload it with the command line command cf push.
When I go in the Toolchain section, I can't see all the files and their folders, but only create a new repository or clone it, but in both case I haven't resolved my problem.
How can I resolve this problem?
Try to use:
cf push APP_NAME
Obs.: cf push does not support incremental upload. It will simply push everything in the folder to the cloud.
If your node_modules in the folder which resulted in a large-size upload. Try to specify what to exclude in a .cfignore file.
Example .cfignore file contents:
tmp/
node_modules/
my_unnecessary_file.txt
When executing your next cf push for deploying the application it will omit the files and directories listed in your .cfignore file.
See more about CF PUSH.
See more deploy applications with CF CLI.
It doesn't change anything, because when you create a toolchain it ask you to select between:
- New
- Clone
- Fork
and I tried all these options but going in the web eclipse editor files don't appear.
This s the git repository of my app:
https://git.ng.bluemix.net/consultagiovanilepolizzi/official-app2
How can I import with Git an existing project in my computer to edit it with toolchain?
As it seems that you are working with the Continuous delivery, instead of uploading your app using cf push, you are going to use the toochain.
The fist step is to use the git repository, you need to create a ssh key or an access token, if you prefer to connect through https, the access token can be created in the Bluemix git, going into the settings of your user, then Access Tokens
After that, you can push your app to the repository using a git tool, the user name will be your IBM account, and the password your token.
In the delivery pipeline, the build stage checks you repository for new commits into the master, by default, and start a new build, sending to the deploy if successful.
Those links below can give you more details
Using git Repos
Setting up local clients
Delivery Pipeline

How to integrate LazyBones with VCS?

I just learned about LazyBones and absolutely love it! The problem is that it generates a "code skeleton" for you before your app's VCS repo exists. And I see there is some integration capability with Git, but what about other VCSes?
Specifically, I'm using Mercurial. So ordinarily, I'd create the hg repo for my new app (on the server), clone it out locally, and some code to the cloned working copy, commit & push it.
So I ask: what is the proper workflow (or set of commands) to create a new app from a LazyBones template and integrate it with a new hg repo?
I suppose, slightly more elegant way may be:
Generate skeleton by LazyBones in SomeDir
Init Mercurial repo after it in SomeDir
Add needed files from working directory into (empty) repository
Create remote repo on server
Add remote repository URL into [path] section of local repo's .hgrc (maybe also auth. credential into [auth])
Push

Am I using EGit and Eclipse correctly when working with repositories?

I'm trying to set up EGit with Eclipse and I've used neither of them before. I understand the basics around Git and Eclipse is more or less just another IDE. The problem I'm having is setting up a reasonable work environment.
I have file-server at home which I want to use as a Bare repository which I push and pull changes to. To test it out I've done the setup locally.
I have a bare repository created through the Git Repository perspective.
I've cloned that repository into a local non-bare repository.
I've created a project in a subdir of the non-bare repository (is this the way to go? Is it possible to do have the project directly in the workspace with the .git folder within it? So far I've had a lot of trouble with it when trying to create an Eclipse project out of it. What is the proper way to do it?)
I've made some changes to this cloned repository and added the indexes, committed the changes and attempted to push the changes to upstream.
The thing is that no changes are made to upstream. Would someone like to explain the procedure in doing the push so that I'm not misunderstanding something? Or am I completely wrong on utilizing a bare repository instead of just working non-bare?
As mentioned in this tutorial, you create your Git repo right where your project is (ie your .classpath and .project files are).
Pushing to a bare repo is a good idea (see the links mentioned in "Git - pull & push - production server")
You need though to specify what you want to push:
Click at least on "Add all branch spec".

Is it safe for multiple users to use a Git repo on a shared network drive?

We're using Eclipse (with the eGit plugin) and I want to host a repo on a shared network drive that several users have write access to.
Can users all point at the same original repo (on the shared drive) or would it be better for each user to clone the repo to their local drive, work off this local version, and push changes to the networked original as required?
Eclipse seems to allow you to "import" (to your Eclipse workspace) a project from a Git repo, but that imported project doesn't seem to be monitored by Git until you choose to "Share project". At this step the working directory becomes that of the repo's working dir for that project. Presumably all users sharing this project would have the same working dir i.e. that of the repo on the shared drive.
I am not clear on the implications of this, but it doesn't seem like a good idea, on first inspection! How will it handle basic problems like 2 users trying to open the same file for editing simultaneously, for instance?
Thanks.
It's better that each person has their own repo.
Clone you current repository as a bare repo and place it on the network drive.
e.g.
git clone --bare /path/to/current/cool_project cool_project.git
Move the cool_project.git to your network drive, and get everyone to clone from that. Bare repos don't have a working directory, hence the name, so they are safe to push to.
See the chapter 4 of the Git Pro book - Git on a Server, and specifically chapter 4.2 for more details.
From the sound of it you are talking about each user pointing to the git repository over the network and not having individual git repositories on each developer's computers and then pushing to a 'central' repository. If I am correct in reading your question that is not a great way to take advantage of what git has to offer. Git is a distributed version control system so everyone should have their own repository and push the changes to a central repository that you do your CI builds off of.