Update svn checkout to specific date including externals

19,068

I hope, anybody will implement my common-sense logic (limited to directory-type externals in some areas) into bash and cmd-script sooner or later and we'll get "definitive answer" to this repeating question

Your base task is:

  • svn up your super-repo to needed point in past (updating to date /and without time/ is, BTW, not a best choice, but - apllicable)
  • get list of paths to all externals in your project (because externals definitions can exist anywhere in tree), from WC-root svn propget svn:externals -R (-R in order to check the whole tree without a lot of cd)
  • for each string in propget output (with format like this . - https://subversion.assembla.com/svn/subversion-trouble-shooting/trunk/lib lib): cd to the last field of string /relative to the first field, which is, in turn, is relative path to root/ and svn up to the same point, as it was done for superrepo: svn update -r {2010-10-17}

As result you'll have Mixed Working Copy, but superrepo and externals will be in state "for some revision in the past"

Note:

Additional sample for constructing local path to directory with externals (nested WC really) on more complex case.

For

>svn propget svn:externals -R
tags\1.0.1 - -r 2 https://subversion.assembla.com/svn/subversion-trouble-shooting/trunk/lib@2 lib

trunk - https://subversion.assembla.com/svn/subversion-trouble-shooting/trunk/lib lib

finals paths to externals in my WC will be (relative to WC-root)

tags\1.0.1\lib
trunk\lib
Share:
19,068
Sam Liao
Author by

Sam Liao

Updated on June 17, 2022

Comments

  • Sam Liao
    Sam Liao about 2 years

    I want to perform an svn update to a specific date, and I can do this with svn update -r {2010-10-17}. Unfortunately when this encounters an external it will do the update within the external without passing through the -r {2010-10-17} option. This results in us getting the correct past revision of the base code, but the latest (undesired) versions of many of the externals.

    How can I update to a specific revision or date and have this recurse correctly through the externals?

    (Note: I understand that the mistake here might have been to use externals with no explicit revisions specified.)

  • Sam Liao
    Sam Liao over 13 years
    Can you explain what an "externals config" is? Do you mean the svn:externals property? If you mean that our externals properties should all use explicit revision numbers, then yes I might agree with you, but I can't go back and edit the many commits for which this wasn't the case. Perhaps I misunderstand your suggestion.
  • Karl P
    Karl P over 13 years
    Sorry, yeah, the svn:externals property. You only have that in one or two places right? Although, now rereading your question, you want to be going back in time, which will reset the svn:externals property too. So yes, you should have used explicit revisions on your externals, and now you're going to have to do it manually :)