Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Open Source

Subversion and Linux: Setup and Use, Part 2


Reserved Keywords

HEAD, BASE, PREV, and COMMITTED are, to paraphrase from the Collins-Sussman SVN book, "reserved revision entities" (i.e., reserved keywords that help quickly and easily identify certain versions).

  • HEAD indicates the LATEST revision of the repository as in the following examples:

$/opt/svn-1.4.3/bin/svn log -r HEAD file:///opt/samagdocs

r48 | ram | 2007-05-02 08:25:06 +0530 (Wed, 02 May 2007) | 1 line

update number three

$/opt/svn-1.4.3/bin/svn log -r HEAD /home/ram/svnarticle_rndtwo

r48 | ram | 2007-05-02 08:25:06 +0530 (Wed, 02 May 2007) | 1 line

update number three

  • BASE indicates the revision of the working copy and works only on the working copy, not on the repository:

$/opt/svn-1.4.3/bin/svn log -r BASE file:///opt/samagdocs

svn: 'file:///opt' is not a working copy
svn: Can't open file 'file:///opt/.svn/entries': No such file or directory

$/opt/svn-1.4.3/bin/svn log -r BASE /home/ram/svnarticle_rndtwo

r48 | ram | 2007-05-02 08:25:06 +0530 (Wed, 02 May 2007) | 1 line

update number three

  • COMMITTED is the most recent revision of an item in the working copy:

$/opt/svn-1.4.3/bin/svn log -r COMMITTED /home/ram/svnarticle_rndtwo/svnarticle_serone

r49 | ram | 2007-05-04 06:07:53 +0530 (Fri, 04 May 2007) | 1 line

updated four on reserved keywords

  • PREV is revision of an item in the working copy, which is equivalent to COMMITTED less one:

$/opt/svn-1.4.3/bin/svn log -r PREV /home/ram/svnarticle_rndtwo/svnarticle_serone

r48 | ram | 2007-05-02 08:25:06 +0530 (Wed, 02 May 2007) | 1 line

update number three

In addition to these reserved revision keywords, SVN also allows "dates" as revision keywords that can be passed as values to the "--revision" or "-r" switch. Dates with spaces between them should be separated by quotes.

Note: The SVN command that contains date keywords without reference to the actual time of the day outputs the most recent revision of the repository as of that date.

The use of "real dates" as keywords is shown below. The command shown extracts the log of the working copy, with its revision as of January 1, 2007:

$/opt/svn-1.4.3/bin/svn log  -r {2007-01-01} /home/ram/svnarticle_rndtwo

r9 | ram | 2006-12-26 00:23:34 +0530 (Tue, 26 Dec 2006) | 1 line

svnserve updated screenshots

Managing Parallel Development

Provision of branches, in any version control infrastructure, raises the temptations of the developers to branch everything. This style of working indirectly brings along with it divergence from the stable base; if not handled properly, it may result in conditions where returning (or "re-basing") to the stable base can be a complex effort.

This task of re-basing the code is made possible by SVN's merge utility. The SVN merge compares two repository trees and applies the differences to the local directory that belongs to the working copy.

Arguments to the SVN merge command are:

  • Initial repo tree
  • Destination repo tree
  • Working copy, where the differences between the trees shall be applied

Without performing the actual merge, it is possible to know what may happen if the actual merge were run, with the preview option, "--dry-run". With the help of actual examples, involving two branches (actually, one is a tag), I will explain what is happening under the hood.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.