Differences between revisions 8 and 9
Revision 8 as of 2007-11-16 02:45:14
Size: 6390
Editor: ZhuYanhai
Comment:
Revision 9 as of 2008-01-12 15:59:25
Size: 6372
Editor: BenLuo
Comment:
Deletions are marked like this. Additions are marked like this.
Line 31: Line 31:
   * The special ["Tag"] named {{{tip}}} always identifies the ["Tip"], which is the most recent ChangeSet in the ["Repository"]. If you create another ChangeSet (and we will, soon), that will become the ["Tip"].
 * {{{user}}} identifies the person who created the ChangeSet. This is a free-form string; it usually contains an email address, and sometimes a person's name, too.
   * 名叫{{{tip}}} 的特殊[:"Tag":标签]总是表示,它是[:Repository:仓库]中最后一个[:"ChangeSet":改变集]。 如果你创建另外的[:"ChangeSet":改变集](一会我们会看到),那么它将会变成 ["Tip"]。
 * {{{user}}} 确定了谁创建了本[:"ChangeSet":改变集]。This is a free-form string; it usually contains an email address, and sometimes a person's name, too.
Line 83: Line 83:
The {{{log}}} command comes with a {{{-r}}} option to view specific changesets. {{{log}}} 命令与 {{{-r}}} 选项一起使用可以查看特定改变集。
Line 96: Line 97:
The {{{log}}} command also comes with a {{{-p}}} option to show the patches associated with the changesets: {{{log}}} 命令与 {{{-p}}} 选项一起可以显示和此改变集相关联的补丁。
Line 114: Line 115:
We can also use the {{{tip}}} command to show info of the ''tip'', i.e. the latest, changeset. The {{{tip}}} command may be considered a shortcut to {{{log -r tip}}}, except that it does not support the {{{-p}}} option. 我们也可以使用 {{{tip}}} 命令来显示 ''tip'' 的信息,如最后的改变集。 {{{tip}}} 命令除了不支持 {{{-p}}} 选项外,它可以当做 {{{log -r tip}}} 的快捷方式,
Line 133: Line 134:
Now that we have some slight idea of what has happened, let's jump in and make some changes! Onwards, to [:ChineseTutorialFirstChange:教程 - 生成第一个[变更]]! 现在我们对发生了什么有了一点概念,现在让我们进入并做一些修改吧!进入 [:ChineseTutorialFirstChange:教程 - 生成第一个[变更]]!

教程 - 检查仓库历史

现在我们已经参照 [:ChineseTutorialClone:教程 - 克隆仓库] 克隆了一个 [:Repository:仓库]; 我们仓库的本地拷贝叫 my-hello.

让我们看一看这个仓库的历史记录。我们用 log 命令来做这个事情。这个命令按时间顺序从近到远输出在[:Repository:仓库]中发生的每一个事件。

$ cd my-hello
$ hg log
changeset:   1:82e55d328c8c
tag:         tip
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
summary:     Create a makefile

changeset:   0:0a04b987be5a
user:        mpm@selenic.com
date:        Fri Aug 26 01:20:50 2005 -0700
summary:     Create a standard "hello, world" program

这些输出行的含义是这样的。

  • 每一段描述一个特定的改变集。一个或几个文件的改变集合在一起形成一个逻辑单元,称为改变集。
    • 在上面的例子中,我们可以看到该[:Repository:仓库] 的历史包括了两个[:"ChangeSet":改变集]。

  • changeset identifies a [:"ChangeSet":改变集].

    • 冒号前面的数字代表版本号; 它是一种标识[:"ChangeSet":改变集]的本地缩写.只是在你的本地[:Repository:仓库]中这个版本号才有意义.

    • 冒号后面的那个很长的十六进制串是 ChangeSetID; 它是标识[:"ChangeSet":改变集]的全局唯一标识符, 在所有包含这个[:"ChangeSet":改变集]的[:Repository:仓库]中都相同. 如果你正在和其他人讨论某个改变集,请使用这个 ChangeSetID,而不是上面说的版本号.

  • tag 是一个[:"Tag":标签],可以理解成为一个改变集指定的名字.

    • 你可以给任何改变集指定一个或者多个[:"Tag":标签]. 实际上, 许多[:"ChangeSet":改变集]都是没有[:"Tag":标签]的, 所以tag这一行很多时候都不存在.

    • 名叫tip 的特殊[:"Tag":标签]总是表示,它是[:Repository:仓库]中最后一个[:"ChangeSet":改变集]。 如果你创建另外的[:"ChangeSet":改变集](一会我们会看到),那么它将会变成 ["Tip"]。

  • user 确定了谁创建了本[:"ChangeSet":改变集]。This is a free-form string; it usually contains an email address, and sometimes a person's name, too.

  • date describes when the ChangeSet was created. These dates are printed in the local time zone the creator of the ChangeSet was in.

  • summary gives the first line of the description of the ChangeSet. This was entered by the creator of the ChangeSet at the time they created it, to help themselves and others understand the purpose of the ChangeSet.

  • parent identifies the parent ["ChangeSet"]s, in case there are more than one, which happens when you merge changes from several repositories.

    • Most of the times there is only one parent, which is the one changeset older than itself. This is the case in our example above.

我们可以通过指定-v诊断输出选项来获得更多更详细的历史信息, 或者指定--debug选项来获得历史信息中的一切细节:

$ hg log -v
changeset:   1:82e55d328c8ca4ee16520036c0aaace03a5beb65
tag:         tip
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
files:       Makefile
description:
Create a makefile

(...)

$ hg log --debug
manifest:    1:0c7c1d435e6703e03ac6634a7c32da3a082d1600
changeset:   1:82e55d328c8ca4ee16520036c0aaace03a5beb65
tag:         tip
parent:      0:0a04b987be5ae354b710cefeba0e2d9de7ad41a9
parent:      -1:0000000000000000000000000000000000000000
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
files+:      Makefile
description:
Create a makefile

(...)

Verbose output contains a few more fields than the default output.

  • changeset now gives the unabbreviated ChangeSetID.

  • files lists the files modified in this ChangeSet.

  • description contains the complete multi-line description of the ChangeSet, rather than just the first line.

    • In our case, the descriptions are only one-line long, so there's not much difference.

The --debug output adds the following fields to the verbose output:

  • file+ lists the file added in this changeset.

  • file- lists the file removed in this changeset.

  • manifest gives the ["Manifest"] ID for this changeset.

  • two parent fields giving the changeset ID of both parents for this changeset, where -1:0000000000000000000000000000000000000000 refers to a non-existant parent.

log 命令与 -r 选项一起使用可以查看特定改变集。

$ hg log -r1
changeset:   1:82e55d328c8c
tag:         tip
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
summary:     Create a makefile

<!> The -r option actually supports a very flexible syntax to select range of changesets. However, due to limited number of changesets available in our sample repository, we are unable to provide a good demonstration. Please consult Mercurial's [http://www.selenic.com/mercurial/hg.1.html manpage] for more information.

log 命令与 -p 选项一起可以显示和此改变集相关联的补丁。

$ hg log -r1 -p
changeset:   1:82e55d328c8c
tag:         tip
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
summary:     Create a makefile

diff -r 0a04b987be5a -r 82e55d328c8c Makefile
--- /dev/null   Fri Aug 26 01:20:50 2005 -0700
+++ b/Makefile  Fri Aug 26 01:21:28 2005 -0700
@@ -0,0 +1,1 @@
+all: hello

我们也可以使用 tip 命令来显示 tip 的信息,如最后的改变集。 tip 命令除了不支持 -p 选项外,它可以当做 log -r tip 的快捷方式,

$ hg tip
changeset:   1:82e55d328c8c
tag:         tip
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
summary:     Create a makefile

$ hg log -r tip
changeset:   1:82e55d328c8c
tag:         tip
user:        mpm@selenic.com
date:        Fri Aug 26 01:21:28 2005 -0700
summary:     Create a makefile

现在我们对发生了什么有了一点概念,现在让我们进入并做一些修改吧!进入 [:ChineseTutorialFirstChange:教程 - 生成第一个[变更]]!

ChineseTutorialHistory (last edited 2012-11-06 23:51:05 by abuehl)