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

[PATCH] normalize path of repository in hot-backup.py

From: Jani Averbach <jaa_at_cc.jyu.fi>
Date: 2003-02-07 13:06:51 CET

Hello!

Basename will return '' if you call it with '/foo/bar/', as opposed to
the UNIX basename (result will be '/foo/bar') [1]. So the 'repo_dir' in
hot-backup.py have to be normalized and absolutized before call of
basename. With this patch hot-backup.py will work correctly in this case:
"./hot-backup.py /repo_path/repo/ /backup_dir".

BR, Jani

1) http://www.python.org/doc/current/lib/module-os.path.html

Log:

The repo_dir have to be normalized and absolutized before call of
basename. Otherwise "./hot-backup.py /repo_path/repo/ /backup_dir" won't
work.

* tools/backup/hot-backup.py.in:
  Added os.path.abspath() call before os.path.basename

Index: tools/backup/hot-backup.py.in
===================================================================
--- tools/backup/hot-backup.py.in (revision 4776)
+++ tools/backup/hot-backup.py.in (working copy)
@@ -49,7 +49,7 @@

 # Path to repository
 repo_dir = sys.argv[1]
-repo = os.path.basename(repo_dir)
+repo = os.path.basename(os.path.abspath(repo_dir))

 # Where to store the repository backup. The backup will be placed in
 # a *subdirectory* of this location, named after the youngest

--
Jani Averbach
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Feb 7 13:08:17 2003

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