Skip to content

Commit c4a1521

Browse files
ousugonetworm
authored andcommitted
translate import-bzr.asc
1 parent 7d64fb0 commit c4a1521

File tree

1 file changed

+33
-44
lines changed

1 file changed

+33
-44
lines changed
Lines changed: 33 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,45 @@
11
==== Bazaar
22
(((Bazaar)))(((Importing, from Bazaar)))
33

4-
Bazaar is a DVCS tool much like Git, and as a result it's pretty straightforward to convert a Bazaar repository into a Git one.
5-
To accomplish this, you'll need to import the `bzr-fastimport` plugin.
4+
Bazaar 是一个和 Git 非常类似的分布式版本控制系统(DVCS),因此将 Bazzar 仓库转换成 Git 仓库是非常简单易懂的。想要完成转换,你需要安装 `bzr-fastimport` 插件。
65

7-
===== Getting the bzr-fastimport plugin
6+
===== 安装 bzr-fastimport 插件
87

9-
The procedure for installing the fastimport plugin is different on UNIX-like operating systems and on Windows.
10-
In the first case, the simplest is to install the `bzr-fastimport` package that will install all the required dependencies.
8+
安装 fastimport 插件的步骤在类 UNIX 操作系统和 Windows 上是不一样的。在类 UNIX 系统上,最简单的办法就是安装 `bzr-fastimport` 包,这种方法将会自动安装所有需要的依赖。
119

12-
For example, with Debian and derived, you would do the following:
10+
例如,使用 Debian 及其派生系统,你只需要进行以下操作:
1311

1412
[source,console]
1513
----
1614
$ sudo apt-get install bzr-fastimport
1715
----
1816

19-
With RHEL, you would do the following:
17+
红帽企业版系统(RHEL),使用以下命令:
2018

2119
[source,console]
2220
----
2321
$ sudo yum install bzr-fastimport
2422
----
2523

26-
With Fedora, since release 22, the new package manager is dnf:
24+
Fedora 从 22 版本开始,采用了新的包管理器 dnf,使用以下命令:
2725

2826
[source,console]
2927
----
3028
$ sudo dnf install bzr-fastimport
3129
----
3230

33-
If the package is not available, you may install it as a plugin:
31+
如果直接安装包的方法不行,你可能需要使用安装插件的方法:
3432

3533
[source,console]
3634
----
37-
$ mkdir --parents ~/.bazaar/plugins # creates the necessary folders for the plugins
35+
$ mkdir --parents ~/.bazaar/plugins # 为插件创建必要的文件夹
3836
$ cd ~/.bazaar/plugins
39-
$ bzr branch lp:bzr-fastimport fastimport # imports the fastimport plugin
37+
$ bzr branch lp:bzr-fastimport fastimport # 引入 fastimport 插件
4038
$ cd fastimport
41-
$ sudo python setup.py install --record=files.txt # installs the plugin
39+
$ sudo python setup.py install --record=files.txt # 安装插件
4240
----
4341

44-
For this plugin to work, you'll also need the `fastimport` Python module.
45-
You can check whether it is present or not and install it with the following commands:
42+
为了确保插件工作,你同时也需要安装有 `fastimport` 这一 Python 模块。使用下面的命令可以检查这一模块安装与否,如果没有则安装这一模块:
4643

4744
[source,console]
4845
----
@@ -52,87 +49,79 @@ Traceback (most recent call last):
5249
ImportError: No module named fastimport
5350
$ pip install fastimport
5451
----
55-
If it is not available, you can download it at address https://pypi.python.org/pypi/fastimport/.
52+
如果上面的命令安装失败,你可以直接到这个地址下载 https://pypi.python.org/pypi/fastimport/
5653

57-
In the second case (on Windows), `bzr-fastimport` is automatically installed with the standalone version and the default installation (let all the checkboxes checked).
58-
So in this case you have nothing to do.
54+
在 Windows 上,`bzr-fastimport` 插件在 Git 使用脱机安装并保持默认安装选项不变(可选框全部选中)的情况下是自动安装的。在这种情况下,你什么都不用做。
5955

60-
At this point, the way to import a Bazaar repository differs according to that you have a single branch or you are working with a repository that has several branches.
56+
接下来,导入 Bazaar 仓库的方法根据你的仓库是有一个分支还是有多个分支而不同。
6157

62-
===== Project with a single branch
58+
===== 单分支项目
6359

64-
Now `cd` in the directory that contains your Bazaar repository and initialize the Git repository:
60+
`cd` 到包含你的 Bazaar 仓库的路径,然后初始化 Git 仓库:
6561

6662
[source,console]
6763
----
6864
$ cd /path/to/the/bzr/repository
6965
$ git init
7066
----
7167

72-
Now, you can simply export your Bazaar repository and convert it into a Git repository using the following command:
68+
现在你可以使用以下命令轻松地导出你的 Bazaar 仓库并把它转化成 Git 仓库:
7369

7470
[source,console]
7571
----
7672
$ bzr fast-export --plain . | git fast-import
7773
----
7874

79-
Depending on the size of the project, your Git repository is built in a lapse from a few seconds to a few minutes.
75+
根据项目的大小,Git 仓库会在几秒钟到几分钟之间构建。
8076

81-
===== Case of a project with a main branch and a working branch
77+
===== 多分支项目
8278

83-
You can also import a Bazaar repository that contains branches.
84-
Let us suppose that you have two branches: one represents the main branch (myProject.trunk), the other one is the working branch (myProject.work).
79+
你同样也能够导入包含多个分支的 Bazaar 仓库。让我们假设你有两个分支,一个代表主分支(myProject.trunk),另一个是工作分支(myProject.work)。
8580

8681
[source,console]
8782
----
8883
$ ls
8984
myProject.trunk myProject.work
9085
----
9186

92-
Create the Git repository and `cd` into it:
87+
创建一个 Git 仓库并 `cd` 进去:
9388

9489
[source,console]
9590
----
9691
$ git init git-repo
9792
$ cd git-repo
9893
----
9994

100-
Pull the `master` branch into git:
95+
`master` 分支拉入 Git:
10196

10297
[source,console]
10398
----
10499
$ bzr fast-export --export-marks=../marks.bzr ../myProject.trunk | \
105100
git fast-import --export-marks=../marks.git
106101
----
107102

108-
Pull the working branch into Git:
103+
将工作分支拉入 Git
109104

110105
[source,console]
111106
----
112107
$ bzr fast-export --marks=../marks.bzr --git-branch=work ../myProject.work | \
113108
git fast-import --import-marks=../marks.git --export-marks=../marks.git
114109
----
115110

116-
Now `git branch` shows you the `master` branch as well as the `work` branch.
117-
Check the logs to make sure they're complete and get rid of the `marks.bzr` and `marks.git` files.
111+
现在 `git branch` 会同时显示 `master` 分支和 `work` 分支。检查日志以确保它们是完整的,并删除 `marks.bzr` 和 `marks.git` 文件。
118112

119-
===== Synchronizing the staging area
120-
121-
Whatever the number of branches you had and the import method you used, your staging area is not synchronized with `HEAD`, and with the import of several branches, your working directory is not synchronized either.
122-
This situation is easily solved by the following command:
113+
===== 同步暂存区
114+
无论你有多少分支以及使用的导入方法如何,你的暂存区都不会与 `HEAD` 同步,并且在导入多个分支时,你的工作目录也不会同步。这种情况使用下面的命令可以轻松解决:
123115

124116
[source,console]
125117
----
126118
$ git reset --hard HEAD
127119
----
128120

129-
===== Ignoring the files that were ignored with .bzrignore
130-
131-
Now let's have a look at the files to ignore.
132-
The first thing to do is to rename `.bzrignore` into `.gitignore`.
133-
If the `.bzrignore` file contains one or several lines starting with "!!" or "RE:", you'll have to modify it and perhaps create several `.gitignore` files in order to ignore exactly the same files that Bazaar was ignoring.
121+
===== 忽略被 .bzrignore 文件指明忽略的文件
122+
现在让我们看看要忽略的文件。第一件事情就是将 `.bzrignore` 重命名为 `.gitignore`。如果 `.bzrignore` 文件里面有一行或数行以“!!”或“RE:”开头的内容,你必须修改它,并且可能还要创建几个 `.gitignore` 文件,以便忽略与 Bazaar 忽略的文件完全相同的文件。
134123

135-
Finally, you will have to create a commit that contains this modification for the migration:
124+
最后,你必须创建一个提交,其中包含此次迁移的修改。
136125

137126
[source,console]
138127
----
@@ -141,10 +130,10 @@ $ # modify .gitignore if needed
141130
$ git commit -am 'Migration from Bazaar to Git'
142131
----
143132

144-
===== Sending your repository to the server
133+
===== 推送你的仓库到服务器
145134

146-
Here we are!
147-
Now you can push the repository onto its new home server:
135+
终于到这一步了!
136+
现在你可以推送仓库到它的“云端新家”了:
148137

149138
[source,console]
150139
----
@@ -153,4 +142,4 @@ $ git push origin --all
153142
$ git push origin --tags
154143
----
155144

156-
Your Git repository is ready to use.
145+
你的 Git 仓库准备就绪。

0 commit comments

Comments
 (0)