Difference between revisions of "Activity Team/Git Tutorial"

From Sugar Labs
Jump to navigation Jump to search
m (create page)
 
m (initial git tutorial)
Line 1: Line 1:
 
<noinclude>{{GoogleTrans-en}}{{TeamHeader|Activity Team}}</noinclude>
 
<noinclude>{{GoogleTrans-en}}{{TeamHeader|Activity Team}}</noinclude>
 
== Git and Gitorious Tutorial ==
 
== Git and Gitorious Tutorial ==
 +
===gitorious===
 +
I'm documenting the process of moving Turtle Art to git.sugarlabs.org. Marco has posted instructions [[Development Team/Git#Import_a_module_from_dev.laptop.org|here]], but of course I didn't have them at hand when I started. So far:
  
 +
:1. I created an account on git.sugarlabs.org by selecting the register link on the home page.
 +
:2. I created a new project by selecting the new link on the project page.
 +
::There were lots of questions I didn't know the answer to, such as what tags I should be using, but you can answer most of them after the fact... I did screw up (at least) one thing: I hadn't noted that the project name needs to be all lowercase... but it was easy to change.
 +
:3. I am not sure how to push my project.
 +
::Morgs pointed out that if you go to http://git.sugarlabs.org/projects/turtleart/repos/mainline it tells you a "push" URL.
 +
git remote add origin gitorious@git.sugarlabs.org:turtleart/mainline.git
 +
# to push the master branch to the origin remote we added above:
 +
git push origin master
 +
# after that you can just do:
 +
git push
 +
:4. I finally looked at Marco's [[Development Team/Git#Import_a_module_from_dev.laptop.org|instructions]] and so I added the pootle user as a committer.
 +
:5. Where should I put the .xo bundle? And the source tarball?
 +
::there is [http://git.sugarlabs.org/projects/sugar-tools/repos/mainline/blobs/master/release a script] for generating and posting changes that covers all of these details.
 +
 +
I had a bit of trouble pushing a new change to gitorious today. I had to use the --force flag for some reason. We suspect it may have something to do with the fact that one of the files I pushed is a binary file. Will report back what I find. (Seems to work fine when there are no binary files to add/push.)
 +
git push -fv
 +
 +
I have been trying to use release.py with no luck so far either. (It has a dependency on the feedparser python library, which is easy enough to install.) It complained about a mismatched tag, so I used the --version flag to force the same version number as in my activity.info file. Then I got this error:
 +
 +
nothing added to commit but untracked files present (use "git add" to track)
 +
Traceback (most recent call last):
 +
  File "../release.py", line 325, in <module>
 +
    main()
 +
  File "../release.py", line 314, in main
 +
    release.tag()
 +
  File "../release.py", line 170, in tag
 +
    subprocess.check_call(['git', 'commit', '-a', '-m' , '%s' % message])
 +
  File "/usr/lib/python2.5/subprocess.py", line 462, in check_call
 +
    raise CalledProcessError(retcode, cmd)
 +
subprocess.CalledProcessError: Command '['git', 'commit', '-a', '-m', 'Release 26']' returned non-zero exit status 1
 +
 +
Is this because I did the git commit and git push by hand before running release.py?
 +
 +
----
 +
 +
Use
 +
git-pull
 +
to periodically pull pootle updates to the project .po files (every Friday?)
 +
 +
Also, run
 +
python setup.py fix_manifest
 +
to update the .mo files after updating the .po files
 +
 +
----
 +
 +
alsroot taught me about another git feature: tags
 +
 +
git tag -m "Release 36" v36 HEAD
 +
git push --tags
 +
 +
----
 +
 +
bertf explained to me that git-pull does a combination of fetch and merge, so to merge a patch...
 +
 +
git pull git://git.sugarlabs.org/infoslicer/alsroots-clone.git master
 +
 +
 +
A few notes re moving to the Sugar Labs infrastructure:
 +
 +
* use git init to create a new project
 +
 +
* source packages now go in
 +
<strike> shell.sugarlabs.org:/upload/sources/sucrose/fructose/</strike>
 +
download.sugarlabs.org:/var/www-sugarlabs/download/sources/sucrose/fructose/
 +
 +
* don't forget to update addons as well!!
 +
 +
* and to copy the tar file to download.sugarlabs.org
 +
download.sugarlabs.org:/download/sources/honey/...
 +
download.sugarlabs.org:/download/sources/sucrose/fructose/...
  
 
[[Category:Activity Team]]
 
[[Category:Activity Team]]

Revision as of 16:42, 29 August 2009

Team Home   ·   Join   ·   Contacts   ·   Resources   ·   FAQ   ·   Roadmap   ·   To Do   ·   Meetings

Git and Gitorious Tutorial

gitorious

I'm documenting the process of moving Turtle Art to git.sugarlabs.org. Marco has posted instructions here, but of course I didn't have them at hand when I started. So far:

1. I created an account on git.sugarlabs.org by selecting the register link on the home page.
2. I created a new project by selecting the new link on the project page.
There were lots of questions I didn't know the answer to, such as what tags I should be using, but you can answer most of them after the fact... I did screw up (at least) one thing: I hadn't noted that the project name needs to be all lowercase... but it was easy to change.
3. I am not sure how to push my project.
Morgs pointed out that if you go to http://git.sugarlabs.org/projects/turtleart/repos/mainline it tells you a "push" URL.
git remote add origin gitorious@git.sugarlabs.org:turtleart/mainline.git
# to push the master branch to the origin remote we added above:
git push origin master 
# after that you can just do:
git push
4. I finally looked at Marco's instructions and so I added the pootle user as a committer.
5. Where should I put the .xo bundle? And the source tarball?
there is a script for generating and posting changes that covers all of these details.

I had a bit of trouble pushing a new change to gitorious today. I had to use the --force flag for some reason. We suspect it may have something to do with the fact that one of the files I pushed is a binary file. Will report back what I find. (Seems to work fine when there are no binary files to add/push.)

git push -fv

I have been trying to use release.py with no luck so far either. (It has a dependency on the feedparser python library, which is easy enough to install.) It complained about a mismatched tag, so I used the --version flag to force the same version number as in my activity.info file. Then I got this error:

nothing added to commit but untracked files present (use "git add" to track)
Traceback (most recent call last):
 File "../release.py", line 325, in <module>
   main()
 File "../release.py", line 314, in main
   release.tag()
 File "../release.py", line 170, in tag
   subprocess.check_call(['git', 'commit', '-a', '-m' , '%s' % message])
 File "/usr/lib/python2.5/subprocess.py", line 462, in check_call
   raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['git', 'commit', '-a', '-m', 'Release 26']' returned non-zero exit status 1

Is this because I did the git commit and git push by hand before running release.py?


Use

git-pull

to periodically pull pootle updates to the project .po files (every Friday?)

Also, run

python setup.py fix_manifest

to update the .mo files after updating the .po files


alsroot taught me about another git feature: tags

git tag -m "Release 36" v36 HEAD
git push --tags

bertf explained to me that git-pull does a combination of fetch and merge, so to merge a patch...

git pull git://git.sugarlabs.org/infoslicer/alsroots-clone.git master


A few notes re moving to the Sugar Labs infrastructure:

  • use git init to create a new project
  • source packages now go in

shell.sugarlabs.org:/upload/sources/sucrose/fructose/

download.sugarlabs.org:/var/www-sugarlabs/download/sources/sucrose/fructose/
  • don't forget to update addons as well!!
  • and to copy the tar file to download.sugarlabs.org
download.sugarlabs.org:/download/sources/honey/...
download.sugarlabs.org:/download/sources/sucrose/fructose/...