Differences between revisions 2 and 3
Revision 2 as of 2006-09-15 06:14:04
Size: 6261
Editor: BenLuo
Comment:
Revision 3 as of 2006-11-18 11:10:24
Size: 6215
Editor: 218
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
Let's take a look at the history of this repository. To do this, we use the {{{log}}} command. This prints a summary of every event that has occurred in the [:Repository:仓库], going backwards in time from the most recent. 让我们看一看这个仓库的历史记录。我们用 {{{log}}} 命令来做这个事情。这个命令按时间顺序从近到远输出在[:Repository:仓库]中发生的每一个事件。
Line 22: Line 22:
These lines of output bear some describing. 这些输出行的含义是这样的。
Line 24: Line 24:
 * Each paragraph describes a particular ChangeSet. A ChangeSet is a modification of one or more files, grouped together into a logical unit.  * 每一段描述一个特定的改变集。A ChangeSet is a modification of one or more files, grouped together into a logical unit.

教程 - 检查仓库历史

现在我们已经参照 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

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

  • 每一段描述一个特定的改变集。A ChangeSet is a modification of one or more files, grouped together into a logical unit.

    • In our case above, we can see that the [Repository:仓库]'s history consists of two ["ChangeSet"]s.

  • changeset identifies a ChangeSet.

    • The first number before the colon is a RevisionNumber; it is a local short-hand way of identifying the ChangeSet. It is only valid within this ["Repository"].

    • The long hexadecimal string after the colon is a ChangeSetID; it uniquely identifies the ChangeSet, and is the same in all repositories that contain this ChangeSet. 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.

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

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:

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