How to work with bazaar through the GUI on Windows: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
(Replaced content with "We are not using Bazaar anymore, but Git.")
Tag: Replaced
 
(16 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Alternative: use Bazaar from the command line =
We are not using Bazaar anymore, but Git.
If the GUI is not your prefered way of doing things, please see [[How to work with bazaar on the command line]]
 
= Download Bazaar for Windows =
You find the downloads for Bazaar for Windows here: http://wiki.bazaar.canonical.com/WindowsDownloads
 
We currently recommend to use the Standalone 2.4 Stable Release. This includes the core Bazaar distribution and several GUIs for Bazaar.
 
We have noticed that the german translation is not complete at all, and on German Windows systems the GUI is quite mixed up with several languages. Solution: delete all but the en locale directory from C:\Program Files\Bazaar\locale. If the local-folder is not available on your computer you can also set the LANG environment variable to the required language code.
 
See also [http://doc.bazaar.canonical.com/explorer/en/visual-tour-windows.html Visual Tour of Bazaar Explorer on Windows].
 
If you still get [[plink console windows with bazaar]], have a look those instructions!
 
= Setup your environment =
Start Bazaar Explorer from the Start menu.
 
[[File:BzrExplorer1.png|center|First screen of Bazaar Explorer]]
 
Go to Settings|Configuration|User Configuration to set your user name and email address:
 
[[File:BzrExplorer2.png|center|User Configuration of Bazaar Explorer]]
 
Set up the bug tracker integration as follows:
[[File:BzrExplorer_Bug_mantis.PNG‎|center|Configure Mantis Bug Tracker Integration]]
Here is the URL for easy copy&paste: <code>http://sourceforge.net/apps/mantisbt/openpetraorg/view.php?id={id}</code>
 
The commit dialogue of Bazaar Explorer allows one to specify a bug that was closed with the commit. One needs to prefix the bug number with 'op:' (e.g. 'op:170' if Bug #170 is closed in the openPETRA bug tracker).
 
 
If you prefer to use WinMerge for showing the diff of files, you can configure it in the same window as well:
 
[[File:BzrExplorer3.png|center|Configure WinMerge]]
 
To setup KDiff3 (http://kdiff3.sourceforge.net/) as your Merge tool, configure it in the same window:
 
[[File:BzrExplorer MergeConfig.png|centre|Configure KDiff3 as the merge tool]]
 
For Copy&Paste: <code>"C:\Program Files (x86)\KDiff3\kdiff3.exe" --output "%r" "%b" "%t" "%o"</code>
 
Now you should configure a directory where you will store all your branches. Go to "Start a new project", and click on "Initialize". Make sure to select the options "Shared repository" and "Branches in the repository will default to not having a working tree".
 
I have chosen the directory <code><My Documents>/openpetra/bzr/</code>
 
Especially when using Windows 7 it is recommended to create the repository in a local directory (e.g. on C:) and not one on the network as otherwise compiling with NAnt can give problems. Compiling from a network drive gave the following error on Windows 7:
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, ... failed
 
[[File:BzrExplorer4.png|center|Initialize Project Directory]]
 
You might be asked, if you want to create a new "hat". Just say yes. An explanation can be found here: http://wiki.bazaar.canonical.com/BzrExplorer#hats
== Line Ending issues ==
To avoid problems with the line endings, and the code generators, in Bazaar Explorer go to Settings/Rules and insert the content listed at below:
<pre>
[name *.cs]
eol = native
[name *.csproj]
eol = native
[name *.sln]
eol = native
[name *.yaml]
eol = native
[name *.xml]
eol = native
[name *.config]
eol = native
[name *.build]
eol = native
[name *.js]
eol = native
[name *.html]
eol = native
[name *.htm]
eol = native
[name *.sql]
eol = native
</pre>
 
See also http://doc.bazaar.canonical.com/development/en/user-reference/eol-help.html
 
= Working with trunk and branches in Bazaar =
trunk is the main branch of the repository. Only members of the core development team can commit to trunk and merge changes from a branch into trunk.
 
For other developers it still might make sense to checkout trunk, for readonly access, and to compile the latest version from the repository.
 
Every developer needs to create a free account at http://launchpad.net, for hosting their own branches there.
 
For the core developers, that have write access to trunk, we have agreed to create an extra branch for each bug or feature from Mantis, that takes more than 3 hours to develop, including the time needed for coding and testing.
Only small bugs and not so complicated fixes can be committed directly into trunk.
 
There are several options how the local repository looks like. With a shared repository as described above in the setup of the working environment, you can check out several branches (and trunk which is just a special branch) into separate working trees.
 
= Create your own branch =
For creating a new branch, you need to follow the following steps...
== Setup your Launchpad account ==
You only need to do this once!
 
# First get an account on Launchpad, which is a service provided by the company Canonical, who develop Ubuntu and Bazaar: https://login.launchpad.net/+new_account
# Create a public and private key on launchpad. This is explained [https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair here]. It is quite important to execute pageant and to load the private key into pageant.
# In your bazaar, you need to tell your launchpad username. You can do this in the GUI, in the menu Bazaar / All Commands / category Launchpad, Command launchpad-login, and enter your launchpad id as the parameter.
 
[[File:BzrExplorerLaunchpadLogin.png|center|Tell Bazaar your launchpad login name]]
 
== Create a new branch on Launchpad ==
Make sure you have started pageant with your private key, otherwise your connection to the bazaar server will fail. To do that, you just need to double-click on the .ppk file, which is the private key file which you saved when you created the SSH key for developer access.
 
Open Bazaar Explorer, and select Bazaar / Start / Branch from the menu.
 
[[File:BzrExplorerBranch.png|center|Create your own branch]]
 
The source will be: <code>lp:openpetraorg</code>
 
The destination should be an URL in this form: lp:~LAUNCHPADUSERID/openpetraorg/BRANCH_NAME
 
You could also create branches that are unrelated to the openpetraorg project: eg. lp:~tpokorra/+junk/BRANCHNAME
 
Our naming convention for branches is to use <code>dev_0000<Mantis Issue number>_<keywords to describe the issue></code>.
So for example it could be: <code>dev_0000167_import_cc_hierarchy</code>
 
== Checkout the code into a working tree ==
You can download this branch into your own directory, by selecting in the menu Bazaar | Start | Checkout.
 
[[File:BzrExplorer5.png|center|Checkout trunk]]
 
Use the URL of your branch:
lp:~LAUNCHPADUSERID/openpetraorg/BRANCH_NAME
 
For just browsing the source online, go to
https://code.launchpad.net/~LAUNCHPADUSERID or https://code.launchpad.net/openpetraorg
 
The destination for the checked out trunk would be in my case:
<My Documents>/openpetra/bzr/work
 
Please make sure that the destination is inside your repository directory which you have created earlier! Avoid network drives as mentioned above!
 
After the checkout has finished, click on Refresh in the Bazaar Explorer, and then double-click trunk to get to the view of the current working tree:
 
[[File:BzrExplorer6.png|center|Explore trunk]]
 
Now you can edit the code and add functionality.
Please make sure to add as well your OpenPetra.build.config file to the branch (if you have one) and create the Database with nant. (without those steps the server won't start)
 
= Commit added and modified files =
The Bazaar Explorer should look similar to this for your working tree:
[[File:BzrExplorer6.png|center|Explore trunk]]
 
This screen gives you access to operations like:
* Add: add new files
* Rename: rename files in the working tree control
* Commit: commit local changes to the repository.
** Please enter the Mantis numbers of the bugs you have fixed (in edit field '''Fixed bugs'''), in the format op:<mantis number>, eg. <code>op:123 op:124</code>
** it is recommended always to commit to the central repository, and to avoid local commits
[[File:BzrExplorer7.png|center|Commit]]
 
Alternatively, you can work with Tortoise Bazaar as well:
[[File:BzrTortoise.png|center|Tortoise Bazaar]]
 
= Rebase a branch / Merge from trunk =
You should rebase your branch regularly, so that the changes happening in trunk are flowing back into your branch.
 
You need to click on ''Merge'', and if there have been changes merged into your branch, you will need to ''Commit'' as well.
 
It is highly recommended to first commit all your own local changes, before doing a merge.
 
= Merge to trunk =
If you want your changes to be merged into the OpenPetra trunk, use the link '''Propose for merging''' on your Launchpad code page. It is recommended to have small branches for each feature that you want to go upstream. You will not be able to reuse a branch, after it has been merged into openpetra trunk, since we want to avoid criss cross merges etc.
 
Certain members of the core team with write permissions on trunk will switch to trunk, and then do a ''Merge'' from the branch. They will resolve conflicts if there are any, and do a ''Commit''.
 
= Resolve conflicts =
This example will show you how to resolve a conflict.
 
The situation: the file Gift.Importing.cs has been edited both in trunk and in the dev branch. We switch to the dev branch, and select Merge from bzr+ssh://bazaar@bzr.openpetra.org:2208/openpetra/trunk/
 
This is how it looks in Bazaar Explorer:
[[File:BzrExplorerUncommittedMergeWithConflicts.png|center|Uncommitted Merge with Conflicts]]
 
Now go in the menu to Bazaar > Work > Resolve Conflicts. You will get this screen:
[[File:BzrListConflicts.png|center|Bazaar list unresolved conflicts]]
 
If you have configured KDiff3 right, you should be able to double-click the conflict files and see them in KDiff3. This only works for files that have text conflicts. For files with content conflicts, you need to manually compare the .BASE and .THIS or .OTHER file with the current file.
 
In KDiff3, you have 3 columns:
[[File:Kdiff3.png|center|KDiff3 sample]]
 
 
*The left column (A) is the BASE version. This is the version before all changes happened, the common source of the branches.
*The center column (B) is the THIS version. This is the version that you have last had in your branch.
*The right column (C) is the OTHER version. This is the version coming from trunk, in our example.
*The file at the bottom is the resulting file. You can go through the conflicts, and select if you want to select the version from A, B, or C, or you can modify it yourself.
 
Make sure that the line end style is set to DOS (and not to UNIX).
 
You might also want to right click the conflicting file in the Explorer, and select the Log, this will you to see what happened to the file, and how the changes got into that file, by looking at the diff of each commit.
 
After you have fixed the bottom file, saved it and closed KDiff3, select "Mark as resolved" in the conflicts list window, when right-clicking the conflict file.
 
= Frequently asked questions =
Please go to [[Notes_about_Bazaar#Frequently_asked_questions]] to see our FAQ for bazaar.

Latest revision as of 04:35, 16 March 2023

We are not using Bazaar anymore, but Git.