2007-10-12 15:31:58 C. Michael Pilato napisał(a):
> 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))
Thanks for suggestion!
[[[
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
cmpilato
]]]
--
Arfrever Frehtes Taifersar Arahesis
Received on Fri Oct 12 15:48:38 2007