Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update svn checkout to specific date including externals

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.)

like image 697
pauldoo Avatar asked Nov 17 '10 12:11

pauldoo


1 Answers

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
like image 63
Lazy Badger Avatar answered Oct 11 '22 00:10

Lazy Badger