How to get from SVN the previous revision before the HEAD?
I have the latest revision checked out to my workin开发者_StackOverflow社区g copy, but it's broken - it can't compiled.
How to get the previous revision before the head? And if it's broken too - the previous before the previous?
svn update -r PREV
Here's a link to the documentation on revision keywords.
If none of the keywords (HEAD, BASE, COMMITTED, or PREV) is exactly what you want, then just look in the log and find an explicit revision number to update to.
If you know the revision number of a good build, then rather than stepping back-- from head until you find the revision that broke the build, you might use 'divide and conquer' to find the problem. If you've got any more than a few revisions since the last known good this will save you time.
Pseudo code:
known_good=whatever
known_bad=head_revision
start:
candidate=(known_good + known_bad) / 2
build candidate
if success
known_good=candidate
else
known_bad=candidate
if (known_good + 1) == known_bad
goto end
go to start:
end:
Glossing over odd numbered revisions a bit there...
svn info http://[server]:[host]/myrepo
will give you the revision of the repository.
Then update your local copy with svn update -r [revision-1] http://[server]:[host]/myrepo
You'd have to fetch the current revision number, decrease it by one and svn update
to that revision until you find a build that works. I don't think Subversion can provide you much automated help here, because it can't know which revision will compile.
See these questions on how to get hold of the current revision number:
- SO # 1991526
- SO # 110175
for TortoiseSVN using the context menu: svn->Update to revision
for command line use
svn update --revision svn://repo
If you really wanna be fancy about it, you can make a script where you give it the current revision number of HEAD and from there it goes down revisions until make
(or whatever) doesn't return an error.
精彩评论