Discussion:
How to check out a project based on commit time rather than rev?
Dane Kantner
2018-05-18 20:36:02 UTC
Permalink
svn log -v -r {2012-05-06}:{2017-01-01} <URL to server side directory> is
not reliable though as it doesn't actually consistently return the data
correctly ; there has been a past topic on this and it's been explained as
a known defect due to how it was implemented. You're better off trying to
determine the revision number in play at the time of the start, and at the
time of the end, then using the revision numbers instead.
On Fri, 18 May 2018 18:00:21 +0200, Bo Berglund
Obviously this is a "for dummies" question but I *have* looked at the
I did not read good enough!
This worked fine to get the information I needed concerning active
svn log -v -r {2012-05-06}:{2017-01-01} <URL to server side directory>
log.txt
So now I can use this to compare the files and add what is lacking to
the wc I have checked out to make it be current at the date I need.
Sorry for the noise!
--
Bo Berglund
Developer in Sweden
I've wondered why there isn't a checkout or update command that takes a
date and time but usually I look in the log to figure out what is the
revision number.
I don't know how CVS works but with Subversion, when you checkout an old
revision, you get the directories and files exactly as they looked in that
revision (including files that were not changed in that revision). Think of
it as a snapshot of how everything looked at that moment. Just make sure
each time you commit that Subversion knows about all the files you intend
to keep -- ie that svn st in the working copy directory does not show '?'
on files that should be under version control. You're allowed to have
unversioned files alongside versioned ones, eg for intermediate build
artifacts, editor bak files, and other junk.
Paul Hammant
2018-05-18 16:38:58 UTC
Permalink
You have Linux Subsystem for Windows* installed? If yes, I see a bash
oneliner coming :)

- Paul

* yes yes, some genius in MS named it Windows Subsystem for Linux (WSL).
On Fri, 18 May 2018 18:00:21 +0200, Bo Berglund
Obviously this is a "for dummies" question but I *have* looked at the
I did not read good enough!
This worked fine to get the information I needed concerning active
svn log -v -r {2012-05-06}:{2017-01-01} <URL to server side directory>
log.txt
So now I can use this to compare the files and add what is lacking to
the wc I have checked out to make it be current at the date I need.
Sorry for the noise!
--
Bo Berglund
Developer in Sweden
--
Paul Hammant DevOps <https://devops.paulhammant.com> Let me give your
enterprise a step by step plan to get out of the hell of crazy branching
models (ClearCase maybe?) and into the world of high-throughput CD on
DevOps foundations.
Paul Hammant
2018-05-18 16:39:53 UTC
Permalink
Ooops, my apologies for top posting, folks.
Ryan Schmidt
2018-05-18 23:55:19 UTC
Permalink
Obviously this is a "for dummies" question but I *have* looked at the
I did not read good enough!
This worked fine to get the information I needed concerning active
svn log -v -r {2012-05-06}:{2017-01-01} <URL to server side directory>
log.txt
So now I can use this to compare the files and add what is lacking to
the wc I have checked out to make it be current at the date I need.
I've wondered why there isn't a checkout or update command that takes a date and time but usually I look in the log to figure out what is the revision number.
There is no need for a separate command because any command that takes a revision number can also accept a date and time. If no time is specified, the time is midnight. Subversion then uses the newest revision that precedes the given date and time. For example, if I request to check out MacPorts code from midnight October 10, 2002:

$ cd /tmp
$ svn co https://svn.macports.org/repository/macports/trunk -r '{2002-10-10}'
$ cd trunk
$ svn info
Path: .
Working Copy Root Path: /private/tmp/trunk
URL: https://svn.macports.org/repository/macports/trunk
Relative URL: ^/trunk
Repository Root: https://svn.macports.org/repository/macports
Repository UUID: d073be05-634f-4543-b044-5fe20cf6d1d6
Revision: 1025
Node Kind: directory
Schedule: normal
Last Changed Author: jpm
Last Changed Rev: 1025
Last Changed Date: 2002-10-09 22:38:38 -0500 (Wed, 09 Oct 2002)

I get revision 1025, the newest revision that is not after midnight October 10, 2002.
Daniel Shahaf
2018-05-19 08:10:11 UTC
Permalink
Post by Ryan Schmidt
There is no need for a separate command because any command that takes a
revision number can also accept a date and time. If no time is
specified, the time is midnight. Subversion then uses the newest
revision that precedes the given date and time.
To be more precise, dates are resolved to revision numbers using binary
search on the revisions space, comparing by the svn:date revprop's
value; that process can give different answers over time (as HEAD
increases) if the sequence of svn:date values isn't monotonically
increasing, which can happen, for instance, when doing 'svnadmin load'
into an existing repository.

Ryan Schmidt
2018-05-19 00:05:50 UTC
Permalink
So now I know what has happened and I found the revision numbers for
two revisions that were committed erroneously last December when I was
preparing for the CVS -> SVN migration.
These revisions are 4309 and 4310
Now my problem is in finding the correct svn command to restore the
trunk files to the state they were in prior to commit r4309.
I have googled a lot tonight and read the svnbook too but I am none
the wiser (not so that I dare run a command and risk screwing up the
repository).
I have some candidates within the top dir of a WC of the
svn merge -c 4308:HEAD .
svn merge -r 4308:HEAD .
svn merge -r 4309:HEAD .
svn merge -c COMMITTED:PREV .
----------
1) Use -c or -r?
2) Which order of revision numbers?
3) What to do to restore to two revisions back?
When merging:

"-c 500" is a shorthand synonym for "-r 499:500".

"-r 499:500" means "the set of steps to turn r499 into r500".

You'll use this if you want to repeat what you did in a revision, for example to make the same change on another branch.

If instead you want to undo a change you already committed, then you'll want to merge in the reverse order: "-r 500:499" to turn 500 back into 499, or using the shorthand: "-c -500".

If you want to do two revisions at once, just extend the range, e.g. "-r 498:500" is the steps to turn r498 into r500.

So if you want to undo what you did in revisions 4309 and 4310, you would merge "-r 4310:4308".

http://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo
Loading...