[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] [hot-backup.py] Allow to set the numer of backups in environment

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2007-10-12 15:32:21 CEST

Arfrever Frehtes Taifersar Arahesis wrote:
> I think that hot-backup.py could check an environmental variable and if it's
> available, then the value retrieved from this variable could be used instead
> of hard coded value.
>
> [[[
> Allow to set in environment the numer of backups kept around by hot-backup.py.
>
> * tools/backup/hot-backup.py.in: Set num_backups to value obtained from
> SVN_HOTBACKUP_BACKUPS_NUMBER environmental variable.
>
> Patch by: arfrever
> ]]]
>
>
>
> ------------------------------------------------------------------------
>
> Index: tools/backup/hot-backup.py.in
> ===================================================================
> --- tools/backup/hot-backup.py.in (revision 27145)
> +++ tools/backup/hot-backup.py.in (working copy)
> @@ -53,7 +53,10 @@
> svnadmin = r"@SVN_BINDIR@/svnadmin"
>
> # Number of backups to keep around (0 for "keep them all")
> -num_backups = 64
> +if os.environ.has_key("SVN_HOTBACKUP_BACKUPS_NUMBER"):
> + num_backups = int(os.environ["SVN_HOTBACKUP_BACKUPS_NUMBER"])
> +else:
> + num_backups = 64
>
> # Archive types/extensions
> archive_map = {

The more-typical way of doing this is:

   num_backups = int(os.environ.get("SVN_HOTBACKUP_BACKUPS_NUMBER", 64))

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Fri Oct 12 15:32:35 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.