Mirroring the sources cloned with repo

415 views
Skip to first unread message

kanagesh radhakrishnan

unread,
Dec 9, 2008, 8:00:55 AM12/9/08
to repo-d...@googlegroups.com
Hello All,

I am developing applications with Android on a custom ARM based
platform. There are multiple users making change to the Android code
for the custom platform. I need to keep a version control system for
all these changes locally and ensure that it is made available to
every other developer withing the team. Therefore, each developer
commits his/her changes locally and generates patches. These patches
will go in to the local Android source repository, from where other
developers can pull in the changes.

I've attempted to show this with an ASCII diagram :-)


---------------------------------------------------------
| Android sources on
Google Server |

---------------------------------------------------------
|
|

---------------------------------------------------------
| Android sources on
local Server | (192.168.10.1)

---------------------------------------------------------
|

|
--------------------------------------------------------------------------------------------------------------------------------------------
| |
| |
|
Developer. 1 Developer 2
Developer 3 Developer 4 Developer 5


I tried to publish the GIT repositories that are cloned on the local
server as a result of 'repo sync'. I am having problems cloning the
published tree.

$ git-clone git://192.168.10.1/bionic.git
Initialized empty Git repository in
/home/user/work/local-copy/bionic/.git/
remote: Counting objects: 1876, done.
remote: Compressing objects: 100% (867/867), done.
remote: Total 1876 (delta 981), reused 1875 (delta 981)
Receiving objects: 100% (1876/1876), 1.41 MiB, done.
Resolving deltas: 100% (981/981), done.
/usr/bin/git-clone: line 451: cd:
/home/user/work/local-copy/bionic/.git/refs/remotes/origin: No such
file or directory

This is because the published bionic GIT repository does not have
a .git/refs/remotes/origin folder but has .git/refs/remotes/korg.

In the manifest file, for starters, I am trying to sync only the
bionic sources. The manifest file that the developer uses to sync
from the local server reads as follows:
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<manifest branch="master">
<remote name="korg"
fetch="git://192.168.10.1/" />
<default revision="master"
remote="korg" />

<project path="bionic" name="bionic" />
</manifest>
------------------------------------------------------------------------
However, when I do a repo sync with this manifest file, I see the
following errors:

Initializing project bionic ...
Traceback (most recent call last):
File "/home/user/work/local-repo/.repo/repo/main.py", line 202, in <module>
_Main(sys.argv[1:])
File "/home/user/work/local-repo/.repo/repo/main.py", line 186, in _Main
repo._Run(argv)
File "/home/user/work/local-repo/.repo/repo/main.py", line 96, in _Run
cmd.Execute(copts, cargs)
File "/home/user/work/local-repo/.repo/repo/subcmds/sync.py", line
106, in Execute
if not project.Sync_LocalHalf():
File "/home/user/work/local-repo/.repo/repo/project.py", line 580,
in Sync_LocalHalf
self._InitWorkTree()
File "/home/user/work/local-repo/.repo/repo/project.py", line 981,
in _InitWorkTree
rev = self.bare_git.rev_parse('%s^0' % rev)
File "/home/user/work/local-repo/.repo/repo/project.py", line 1164, in runner
p.stderr))
error.GitError: bionic rev-parse: fatal: ambiguous argument
'refs/remotes/korg/master^0': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions


How do I mirror the sources cloned from the Google repository on my
local server?

Any pointers would help! Thank you for your time

Regards,
Kanagesh

Shawn Pearce

unread,
Dec 9, 2008, 11:03:56 AM12/9/08
to repo-d...@googlegroups.com
On Tue, Dec 9, 2008 at 05:00, kanagesh radhakrishnan <rkan...@gmail.com> wrote:

I am developing applications with Android on a custom ARM based
platform.  There are multiple users making change to the Android code
for the custom platform.  I need to keep a version control system for
all these changes locally and ensure that it is made available to
every other developer withing the team.  Therefore, each developer
commits his/her changes locally and generates patches.  These patches
will go in to the local Android source repository, from where other
developers can pull in the changes.

I've attempted to show this with an ASCII diagram :-)

Sadly the diagram didn't come through correctly.
 
---------------------------------------------------------
                                                 | Android sources on
Google Server |

Uh, you mean android.git.kernel.org?  That isn't a Google owned server.  Hosting is donated by the kernel.org foundation (or whatever their legal name is), just like they donate hosting for a number of other projects based upon or related to the Linux kernel, including the Linux kernel itself.

I tried to publish the GIT repositories that are cloned on the local
server as a result of 'repo sync'.  I am having problems cloning the
published tree.

  $ git-clone git://192.168.10.1/bionic.git
     Initialized empty Git repository in
/home/user/work/local-copy/bionic/.git/
     remote: Counting objects: 1876, done.
     remote: Compressing objects: 100% (867/867), done.
     remote: Total 1876 (delta 981), reused 1875 (delta 981)
     Receiving objects: 100% (1876/1876), 1.41 MiB, done.
     Resolving deltas: 100% (981/981), done.
     /usr/bin/git-clone: line 451: cd:
/home/user/work/local-copy/bionic/.git/refs/remotes/origin: No such
file or directory

Uhm, that looks like a bug in git-clone to me.  You might want to take it up with the git ML if you have a good reproduction case.  You may also want to just upgrade to the latest stable release (git 1.6.0.5).
 
   This is because the published bionic GIT repository does not have
a .git/refs/remotes/origin folder but has .git/refs/remotes/korg.

I doubt that's the problem.  I know the mess that is git clone, it doesn't care about that...
 
In the manifest file, for starters, I am trying to sync only the
bionic sources.  The manifest file that the developer uses to sync
from the local server reads as follows:
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<manifest branch="master">
 <remote  name="korg"
          fetch="git://192.168.10.1/" />
 <default revision="master"
          remote="korg" />

 <project path="bionic" name="bionic" />
</manifest>
------------------------------------------------------------------------

Looks OK, though I wouldn't call the remote "korg" myself since its your internal server.
 
However, when I do a repo sync with this manifest file, I see the
following errors:

Initializing project bionic ...
Traceback (most recent call last):
...
error.GitError: bionic rev-parse: fatal: ambiguous argument
'refs/remotes/korg/master^0': unknown revision or path not in the
working tree.
Use '--' to separate paths from revisions


How do I mirror the sources cloned from the Google repository on my
local server?

Err, you mean kernel.org repository?

  repo init --mirror git://android.git.kernel.org/platform/manifest.git
  repo sync

I wonder how you got your local mirror of bionic.git in the first place.  The traceback you cite is caused by your local bionic.git not having a "master" branch.  Did you just git clone it?  You need to either git clone --mirror or use repo init --mirror to setup the bionic.git (etc.) on your internal server, so that all branches exist, otherwise the manifest will be surprised like this when a branch isn't found, but it was assumed to exist in the manifest.

kanagesh radhakrishnan

unread,
Dec 10, 2008, 8:47:25 AM12/10/08
to repo-d...@googlegroups.com
Hello Everyone,

Shawn, thank you very much for your comments and suggestions, I've
made significant progress today. They are summarized below:

I have created a mirror of the sources hosted at
git://android.git.kernel.org on my local server.

$ repo init -u git://android.git.kernel.org --mirror
$ repo sync

I get a snapshot of the .git folders on completion of repo sync on the
local server. I publish this so that others are able to clone them
(with git-clone). When publishing the components, I have ensure that
they are maintained in the same structure (like 'platform/bionic.git',
'kernel/common.git').

$ git-clone git://192.168.10.1/platform/bionic.git

I have modified the default.xml file so that the server clones are
made from is the local server (192.168.10.1) and not the default.

On a development host system:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
<edit default.xml and make changes for fetching from local server>
$ repo sync

When I do a repo sync with this manifest file on a developer host
system, it is able to clone the git repositories from the local
server. For starters though, I am have an entry in default.xml only
to clone bionic since the entire stuff takes quite some time to sync.

On the developer system:
$ cd bionic
<edit source>
$ git commit -a -m "simple changes to test push to main repo"
$ git format-patch ab43d2..
<generates a patch, say, diff.patch >

On the developer system, the administrator clones the bionic repo,
applies the patch and pushes it to the git repository

$ git-clone git://192.168.10.1/platform/bionic.git
Initialized empty Git repository in /home/user/work/local-repo/bionic/.git/


remote: Counting objects: 1876, done.

remote: Compressing oremote: bjects: 100% (867/867), done.


remote: Total 1876 (delta 981), reused 1875 (delta 981)
Receiving objects: 100% (1876/1876), 1.41 MiB, done.
Resolving deltas: 100% (981/981), done.

$
$ cd bionic
$ patch -p1 diff.patch | patch -p1
$ git commit -a -m "simple changes to test push to main repo"
$ git-push ad...@192.168.10.1:/home/git/android/platform/bionic.git
password:
<changes pushed to git repo>
$

The changes are being reflected, but is this the correct way to commit
changes to the main git repository?

I am now trying to setup a manifest file in the local server so that
the developers can do a 'repo init' with respect to this manifest.git
on the local server.

Thanks and regards,
Kanagesh

------ snip text -----


>>
>> However, when I do a repo sync with this manifest file, I see the
>> following errors:
>>
>> Initializing project bionic ...
>> Traceback (most recent call last):
>
> ...
>>
>> error.GitError: bionic rev-parse: fatal: ambiguous argument
>> 'refs/remotes/korg/master^0': unknown revision or path not in the
>> working tree.
>> Use '--' to separate paths from revisions
>>
>>
>> How do I mirror the sources cloned from the Google repository on my
>> local server?
>
> Err, you mean kernel.org repository?
>
> repo init --mirror git://android.git.kernel.org/platform/manifest.git
> repo sync
>
> I wonder how you got your local mirror of bionic.git in the first place.
> The traceback you cite is caused by your local bionic.git not having a
> "master" branch. Did you just git clone it? You need to either git clone
> --mirror or use repo init --mirror to setup the bionic.git (etc.) on your
> internal server, so that all branches exist, otherwise the manifest will be
> surprised like this when a branch isn't found, but it was assumed to exist
> in the manifest.
>

Yes, I was making a mistake here earlier. I was doing a git-clone of
bionic.git to get the local mirror without --mirror option.

Shawn Pearce

unread,
Dec 10, 2008, 2:03:43 PM12/10/08
to repo-d...@googlegroups.com
On Wed, Dec 10, 2008 at 05:47, kanagesh radhakrishnan <rkan...@gmail.com> wrote:
On the developer system:
  $ cd bionic
  <edit source>
  $ git commit -a -m "simple changes to test push to main repo"
  $ git format-patch ab43d2..
  <generates a patch, say, diff.patch >

On the developer system, the administrator clones the bionic repo,
applies the patch and pushes it to the git repository

  $ git-clone git://192.168.10.1/platform/bionic.git
  Initialized empty Git repository in /home/user/work/local-repo/bionic/.git/
  remote: Counting objects: 1876, done.
  remote: Compressing oremote: bjects: 100% (867/867), done.
  remote: Total 1876 (delta 981), reused 1875 (delta 981)
  Receiving objects: 100% (1876/1876), 1.41 MiB, done.
  Resolving deltas: 100% (981/981), done.
  $
  $ cd bionic
  $ patch -p1 diff.patch | patch -p1
  $ git commit -a -m "simple changes to test push to main repo"

Use "git am" instead of patch and commit.  E.g. "git am diff.patch".

The changes are being reflected, but is this the correct way to commit
changes to the main git repository?

Sure, that's one way.  Another is to just give developers write access so they can run "git push" on their own.  You may want to consider looking at gitosis, its an additional package that adds some rudimentary access controls to Git over SSH, allowing users to push to a repository but not actually have write access to it, even if they have a UNIX login on that same system.

kanagesh radhakrishnan

unread,
Dec 17, 2008, 12:01:25 AM12/17/08
to repo-d...@googlegroups.com
Hello Everyone and Shawn,

Thank you for the comments and suggestions.

Yes, this is exactly what I want to the developers to do too. Do a
repo sync, which will clone all the GIT repositories to their
development systems. Make changes to the code, commit locally and
then push to the local server using git-push command.

However, if I attempt to do a git-push from the GIT repository cloned
as a result of repo-sync, git-push always reports saying that
'Everything is up to date' (in spite of the fact that I have more
recent changes that I have committed to the local GIT repo from where
I am doing a git-push).

This is the reason why I have to clone the specific tree separately,
apply the patch, commit and push. What should I be doing to be able
to use git-push from the GIT repository cloned using 'repo sync'?

Thanks and regards,
Kanagesh

Shawn Pearce

unread,
Dec 17, 2008, 1:19:41 AM12/17/08
to repo-d...@googlegroups.com
Check the git-push manpage, you probably need to use a form like:

  git push korg localbranch:remotebranch

where korg is the name of the <remote> element in your manifest, localbranch is the branch the developer has passed to "repo start" or "git branch" or "git checkout -b" and remotebranch is the branch name they want to push the change into, which is probably what is in your <remote revision> or <project revision> element.
Reply all
Reply to author
Forward
0 new messages