[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: Karl Fogel <kfogel_at_red-bean.com>
Date: 2007-10-22 20:34:28 CEST

"Arfrever Frehtes Taifersar Arahesis" <arfrever.fta@gmail.com> writes:
>> I may have missed some discussion, but why an environment variable
>> instead of an option? Usually an option is the way to get this kind
>> of functionality, I would think...
>
> Patches welcome :)
> Use of environment variable is easier to implement - just one line.
> In case of my small custom repository, setting a variable in
> ~/.bash_profile is sufficient.
> I think that an option can be implemented later.

Well, this is not so hard, really. Can you test this and commit as
part of your change?

[[[
Add --num-backups option.

* tools/backup/hot-backup.py.in
  (num_backups): Document that initialization is just a default.
  (usage): Document new option.
  (option parsing section): Parse it.
]]]

Index: tools/backup/hot-backup.py.in
===================================================================
--- tools/backup/hot-backup.py.in (revision 27301)
+++ tools/backup/hot-backup.py.in (working copy)
@@ -52,7 +52,7 @@
 # Path to svnadmin utility
 svnadmin = r"@SVN_BINDIR@/svnadmin"
 
-# Number of backups to keep around (0 for "keep them all")
+# Default number of backups to keep around (0 for "keep them all")
 num_backups = 64
 
 # Archive types/extensions
@@ -111,13 +111,16 @@
                        bz2 : Creates a bzip2 compressed tar file.
                        gz : Creates a gzip compressed tar file.
                        zip : Creates a compressed zip file.
+ --num-backups=N Number of prior backups to keep around ("0" for none).
   --help -h Print this help message and exit.
 
 """ % (scriptname,))
 
 
 try:
- opts, args = getopt.gnu_getopt(sys.argv[1:], "h?", ["archive-type=", "help"])
+ opts, args = getopt.gnu_getopt(sys.argv[1:], "h?", ["archive-type=",
+ "num-backups",
+ "help"])
 except getopt.GetoptError, e:
   print >> sys.stderr, "ERROR: %s\n" % e
   usage(sys.stderr)
@@ -128,6 +131,8 @@
 for o, a in opts:
   if o == "--archive-type":
     archive_type = a
+ elif o == "--num-backups":
+ num_backups = int(a)
   elif o in ("-h", "--help", "-?"):
     usage()
     sys.exit()

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 22 20:34:41 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.