Monday, August 10, 2009

Options: Episode-5

--revision

In Subversion, when each time the repository accepts a commit, it creates a new state of filesystem tree. This is called “Revision”. Each “Revision” is assigned a unique whole number, one greater than the previous revision. The initial revision, when the repository was created, is numbered '0'. This consists of only root directory.

In Subversion, the revision number applies to the entire tree and not to the individual file. Revision 'N' represents the state of the repository file system after the Nth commit. Whenever the user selects a particular revision, it means he is selecting the entire tree, after a particular revision.

The option “--revision”is used to provide revision detail for a particular operation. The user can provide only a particular revision or a range of revision to that operation. If a range of revision is given as input then, the range should be separated by a colon. “-r” is the short form of the option.

The svn understands a number of revision keywords. These keywords could be used by the user instead of integers as an argument for the option. These keywords are resolved by the svn. The keywords are as follows:
1.HEAD: The latest (or youngest) revision in the repository.
2.BASE: The revision number of an item in the working copy. If the user has modified the working copy, then this refers to the item as appears without the modifications.
3.Committed: The most recent revision prior to, or equal to, BASE, in which an item changed.
4.PREV: The revision immediately before the last revision in which the item has been changed.

The “--revision” option can also accept date as argument. It accepts the standard ISO-8601 date and time formats. The date should be given inside curly braces '{' '}'. Here are few valid date formats
1.{2009-07-25}
2.{13:45}
3.{13:46:00.45}
4.{“2009-7-25 13:46”}
5.{"2006-02-17 15:30 +0230"}
6.{2006-02-17T15:30}
7.{2006-02-17T15:30Z}
8.{2006-02-17T15:30-04:00}
9.{20060217T1530}
10.{20060217T1530Z}
11.{20060217T1530-0500}

When the user passes date as the argument, then Subversion will resolve that into the most recent revision to the repository as of that date. Remember, If you pass a date, then Subversion will fetch you the most recent revision which was committed as of that date and not committed on that date. That means, if you pass {2009-7-25}, then user won't get the revision that has been committed on 25th of July, instead the user gets a revision which was latest as of 25th July.

The user can also specify a range of dates. The Subversion will find all the revisions between that dates. The range can be specified by a colon between to dates.
E.g.: {2006-7-25}:{2009-7-25}

P.S: The revision timestamp property in the Subversion is a modifiable property. The timestamp can be changed to anything or even completely removed. The Subversion sees the datestamps maintained in a sequential order to correctly convert the date into revision. If this order isn't maintained, then Subversion may return a wrong data for the specified date.

No comments:

Post a Comment