SVN Base and head revision

revision是修订版本的意思,别误当成reversion
简单的说,当你checkout一个版本下来,然后在本地做了修改,并且还没有提交代码,此时base代表没有本地修改的你刚才checkout的那个版本,head代表repository里面的最新版本(其它人可能有提交),当你提交后,并且没有他人提交,此时base应该与head相等。


HEAD is the latest revision in the repository. BASE is the last revision you have obtained from the repository. They are the same after a successful commit or update.

When you make changes, your files differ from the BASE copies. When you revert, they go back to matching the BASE revision. When you get a conflict, you do not update the repository. Rather, your files are considered to still be "being edited" as if you were making changes. After you resolve conflicts, you have in essence decided what the final files will look like and you then commit them as you would have normally. So, conflicts are like a case of special editing.


Revision reference:
http://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html

Revision Keywords
The Subversion client understands a number of revision keywords. These keywords can be used instead of integer arguments to the --revision (-r) option, and are resolved into specific revision numbers by Subversion:

HEAD
The latest (or “youngest”) revision in the repository.

BASE
The revision number of an item in a working copy. If the item has been locally modified, this refers to the way the item appears without those local modifications.

COMMITTED
The most recent revision prior to, or equal to, BASE, in which an item changed.

PREV
The revision immediately before the last revision in which an item changed. Technically, this boils down to COMMITTED-1.

As can be derived from their descriptions, the PREV, BASE, and COMMITTED revision keywords are used only when referring to a working copy path—they don't apply to repository URLs. HEAD, on the other hand, can be used in conjunction with both of these path types.

Here are some examples of revision keywords in action:

$ svn diff -r PREV:COMMITTED foo.c
# shows the last change committed to foo.c

$ svn log -r HEAD
# shows log message for the latest repository commit

$ svn diff -r HEAD
# compares your working copy (with all of its local changes) to the
# latest version of that tree in the repository

$ svn diff -r BASE:HEAD foo.c
# compares the unmodified version of foo.c with the latest version of
# foo.c in the repository

$ svn log -r BASE:HEAD
# shows all commit logs for the current versioned directory since you
# last updated

$ svn update -r PREV foo.c
# rewinds the last change on foo.c, decreasing foo.c's working revision

$ svn diff -r BASE:14 foo.c
# compares the unmodified version of foo.c with the way foo.c looked
# in revision 14
Revision Dates
Revision numbers reveal nothing about the world outside the version control system, but sometimes you need to correlate a moment in real time with a moment in version history. To facilitate this, the --revision (-r) option can also accept as input date specifiers wrapped in curly braces ({ and }). Subversion accepts the standard ISO-8601 date and time formats, plus a few others. Here are some examples.

$ svn update -r {2006-02-17}
$ svn update -r {15:30}
$ svn update -r {15:30:00.200000}
$ svn update -r {"2006-02-17 15:30"}
$ svn update -r {"2006-02-17 15:30 +0230"}
$ svn update -r {2006-02-17T15:30}
$ svn update -r {2006-02-17T15:30Z}
$ svn update -r {2006-02-17T15:30-04:00}
$ svn update -r {20060217T1530}
$ svn update -r {20060217T1530Z}
$ svn update -r {20060217T1530-0500}

猜你喜欢

转载自darrenzhu.iteye.com/blog/1819685