Chinaunix首页 | 论坛 | 博客
  • 博客访问: 798858
  • 博文数量: 770
  • 博客积分: 5000
  • 博客等级: 大校
  • 技术积分: 4950
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-09 17:49
文章分类

全部博文(770)

文章存档

2011年(1)

2008年(769)

我的朋友

分类:

2008-10-10 10:58:15

[url=]Contents[/url]

Bazaar is a distributed version control system that makes it easier forpeople to work together on software projects.
Over the next five minutes, you'll learn how to put your files underversion control, how to record changes to them, examine your work, publi** and send your work for merger into a project's trunk.
If you'd prefer a more detailed introduction, take a look at.

This guide doesn't describe how to install Bazaar but it's usually veryeasy. You can find installation instructions at:
  • GNU/Linux: Bazaar is probably in your GNU/Linux distribution already.
  • Windows: .
  • Mac OS X: .
For other platforms and to install from source code, see the and pages.

Before you start working, it is good to tell Bazaar who you are. Thatway your work is properly identified in revision logs.
Using your name and email address, instead of John Doe's, type:
$ bzr whoami "John Doe <>"
Bazaar will now create or modify a configuration file, including yourname and email address.
Now, check that your name and email address are correctly registered:
$ bzr whoami
John Doe <>

Let's create a directory and some files to use with Bazaar:
$ mkdir myproject
$ cd myproject
$ mkdir subdirectory
$ touch test1.txt test2.txt test3.txt subdirectory/test4.txt
Note for Windows users: use Windows Explorer to create yourdirectories, then right-click in those directories and selectNew file to create your files.
Now get Bazaar to initalize itself in your project directory:
$ bzr init
If it looks like nothing happened, don't worry. Bazaar has created a where it will store your files and their revision histories.
The next step is to tell Bazaar which files you want to track. Runningbzr add will recursively add everything in the project:
$ bzr add
added subdirectory
added test1.txt
added test2.txt
added test3.txt
added subdirectory/test4.txt
Next, take a snapshot of your files by committing them to your branch. Adda message to explain why you made the commit:
$ bzr commit -m "Initial import"
As Bazaar is a distributed version control system, it doesn't need toconnect to a central server to make the commit. Instead, Bazaar stores yourbranch and all its commits inside the directory you're working with; lookfor the .bzr sub-directory.

Let's change a file and commit that change to your branch.
Edit test1.txt in your favourite editor, then check what have you done:
$ bzr diff
=== modified file 'test1.txt'
--- test1.txt   2007-10-08 17:56:14 +0000
+++ test1.txt   2007-10-08 17:46:22 +0000
@@ -0,0 +1,1 @@
+test test test
Commit your work to the Bazaar branch:
$ bzr commit -m "Added first line of text"
Committed revision 2.

You can see the history of your branch by browsing its log:
$ bzr log
------------------------------------------------------------
revno: 2
committer: John Doe <>
branch nick: myproject
timestamp: Mon 2007-10-08 17:56:14 +0000
message:
  Added first line of text
------------------------------------------------------------
revno: 1
committer: John Doe <>
branch nick: myproject
timestamp: Mon 2006-10-08 17:46:22 +0000
message:
  Initial import

There are a couple of ways to publish your branch. If you already havean SFTP server or are comfortable setting one up, you can publish yourbranch to it.
Otherwise, skip to the next section to publish with , a freehosting service for Bazaar.
Let's assume you want to publish your branch at
$ bzr push --create-prefix s
2 revision(s) pushed.
Bazaar will create a myproject directory on the remote server andpush your branch to it.
Now anyone can create their own copy of your branch by typing:
$ bzr branch
Note: to use sftp, you may need to install paramiko andpyCrypto. See for details.

Launchpad is a suite of development and hosting tools for freesoftware projects. You can use it to publish your branch.
If you don't have a Launchpad account, follow the and in your new Launchpad account.
Replacing john.doe with your own Launchpad username, type:
$ bzr push bzr+ssh://john.doe@bazaar.launchpad.net/~john.doe/+junk/myproject
Note: +junk means that this branch isn't associated with any particularproject in Launchpad.
Now, anyone can create their own copy of your branch by typing:
$ bzr branch
You can also see information about your branch, including its revisionhistory, at

To work with someone else's code, you can make your own copy of theirbranch. Let's take a real-world example, Bazaar's GTK interface:
$ bzr branch bzr-gtk.john
Branched 292 revision(s).
Bazaar will download all the files and complete revision history from thebzr-gtk project's trunk branch and create a copy called bzr-gtk.john.
Now, you have your own copy of the branch and can commit changes withor without a net connection. You can share your branch at any time bypublishing it and, if the  bzr-gtk team want to use your work, Bazaarmakes it easy for them to merge your branch back into their trunk branch.

While you commit changes to your branch, it's likely that other people willalso continue to commit code to the parent branch.
To make sure your branch stays up to date, you should merge changes fromthe parent into your personal branch:
$ bzr merge
Using saved location:
All changes applied successfully.
Check what has changed:
$ bzr diff
If you're happy with the changes, you can commit them to your personalbranch:
$ bzr commit -m "Merge from main branch"
Committed revision 295.

After you've worked on your personal branch of bzr-gtk, you may want tosend your changes back upstream to the project. The easiest way is touse a merge directive.
A merge directive is a machine-readable request to perform aparticular merge.  It usually contains a patch preview of the mergeand either contains the necessary revisions, or provides a branchwhere they can be found.
Replacing mycode.patch, create your merge directive:
$ bzr send -o mycode.patch
Using saved location:
You can now email the merge directive to the bzr-gtk project who, ifthey choose, can use it merge your work back into the parent branch.

You can find out more about Bazaar in the.
To learn about Bazaar on the command-line:
$ bzr help
To learn about Bazaar commands:
$ bzr help commands
To learn about the ''foo'' topic or command:
$ bzr help foo      
--------------------next---------------------

阅读(332) | 评论(0) | 转发(0) |
0

上一篇:apache2问题??

下一篇:openwebmail配置问题

给主人留下些什么吧!~~