Update svn checkout to a specific date, including external

I want to update svn to a specific date, and I can do it with svn update -r {2010-10-17} . Unfortunately, when this occurs with the external, it will perform the update inside the external without going through the -r {2010-10-17} parameter -r {2010-10-17} . This leads to a correct previous revision of the base code, but to the latest (unwanted) versions of many external ones.

How can I update a specific revision or date and is it correct to edit this procedure using external ones?

(Note: I understand that the mistake here could be to use external ones, without explicit clarifications.)

+8
svn history svn-externals
source share
4 answers

Hopefully someone will implement my common sense logic (limited to external directory files in some areas) in bash and cmd script sooner or later, and we will get a “final answer” to this repeated question

Your basic task:

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

As a result, you will have a mixed working copy, but superrepo and externals will be able to "for some verification in the past"

Note:

An additional example for building a local directory path with external (nested WC really) in a 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 

final paths to external in my WC will be (relative to WC-root)

 tags\1.0.1\lib trunk\lib 
+5
source share

I am adding this answer in case someone is trying to update an already uploaded subversion repository in order to synchronize the local file dates with the repo dates that I wanted to do so that I could do FS Timestamp Comparison.

I did this oneliner to do the trick (but read the line below before using it):

svn info --show-item last-changed-date -R | xargs -I{} -P1000 -n1 sh -c 'x="{}"; set -x; exec touch -d "${x%% *}" "${x#* }"'

NOTE. . -P1000 indicates that xargs must run 1000 simultaneous copies of sh and touch for the actual update. Depending on the system load, it may be prudent to reduce this. On tiny i3-processors, the Intel NUC 1000 actually turned out to be ideal, using 80-95% of the CPU (100%, as a rule, means that the processor is overloaded). If in doubt, open, for example, htop and test with different values, but run it only for a few seconds, because every time it should start from the very beginning.

For a small ~ 3 GB SVN repository on a USB drive, this took about 5 minutes.

set +x includes verbose execution, which I do before doing touch , so you can watch it run. If you want to perform non-verbal execution, delete this command.

0
source share

We include only whole catalogs in other projects:

  • mainprj / bin / subprj1
  • mainprj / bin / subprj2
  • mainprj / dat / subprj1
  • mainprj / dat / subprj2
  • subprj1 / bin # included in mainprj / bin / subprj1
  • subprj1 / dat # is included in mainprj / dat / subprj1
  • subprj2 / bin # included in mainprj / bin / subprj2
  • subprj2 / dat # is included in mainprj / dat / subprj2

with this layout svn propget svn:externals -R returns

 # cd mainprj # svn propget svn:externals -R bin - subprj1 svn+ssh://svnserver/svn/subprj1/trunk/bin subprj2 svn+ssh://svnserver/svn/subprj2/trunk/bin dat - subprj1 svn+ssh://svnserver/svn/subprj1/trunk/dat subprj2 svn+ssh://svnserver/svn/subprj2/trunk/dat 

and you can update to a fixed date as follows:

 svn propget svn:externals -R |\ grep -vE '^$' | sed -e "s/^[^-]* - //" |\ while read line; do \ pushd ${line##*/}; \ svn update -r {2019-04-26} ${line%% *}; \ popd; \ done 
0
source share

As far as I managed to work out, you cannot do this without changing the configuration of externals. But changing the externals configuration changes it for everyone, so this is just one commit and update, and you're done.

-3
source share

All Articles