Differences between revisions 7 and 8
Revision 7 as of 2007-11-16 02:36:54
Size: 6298
Editor: ZhuYanhai
Comment:
Revision 8 as of 2007-11-16 02:45:14
Size: 6390
Editor: ZhuYanhai
Comment:
Deletions are marked like this. Additions are marked like this.
Line 26: Line 26:
 * {{{changeset}}} identifies a ChangeSet.
   * 冒号前面的数字代表版本号; 它是一种标识ChangeSet的本地缩写.只是在你的本地[:Repository:仓库]中这个版本号才有意义.
   * 冒号后面的那个很长的十六进制串是 ChangeSetID; 它是标识ChangeSet的全局唯一标识符, 在所有包含这个ChangeSet的[:Repository:仓库]中都相同. If you are ever discussing a ChangeSet with someone else, use the ChangeSetID, not the RevisionNumber.
 * {{{tag}}} is a ["Tag"], an arbitrary symbolic name for a ChangeSet.
   * You can assign one or more ["Tag"]s to any ChangeSet. Actually, not that many ["ChangeSet"]s will have ["Tag"]s associated with them, so the {{{tag}}} line will seldom be present.
 * {{{changeset}}} identifies a [:"ChangeSet":改变集].
   * 冒号前面的数字代表版本号; 它是一种标识[:"ChangeSet":改变集]的本地缩写.只是在你的本地[:Repository:仓库]中这个版本号才有意义.
   * 冒号后面的那个很长的十六进制串是 ChangeSetID; 它是标识[:"ChangeSet":改变集]的全局唯一标识符, 在所有包含这个[:"ChangeSet":改变集]的[:Repository:仓库]中都相同. 如果你正在和其他人讨论某个改变集,请使用这个 ChangeSetID,而不是上面说的版本号.
 * {{{tag}}} 是一个[:"Tag":标签],可以理解成为一个改变集指定的名字.
   * 你可以给任何改变集指定一个或者多个[:"Tag":标签]. 实际上, 许多[:"ChangeSet":改变集]都是没有[:"Tag":标签]的, 所以{{{tag}}}这一行很多时候都不存在.
Line 38: Line 38:
We can get more detailed history information by asking for verbose output with the {{{-v}}} option, or the {{{--debug}}} global option for everything under the sun: 我们可以通过指定{{{-v}}}诊断输出选项来获得更多更详细的历史信息, 或者指定{{{--debug}}}选项来获得历史信息中的一切细节:

教程 - 检查仓库历史

现在我们已经参照 [: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这一行很多时候都不存在.

    • 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.

  • 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.

The log command comes with a -r option to view specific changesets.

$ 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.

The log command also comes with a -p option to show the patches associated with the changesets:

$ 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

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.

$ 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

Now that we have some slight idea of what has happened, let's jump in and make some changes! Onwards, to [:ChineseTutorialFirstChange:教程 - 生成第一个[变更]]!

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