LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-02-2010, 08:18 PM   #1
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Python: can you do an "svnadmin dump" with pysvn?


Still searching through the docs, but having not yet seen it, I figured I'd ask if anyone's done it.

Has anyone done a repository dump (for the purpose of backup) with pysvn? If so, care to share how it's done?
 
Old 06-02-2010, 10:10 PM   #2
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
Looks like the "svn" module (as opposed to the "pysvn" module) does what I need.

In debian, the package is called "python-subversion" (as opposed to "python-svn" which is pysvn).
 
Old 06-03-2010, 10:17 PM   #3
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Original Poster
Rep: Reputation: 51
So, it's a bit of a pain & took a good bit of research to get it right, so for the googlers, here's an example of an svnadmin dump using python:

Code:
from svn import fs, repos, core
my_repo = repos.open(core.svn_path_canonicalize('/path/to/repo')) 
repo_fs = repos.fs(my_repo)
dump_file = open("/path/to/dumpfile.svn",'w')
feedback_file = open("/tmp/feedback",'w')
first_rev = 1
last_dev = fs.youngest_rev(repo_fs)
repos.dump_fs2(my_repo,dump_file,feedback_file,first_rev,last_rev,False,False,None,None)
dump_file.close()
feedback_file.close()
The confusing bit was the dump_fs2 call. The params are as follows:

Code:
svn_repos_dump_fs2(
 svn_repos_t repos,                       # the opened repository
 svn_stream_t dumpstream,                 # writable file pointer for the dump file
 svn_stream_t feedback_stream,            # writable file pointer for progress report (my file was empty, fwiw)
 svn_revnum_t start_rev,                  # first revision number to dump - typically 1 for the whole thing
 svn_revnum_t end_rev,                    # last revision number to dump - "youngest" revision
 svn_boolean_t incremental,               # TRUE: the first revision dumped will be a diff against the previous revision (usually it looks like a full dump of the tree).
 svn_boolean_t use_deltas,                # TRUE: output only node properties which have changed relative to the previous contents, and output text contents as svndiff data against the previous contents.  Regardless of how this flag is set, the first revision of a non-incremental dump will be done with full plain text.  A dump with @a use_deltas set cannot be loaded by Subversion 1.0.x.
 svn_cancel_func_t cancel_func,           # a callback function if the user cancels, mid operation
 apr_pool_t pool                          # ??  hrm... can't seem to remember now & don't feel like researching for it.  Use "None" ;)
)
Thanks to Troy Curtis Jr for the info on incremental & use_deltas. http://svn.haxx.se/dev/archive-2006-09/0985.shtml

FWIW, I can't say that this is perfectly, technically correct, but it does make a dump file that svnadmin can load & then svn can check out and back into.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me understand "svnadmin dump" Aquarius_Girl General 1 05-21-2010 11:50 PM
installing FreeBSD on Virtual Box error: "Cannot dump. No dump device defined" Valkyrie_of_valhalla *BSD 4 09-06-2007 04:02 AM
[python] print "\033[5;",x,"H=>" datbenik Programming 1 01-05-2006 05:12 AM
User "list" running process "python" TroelsSmit Linux - Newbie 2 02-22-2005 04:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration