Difference between revisions of "GitPhraseBook"
(Start with the mtn phrasebook from http://web.archive.org/web/20080205023301/http://www.openembedded.org/wiki/MonotonePhraseBook) |
|||
Line 1: | Line 1: | ||
− | + | = Git Phrase Book = | |
− | |||
− | |||
− | + | '''NOTE:''' For increased pleasure use git 1.5 or later. | |
+ | |||
+ | == Pointers == | ||
+ | There are plenty of good git tutorials on the net. A small collection of links can be seen below: | ||
+ | |||
+ | * [http://git.or.cz/gitwiki/GitDocumentation Official Documentation] | ||
+ | * [http://git.or.cz/gitwiki/GitCheatSheet Cheat Sheet] | ||
+ | * [http://eagain.net/articles/git-for-computer-scientists/ Git For Computer Scientists] | ||
+ | * [http://www.google.com/search?q=git+documentation&ie=utf-8&oe=utf-8&aq=t Google Search] | ||
+ | |||
NOTE: You need to have monotone 0.32 now ! | NOTE: You need to have monotone 0.32 now ! |
Revision as of 15:24, 8 October 2008
Git Phrase Book
NOTE: For increased pleasure use git 1.5 or later.
Pointers
There are plenty of good git tutorials on the net. A small collection of links can be seen below:
NOTE: You need to have monotone 0.32 now !
Add the following command to your .bashrc:
alias mtn-add='mtn list unknown | xargs mtn add' alias mtn-drop='mtn drop --missing'
mtn-add will put new files under monotone control and mtn-drop will remove files from monotone control.
To start with you need to init a database:
mtn db init --db=/somepath/OE.mtn
Developers with write access need to generate a key and send it to mickeyl and koen:
- yes, that really needs to be <name>@openembedded.org
mtn genkey --db=/somepath/OE.mtn xxx@openembedded.org mtn --db=/somepath/OE.mtn pubkey xxx@openembedded.org | mail mickeyl@linuxtogo.org -s "xxx monotone key" mtn --db=/somepath/OE.mtn pubkey xxx@openembedded.org | mail koen@linuxtogo.org -s "xxx monotone key"
You can then pull openembedded and check out the repository to edit (see details on branches dev,oz354x,dreambox in DevelopmentBranches) :
mtn --db=/somepath/OE.mtn pull monotone.openembedded.org "org.openembedded.{dev,oz354x,dreambox}" mtn --db=/somepath/OE.mtn co --branch=org.openembedded.dev
Committing
mtn pull mtn update mtn commit <files>
When you are committing someone elses work verbatim:
mtn pull mtn update mtn commit <files> --author <email of original author>
The commit message has to follow this layout:
<package name> <version>| <package category> | <configfile/class name>: <summary> { - <detail 1>
- <detail 2>}*
Example 1:
vi packages/gaim/gaim.inc mtn pull mtn update mtn commit packages/gaim/gaim.inc
should have a log message like this:
gaim: make sure do_install does its job in gaim.inc
- install lib to ${libdir} instead of /usr/lib
- remove executable bits from docs
Example 2:
diff /tmp/foo.c /oe/work/gtk+-2.8.4-r0/gtk+-2.8.4/src/foo.c > gtk-2.8.4/fix-foo.patch vi gtk+_2.8.4.bb mtn add gtk-2.8.4/fix-foo.patch mtn pull mtn update mtn commit gtk-2.8.4/fix-foo.patch gtk+_2.8.4.bb
should have a log message like this:
gtk+ 2.8.4: add patch for buffer overflow
Note: Make sure you do 'mtn update' before 'mtn commit' since this reduces the possibility of multiple heads.
Backing out the commit you've made: (You'll need to find the revision ID for this. Use mtn log|less)
This will remove all changes you've done, returning the file(s) to the state they were before you edited them.
mtn --db=OE.mtn --branch=org.openembedded.<branchname> disapprove 5c1a5813e0f66a0d10515ba6fecafbebfe679c7f
Updating
It is assumed that the database is in the current directory and named OE.mtn and the checkout tree is in the org.openembedded.dev in the same directory. Specifying the server name is optional after the initial pull.
mtn --db=OE.mtn pull monotone.openembedded.org org.openembedded.dev cd org.openembedded.dev
The database now contains all upstream changes. You can review the incoming changes as follows:
mtn diff -r `mtn automate get_base_revision_id` -r `mtn automate heads`
Update your local checkout:
mtn update
Pushing your changes upstream:
cd org.openembedded.dev mtn pull mtn merge mtn push
Set default branch and server on push (this is especially needed if you download the database snapshot and want pushing to monotone.openembedded.org):
mtn push --set-default <server> org.openembedded.dev
http://www.venge.net/monotone/docs/Tutorial.html contains lots of useful examples. Working on multiple branches
If you have checked-out different branches, the default settings (set on first checkout) stored in your database may not fit for other branches. You may need to reset vars in order to be able to pull updates in other branches' local copies. For instance, to continue work on org.openembedded.oz354x instead of org.openembedded.dev :
mtn set database default-include-pattern org.openembedded.oz354x
You can check default settings with :
mtn list vars
Some additional guidelines:
* If you have multiple trees / databases, make sure you synchronize them with the upstream tree before pushing or we'll end up with multiple branch heads * Don't forget to update your working copies after pulling * If you are responsible for multiple branch heads, feel responsible to merge them using 'mtn merge' * Install 'meld' of 'kdiff3' on your PC, this eases 2-way and 3-way merging