Article #1498: How To Mirror the FLTK Subversion Repository

  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Articles | Show Comments | Submit Comment ]

Article #1498: How To Mirror the FLTK Subversion Repository

Created at 11:13 Nov 17, 2016 by AlbrechtS

Last modified at 11:25 Nov 17, 2016

This article is intended for FLTK users and developers that want to mirror the entire FLTK Subversion repository on their local machine or a local network server for internal access.

There are several reasons why this can be useful:

  • Frequent/continuous backup of the FLTK subversion repository
      
  • Quick local access to subversion logs
      
  • Quick local access to changes (svn diff, svn blame)
      
  • Local network deployment to clients that don't have internet access
      
  • Quick generation of FLTK commit activities (see STR #2806)

Note: This is NOT usable for local commits. Local commits may (will!) break the mirror because FLTK revision numbers must be consecutive.

The tool used to synchronize the original FLTK repository and the local mirror is svnsync. This howto is only a short recipe for the FLTK Subversion repository, but you can use it for other Subversion repositories as well. For more information see the svn book, chapter 5 "Repository Administration":

http://svnbook.red-bean.com/
http://svnbook.red-bean.com/nightly/en/svn.reposadmin.maint.html#svn.reposadmin.maint.replication

Example for FLTK Subversion Mirror

Note: for this example I installed my svn mirrors in /fltk/svn, i.e. the FLTK repo is in /fltk/svn/fltk. The command prompt shown in this example indicates the working directory. You may need to change the path everywhere as appropriate.

Create an Empty FLTK Mirror Repository

[/fltk/svn] $ svnadmin create fltk
[/fltk/svn] $ cp fltk/hooks/pre-revprop-change.tmpl fltk/hooks/pre-revprop-change

Edit fltk/hooks/pre-revprop-change. See the lines below between "# local svnsync copy" and "# never reached ...".

[/fltk/svn] $ cat fltk/hooks/pre-revprop-change

#!/bin/sh

# PRE-REVPROP-CHANGE HOOK
#
# The pre-revprop-change hook is invoked before a revision property
# is added, modified or deleted.  Subversion runs this hook by invoking

# [Note: more comments elided] ...

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
ACTION="$5"

# local svnsync copy: allow revprop changes always
exit 0;

# never reached ...

if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi

echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1

Set the FLTK Repository UUID in the Mirror

Strictly speaking, this is not necessary, but in case this repository would need to be used as a backup to replace the original repository this is useful.

[/fltk/svn] $ svn info http://seriss.com/public/fltk/fltk | grep UUID
Repository UUID: ea41ed52-d2ee-0310-a9c1-e6b18d33e121

[/fltk/svn] $ svnadmin setuuid fltk ea41ed52-d2ee-0310-a9c1-e6b18d33e121
[/fltk/svn] $ svnlook uuid fltk/
ea41ed52-d2ee-0310-a9c1-e6b18d33e121

The first command shows the remote UUID, the second command sets it in the local mirror, the third command verifies that it was set correctly.

Initialize the FLTK Mirror

[/fltk/svn] $ svnsync initialize file:///fltk/svn/fltk http://seriss.com/public/fltk/fltk
Copied properties for revision 0.

Notice the "file:" URL for the local repository.

Synchronize the FLTK Mirror

[/fltk/svn] $ svnsync synchronize file:///fltk/svn/fltk/
Committed revision 1.
Copied properties for revision 1.
Transmitting file data ................................................   ...
Committed revision 2.
Copied properties for revision 2.

[...]

Transmitting file data ..
Committed revision 12113.
Copied properties for revision 12113.
Transmitting file data ........
Committed revision 12114.
Copied properties for revision 12114.
Transmitting file data ..
Committed revision 12115.
Copied properties for revision 12115.

Note: This step took about 90 minutes, although the local network load was minimal. Don't worry if this process is interrupted. You may restart it with the same command later.

Keeping the FLTK Mirror Up-to-date

Just run the svnsync command again, maybe in a cron job. This will pull only the changes since the last synchronization.

[/fltk/svn] $ svnsync synchronize file:///fltk/svn/fltk/
Transmitting file data .
Committed revision 12116.
Copied properties for revision 12116.

Accessing the FLTK Mirror

Use any suitable URL to checkout the branch you need, for instance:

$ cd /path/to/working
$ svn checkout file:///fltk/svn/fltk/branches/branch-1.4 fltk-1.4

Access to all logs in branch-1.4 is rapid:

$ cd fltk-1.4
$ time svn log > /dev/null

real    0m2.058s
user    0m1.015s
sys     0m0.193s

That's all about it. I hope this article is helpful. [ Listing ]


Comments

Submit Comment ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2015 by Bill Spitzak and others. This project is hosted by Seriss Corporation. Please report site problems to 'erco@seriss.com'.