What's the best way to tag a repo

4,202 views
Skip to first unread message

bhupesh

unread,
Jan 21, 2010, 5:07:25 PM1/21/10
to Repo and Gerrit Discussion
Is rep forall -c git tag .... the way to tag an Andoid repo or is
there any other better way. Thanks.

Shawn Pearce

unread,
Jan 21, 2010, 5:09:38 PM1/21/10
to repo-d...@googlegroups.com
bhupesh <bhupes...@gmail.com> wrote:
> Is rep forall -c git tag .... the way to tag an Andoid repo or is
> there any other better way. Thanks.

There's that.

Or, you can try using `repo manifest -r` to create a manifest XML
file which has specific Git commit IDs for each project, commit
that to your manifest project, and then tag (or create a branch)
to that manifest file.

bhupesh

unread,
Jan 21, 2010, 5:14:23 PM1/21/10
to Repo and Gerrit Discussion
Thanks for the prompt response. I will try that too.

On Jan 21, 2:09 pm, Shawn Pearce <s...@google.com> wrote:

bhupesh

unread,
Jan 25, 2010, 4:25:36 PM1/25/10
to Repo and Gerrit Discussion
Hi Shawn,

Thanks for this. I just wanted to clarify something before I do this
and end up messing things. So, I create a local copy of the repo
using repo init, run repo manifest -r and create a manifest XML file.
Now I should commit this as the default.xml file under platform/
manifest.git? I don't want to overwrite my existing default.xml file
and hence I am not sure what the right process here would be. Can you
please elaborate a bit. Thank you for your patience and response.

Cheers,
Bhupesh


On Jan 21, 2:09 pm, Shawn Pearce <s...@google.com> wrote:

Shawn Pearce

unread,
Jan 25, 2010, 5:05:49 PM1/25/10
to repo-d...@googlegroups.com
bhupesh <bhupes...@gmail.com> wrote:
> Thanks for this. I just wanted to clarify something before I do this
> and end up messing things. So, I create a local copy of the repo
> using repo init, run repo manifest -r and create a manifest XML file.
> Now I should commit this as the default.xml file under platform/
> manifest.git? I don't want to overwrite my existing default.xml file
> and hence I am not sure what the right process here would be. Can you
> please elaborate a bit. Thank you for your patience and response.

Yes, exactly, you overwite the default.xml. But you should probably
do it on a branch, so maybe:

cd .repo/manifests
git checkout -b my-tag-name
repo manifest -r -o default.xml

git commit -a -m "tag ..."

and then push the branch, my-tag-name, back to your manifest project.
Later you can get back to this "tagged point" by doing:

repo init -b my-tag-name ...

After pushing your tag branch, you might want to switch your
manifest project back to the default branch and delete the tag
branch, to avoid confusing repo:

cd .repo/manifests
git checkout default
git branch -D my-tag-name


> Cheers,
> Bhupesh
>
>
> On Jan 21, 2:09�pm, Shawn Pearce <s...@google.com> wrote:
> > bhupesh <bhupeshkha...@gmail.com> wrote:
> > > Is rep forall -c git tag .... the way to tag an Andoid repo or is
> > > there any other better way. �Thanks.
> >
> > There's that.
> >
> > Or, you can try using `repo manifest -r` to create a manifest XML
> > file which has specific Git commit IDs for each project, commit
> > that to your manifest project, and then tag (or create a branch)
> > to that manifest file.
>

> --
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en

bhupesh

unread,
Jan 25, 2010, 5:22:47 PM1/25/10
to Repo and Gerrit Discussion
Thanks. I will give this a shot.

> > More info athttp://groups.google.com/group/repo-discuss?hl=en- Hide quoted text -
>
> - Show quoted text -

bhupesh

unread,
Jan 28, 2010, 4:38:15 PM1/28/10
to Repo and Gerrit Discussion
Sorry, one more question.

So I did a repo init from the mirror that I have created. In my local
repo I have .repo/manifests/default.xml which I update using the 'repo
manifest -r -o ...' commande after switching to 'my-tag...' branch. I
committed the change successfully. Now what command should I use to
push. Just git push does not work.

I don't want to create new branch for this, rather tag the branch that
I have. So, I guess, I can do git tag on the local commit and then
push. What would the command be to push to the branch that I was
working on and in the case I created a tag rather than a branch which
is what I think you are suggesting, would repo init -b still work on
my tag?

Thanks.

Shawn Pearce

unread,
Jan 28, 2010, 6:51:56 PM1/28/10
to repo-d...@googlegroups.com
bhupesh <bhupes...@gmail.com> wrote:
> So I did a repo init from the mirror that I have created. In my local
> repo I have .repo/manifests/default.xml which I update using the 'repo
> manifest -r -o ...' commande after switching to 'my-tag...' branch. I
> committed the change successfully. Now what command should I use to
> push. Just git push does not work.

Try reading the manual page for git push, you are creating a new
branch, so you need to actually tell it what branches to operate on:

git push REMOTE BRANCH ...



> I don't want to create new branch for this, rather tag the branch that
> I have. So, I guess, I can do git tag on the local commit and then
> push. What would the command be to push to the branch that I was
> working on and in the case I created a tag rather than a branch which
> is what I think you are suggesting, would repo init -b still work on
> my tag?

No, repo init -b assumes a branch name, not a tag name. That's why
I was suggesting creating a branch here rather than a tag.

bhupesh

unread,
Jan 28, 2010, 8:51:27 PM1/28/10
to Repo and Gerrit Discussion
Thanks Shawn. I did try out few things as per the git push man page,
but I guess, I understanding is a bit shallow when it comes to this.
I will experiment more. As I mentioned, ideally I would like to just
tag the branch that I already have. If I can figure that out, great;
else I will go ahead and create a new branch like you suggested. Once
again, appreciate your help and patience on this.

On Jan 28, 3:51 pm, Shawn Pearce <s...@google.com> wrote:

Dave Craig

unread,
Feb 17, 2010, 8:59:52 PM2/17/10
to Repo and Gerrit Discussion
repo init -b refs/tags/<tag> appears to work. Otherwise, I am not
sure how to deal with forests where the manifest for a particular tag
references repositories that have been removed on the branch. Getting
the repo on the branch and then manually getting the old repo's seems
a little kludgy.

Thanks,
Dave

On Jan 28, 3:51 pm, Shawn Pearce <s...@google.com> wrote:
> bhupesh <bhupeshkha...@gmail.com> wrote:

> > So I did arepoinitfrom the mirror that I have created.  In my local
> >repoI have .repo/manifests/default.xml which I update using the 'repo


> > manifest -r -o ...' commande after switching to 'my-tag...' branch.  I
> > committed the change successfully.  Now what command should I use to
> > push.  Just git push does not work.
>
> Try reading the manual page for git push, you are creating a new
> branch, so you need to actually tell it what branches to operate on:
>
>   git push REMOTE BRANCH ...
>
> > I don't want to create new branch for this, rather tag the branch that
> > I have.  So, I guess, I can do git tag on the local commit and then
> > push.  What would the command be to push to the branch that I was
> > working on and in the case I created a tag rather than a branch which

> > is what I think you are suggesting, wouldrepoinit-b still work on
> > my tag?
>
> No,repoinit-b assumes a branch name, not a tag name.  That's why

Chunlin Zhang

unread,
Mar 23, 2011, 11:28:31 PM3/23/11
to repo-d...@googlegroups.com, Shawn Pearce
To this:
'''

  cd .repo/manifests
  git checkout -b my-tag-name
  repo manifest -r -o default.xml
'''
After I try,I found that when under the directory of ".repo/manifests","repo manifest -r -o default.xml" will got a error of "xml.parsers.expat.ExpatError",so I have to go to the root directory of project,gen the default.xml and cp it to .repo/manifests.

The whole error msg:
'''
Traceback (most recent call last):
  File "/media/linux/t/alps/.repo/repo/main.py", line 238, in <module>
    _Main(sys.argv[1:])
  File "/media/linux/t/alps/.repo/repo/main.py", line 220, in _Main
    repo._Run(argv)
  File "/media/linux/t/alps/.repo/repo/main.py", line 125, in _Run
    cmd.Execute(copts, cargs)
  File "/media/linux/t/alps/.repo/repo/subcmds/manifest.py", line 72, in Execute
    self._Output(opt)
  File "/media/linux/t/alps/.repo/repo/subcmds/manifest.py", line 62, in _Output
    peg_rev = opt.peg_rev)
  File "/media/linux/t/alps/.repo/repo/manifest_xml.py", line 113, in Save
    if self.notice:
  File "/media/linux/t/alps/.repo/repo/manifest_xml.py", line 206, in notice
    self._Load()
  File "/media/linux/t/alps/.repo/repo/manifest_xml.py", line 236, in _Load
    self._ParseManifest(True)
  File "/media/linux/t/alps/.repo/repo/manifest_xml.py", line 254, in _ParseManifest
    root = xml.dom.minidom.parse(self.manifestFile)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 211, in parseFile
    parser.Parse("", True)
xml.parsers.expat.ExpatError: no element found: line 1, column 0
'''

Magnus Bäck

unread,
Mar 24, 2011, 3:23:39 AM3/24/11
to repo-d...@googlegroups.com
On Thursday, March 24, 2011 at 04:28 CET,
Chunlin Zhang <zhangc...@gmail.com> wrote:

> To this:
> '''
> cd .repo/manifests
> git checkout -b my-tag-name
> repo manifest -r -o default.xml
> '''
> After I try,I found that when under the directory of
> ".repo/manifests","repo manifest -r -o default.xml" will got a error
> of "xml.parsers.expat.ExpatError",so I have to go to the root
> directory of project,gen the default.xml and cp it to .repo/manifests.

Repo needs to read the manifest file, default.xml, in order to produce
the output file. Unfortunately Repo apparently opens the output file
(truncating it if it exists) before it reads the manifest file, so by
the time it tries to read the manifest file it is, of course, empty.
Do like this instead:

repo manifest -r -o default.xml.tmp && mv default.xml.tmp default.xml

[...]

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

Reply all
Reply to author
Forward
0 new messages