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

[PATCH] Allow to made multible backup from same version

From: Jani Averbach <jaa_at_cc.jyu.fi>
Date: 2002-12-13 23:54:14 CET

Hi!

log:

If you want like use the hot-backup.py like generic hot-backup utility,
(and not only by post-commit hook), it might be feasible that you would
made multible backup of same revision.

This pacth take care of this case.

* tools/backup/hot-backup.py: modified

BR, Jani

Index: tools/backup/hot-backup.py
===================================================================
--- tools/backup/hot-backup.py (revision 4111)
+++ tools/backup/hot-backup.py (working copy)
@@ -77,6 +77,15 @@
 # Step 2: copy the whole repository structure.

 backup_subdir = os.path.join(backup_dir, repo + "-" + youngest)
+
+# if there is backup already, add additional
+# increment at the end of path
+try_count = 1
+while os.path.exists(backup_subdir):
+ backup_subdir = os.path.join(backup_dir, repo + "-" + youngest + "-" + `try_count`)
+ try_count += 1
+
+
 print "Backing up repository to '" + backup_subdir + "'..."
 shutil.copytree(repo_dir, backup_subdir)
 print "Done."
@@ -159,9 +168,19 @@

 # Step 8: finally, remove the repository back that's NUM_BACKUPS older
 # than the one we just created.
+# If there are multible versions of this rep. backup, remove them also

 kill_rev = int(youngest) - num_backups
 old_backup_subdir = os.path.join(backup_dir, repo + "-" + `kill_rev`)
 if os.path.exists(old_backup_subdir):
   print "Removing old backup: " + old_backup_subdir
   shutil.rmtree(old_backup_subdir)
+ try_count = 1
+ old_backup_subdir = os.path.join(backup_dir, repo + "-" + `kill_rev` + "-" + `try_count`)
+ while os.path.exists(old_backup_subdir):
+ print "Removing old backup: " + old_backup_subdir
+ shutil.rmtree(old_backup_subdir)
+ try_count += 1
+ old_backup_subdir = os.path.join(backup_dir, repo + "-" + `kill_rev` + "-" + `try_count`)
+
+

--
Jani Averbach
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Dec 13 23:54:57 2002

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.