Bzr

Differences between revisions 1 and 15 (spanning 14 versions)
Revision 1 as of 2013-03-19 14:43:52
Size: 1437
Editor: zequence
Comment:
Revision 15 as of 2013-05-17 01:32:45
Size: 3833
Editor: zequence
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:

<<TableOfContents(2)>>
Line 6: Line 9:
[[http://bazaar.canonical.com/en/|Bazaar]] is a GNU version control system, sponsored by Canonical used for keeping track of sources at [[https://code.launchpad.net|code.launchpad.net]]. Most, or all Ubuntu sources exist as bzr branches. [[http://bazaar.canonical.com/en/|Bazaar]] is a GNU version control system, sponsored by Canonical and used for keeping track of sources at [[https://code.launchpad.net|code.launchpad.net]]. Most, or all Ubuntu sources exist as bzr branches.
Line 12: Line 15:
Getthe source for a development release branch: There are some nice builtin functionalities in bzr. Getting Ubuntu source is one of them.
Line 14: Line 17:
||bzr branch ubuntu:<package>|| Get the source for a development release branch:
{{{
$ bzr branch ubuntu:<package>
}}}
Line 17: Line 23:

||bzr branch ubuntu:jackd2||
{{{
$ bzr branch ubuntu:jackd2
}}}
Line 21: Line 28:
{{{
$ bzr branch ubuntu:<release>/<package>
}}}
Line 22: Line 32:
||bzr branch ubuntu:<release>/<package>|| For example (renaming the local branch to jackd2-precise):
{{{
$ bzr branch ubuntu:precise/jackd2 jackd2-precise
}}}
Line 24: Line 37:
For example: == Get other misc source ==
Line 26: Line 39:
||bzr branch ubuntu:precise/jackd2|| Getting non Ubuntu branches will require you to get the adress to the source from launchpad, and branch it like:
{{{
$ bzr branch lp:~ubuntustudio-dev/ubuntustudio-default-settings/UbuntuStudio ubuntustudio-default-settings
}}}

== Update branch ==

Before you start working, you might want to update your bzr branch. Do this only if it's a clean bzr branch with no uncommitted or unpushed changes. To pull latest changes from the default remote branch to this local branch, do:
{{{
$ bzr pull
}}}

You can additionally decide from where to pull with:
{{{
$ bzr pull <remote_adress>
}}}
Line 30: Line 58:
 /!\ Do not add several features committing them all at once. This makes it hard to oversee changes. A feature change may mean that you edit more than one file though. /!\ '''Do not add several features and then commit them all at once. This makes it hard to oversee changes. However, making a feature change often means that you edit more than one file. So, it is the feature that should be commited, not each changed file by itself.'''
Line 33: Line 61:
Line 35: Line 62:
bzr add <yournewfile> $ bzr add <yournewfile>
Line 38: Line 65:
While you'll probably seldom do it this way (if you're working on a debian package), this is how to create a standard bzr commit:
You'll seldom do it this way (since you're propably working on a debian package), but this is how to create a standard bzr commit:
Line 41: Line 67:
bzr commit -m "a description of your commit" $ bzr commit -m "a description of your commit"
Line 44: Line 70:
If you're working on a Debian package, you'll first edit debian/changelog, and then use debcommit. debcommit reads debian/changelog and uses the descriptions of changes from there. If you're working on a Debian package, you'll first edit debian/changelog, and then use debcommit. debcommit reads debian/changelog and uses the descriptions of changes from there. ''Read more about [[UbuntuStudio/DocumentDebianChanges|documenting Debian changes]]''
{{{
$ debcommit
}}}
Line 46: Line 75:
== bzr push ==

To "upload" your changes, you'll need to push them. This is done with the ''bzr push'' command. Without rights, you can't push to a Ubuntu branch directly. You can only push to bzr branches you own or have rights to push to. And bzr branches can either belong to a project, or be temporary personal "junk" branches.

To push to your own junk branch, make up a name for the branch when you push:
Line 47: Line 81:
debcommit $ bzr push lp:~<your-lp-username>/+junk/<branchname>
Line 49: Line 83:

Or, upload to an existing project branch for which you have rights, for example:
{{{
$ bzr push lp:~ubuntustudio-dev/ubuntustudio-default-settings/UbuntuStudio
}}}

Usually, when you're fixing a bug to an existing Ubuntu project branch, you'll create a paralell branch for it with the command:
{{{
$ bzr push lp:~<yourlpid>/ubuntu/<release>/<package>/<branchname>
}}}

So, for example, if it's a development release of jackd2, it would be something like:
{{{
$ bzr push lp:~zequence/ubuntu/jackd2/fix-for-956438
}}}

Or, for a specific release:
{{{
$ bzr push lp:~zequence/ubuntu/precise/jackd2/fix-for-956438
}}}

== Arggh, I want to undo changes ==

Removing just the last commit, but not changing any files is done with:
{{{
$ bzr uncommit
}}}

Removing all changes in files that happened since last commit, is done with:
{{{
$ bzr revert
}}}

What is Bazaar?

Bazaar is a GNU version control system, sponsored by Canonical and used for keeping track of sources at code.launchpad.net. Most, or all Ubuntu sources exist as bzr branches.

bzr command cheat sheet

Get Ubuntu Source

There are some nice builtin functionalities in bzr. Getting Ubuntu source is one of them.

Get the source for a development release branch:

$ bzr branch ubuntu:<package>

For example:

$ bzr branch ubuntu:jackd2

Or, if you want the source for a specific release:

$ bzr branch ubuntu:<release>/<package>

For example (renaming the local branch to jackd2-precise):

$ bzr branch ubuntu:precise/jackd2 jackd2-precise

Get other misc source

Getting non Ubuntu branches will require you to get the adress to the source from launchpad, and branch it like:

$ bzr branch lp:~ubuntustudio-dev/ubuntustudio-default-settings/UbuntuStudio ubuntustudio-default-settings

Update branch

Before you start working, you might want to update your bzr branch. Do this only if it's a clean bzr branch with no uncommitted or unpushed changes. To pull latest changes from the default remote branch to this local branch, do:

$ bzr pull

You can additionally decide from where to pull with:

$ bzr pull <remote_adress>

bzr commits

Warning /!\ Do not add several features and then commit them all at once. This makes it hard to oversee changes. However, making a feature change often means that you edit more than one file. So, it is the feature that should be commited, not each changed file by itself.

To make a commit, you would first make changes. To make new files commitable, you would first need to:

$ bzr add <yournewfile>

You'll seldom do it this way (since you're propably working on a debian package), but this is how to create a standard bzr commit:

$ bzr commit -m "a description of your commit"

If you're working on a Debian package, you'll first edit debian/changelog, and then use debcommit. debcommit reads debian/changelog and uses the descriptions of changes from there. Read more about documenting Debian changes

$ debcommit

bzr push

To "upload" your changes, you'll need to push them. This is done with the bzr push command. Without rights, you can't push to a Ubuntu branch directly. You can only push to bzr branches you own or have rights to push to. And bzr branches can either belong to a project, or be temporary personal "junk" branches.

To push to your own junk branch, make up a name for the branch when you push:

$ bzr push lp:~<your-lp-username>/+junk/<branchname>

Or, upload to an existing project branch for which you have rights, for example:

$ bzr push lp:~ubuntustudio-dev/ubuntustudio-default-settings/UbuntuStudio

Usually, when you're fixing a bug to an existing Ubuntu project branch, you'll create a paralell branch for it with the command:

$ bzr push lp:~<yourlpid>/ubuntu/<release>/<package>/<branchname>

So, for example, if it's a development release of jackd2, it would be something like:

$ bzr push lp:~zequence/ubuntu/jackd2/fix-for-956438

Or, for a specific release:

$ bzr push lp:~zequence/ubuntu/precise/jackd2/fix-for-956438

Arggh, I want to undo changes

Removing just the last commit, but not changing any files is done with:

$ bzr uncommit

Removing all changes in files that happened since last commit, is done with:

$ bzr revert

UbuntuStudio/Bzr (last edited 2013-05-17 01:32:45 by zequence)