04.08.2013 Views

Version Control with Subversion - Electrical and Computer ...

Version Control with Subversion - Electrical and Computer ...

Version Control with Subversion - Electrical and Computer ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

$ svn update --revision PREV foo.c<br />

# rewinds the last change on foo.c<br />

# (foo.c's working revision is decreased)<br />

These keywords allow you to perform many common (<strong>and</strong> helpful) operations <strong>with</strong>out having to look up<br />

specific revision numbers or remember the exact revision of your working copy.<br />

Revision Dates<br />

Anywhere that you specify a revision number or revision keyword, you can also specify a date inside<br />

curly braces “{}”. You can even access a range of changes in the repository using both dates <strong>and</strong> revisions<br />

together!<br />

Here are examples of the date formats that <strong>Subversion</strong> accepts. Remember to use quotes around any date<br />

that contains spaces.<br />

$ svn checkout --revision {2002-02-17}<br />

$ svn checkout --revision {15:30}<br />

$ svn checkout --revision {15:30:00.200000}<br />

$ svn checkout --revision {"2002-02-17 15:30"}<br />

$ svn checkout --revision {"2002-02-17 15:30 +0230"}<br />

$ svn checkout --revision {2002-02-17T15:30}<br />

$ svn checkout --revision {2002-02-17T15:30Z}<br />

$ svn checkout --revision {2002-02-17T15:30-04:00}<br />

$ svn checkout --revision {20020217T1530}<br />

$ svn checkout --revision {20020217T1530Z}<br />

$ svn checkout --revision {20020217T1530-0500}<br />

…<br />

When you specify a date as a revision, <strong>Subversion</strong> finds the most recent revision of the repository as of<br />

that date:<br />

$ svn log --revision {2002-11-28}<br />

-----------------------------------------------------------------------r12<br />

| ira | 2002-11-27 12:31:51 -0600 (Wed, 27 Nov 2002) | 6 lines<br />

…<br />

Is <strong>Subversion</strong> a Day Early?<br />

Guided Tour<br />

If you specify a single date as a revision <strong>with</strong>out specifying a time of day (for example 2002-11-27), you<br />

may think that <strong>Subversion</strong> should give you the last revision that took place on the 27th of November. Instead,<br />

you'll get back a revision from the 26th, or even earlier. Remember that <strong>Subversion</strong> will find the most recent<br />

revision of the repository as of the date you give. If you give a date <strong>with</strong>out a timestamp, like 2002-11-27,<br />

<strong>Subversion</strong> assumes a time of 00:00:00, so looking for the most recent revision won't return anything on the<br />

day of the 27th.<br />

If you want to include the 27th in your search, you can either specify the 27th <strong>with</strong> the time<br />

({"2002-11-27 23:59"}), or just specify the next day ({2002-11-28}).<br />

You can also use a range of dates. <strong>Subversion</strong> will find all revisions between both dates, inclusive:<br />

22

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!