Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4591316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:22:37+00:00 2026-05-21T22:22:37+00:00

I have a Subversion repository, and I would like to extract detailed information about

  • 0

I have a Subversion repository, and I would like to extract detailed information about the history of who edited what and when and how. I know I can run svn log --xml to produce a nice easy-to-use record of which paths were altered in each revision. But what I would also like to find out is the size of the edits to each file.

I know there are many ways to define “edit distance”, but I will be happy with anything simple like “number of lines that are different” for text files.

Presumably I can get all this by parsing the output of svnadmin dump, but then I’d need to spend time learning about the dump file format, which I’d rather avoid if I can.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T22:22:38+00:00Added an answer on May 21, 2026 at 10:22 pm

    The svn dump format, it turns out, is very easy to parse. If I generate it with svnadmin dump --deltas then the dump file contains deltas for each file modification, and I can reasonably take the size of the delta (in bytes) to be the edit distance.

    In case anyone comes looking here, here is a simple Python script which takes an svn dump file and prints out an XML file containing all the properties. The edit sizes are contained in //path/Text-content-length entries.

    def read_defs(f):
        res = {}
        while True:
            l = f.readline()
            if l in ['','\n']: break
            s = l.split(': ',1)
            if len(s)!=2: assert False, 'Bad definition line '+l
            res[s[0]] = (s[1][:-1] if s[1].endswith('\n') else s[1])
        if len(res)==0 and l=='': return None
        return res
    
    def read_props(f):
        res = {}
        lastkey = None
        while True:
            l = f.readline()
            if l.startswith('PROPS-END'): break
            ln = int(l.split()[1])
            l2 = f.read(ln); f.readline()
            if l.startswith('K'):
                lastkey = l2; res[l2] = None
            elif l.startswith('V'):
                res[lastkey] = l2
            else:
                assert False, 'Unexpected prop entry '+l
        return res
    
    def parsedump(f):
            print '<?xml version="1.0"?>'
            print '<log>'
            inrevision,inpaths = False,False
            while True:
                d = read_defs(f)
                if d is None: break
                p = read_props(f) if 'Prop-content-length' in d else {}
                if 'Revision-number' in d:
                    if inpaths: print '</paths>'; inpaths=False
                    if inrevision: print '</logentry>'
                    print '<logentry revision="'+d['Revision-number']+'">'
                    inrevision = True
                    for k,v in p.iteritems(): print '<'+k+'>'+v+'</'+k+'>'
                elif 'Node-path' in d:
                    if not inpaths: print '<paths>'; inpaths=True
                    print '<path>'
                    for k,v in d.iteritems(): print '<'+k+'>'+v+'</'+k+'>'
                    for k,v in p.iteritems(): print '<'+k+'>'+v+'</'+k+'>'
                    print '</path>'
                cl = (int(d['Content-length']) if 'Content-length' in d else 0)
                pcl = (int(d['Prop-content-length']) if 'Prop-content-length' in d else 0)
                f.seek(cl-pcl,1)
            if inpaths: print '</paths>'
            if inrevision: print '</logentry>'
            print '</log>'
    
    import sys
    if __name__=='__main__':
        if len(sys.argv)==0:
            print 'Usage: svndump2xml FILENAME\nConverts FILENAME to xml, and prints to standard output'
            sys.exit(0)
        filename = sys.argv[1]
        with open(filename,'rb') as f:
            parsedump(f)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to convert my Subversion repository to Mercurial. I have a pretty
I have a subversion repository, and I would like to create a branch, but
CentOS 5.3 subversion 1.4.2 Our company would like to know who has checked out
I have a subversion repository, where each branch is a separate project. I would
At my workplace we have one large Subversion repository which holds about 100 projects.
I have a file in my Subversion repository named Foo.cs. When I run the
We have a non-standard subversion respository that we would like to convert to Git.
i have to use a subversion repository and i'd like to use git-svn. I
I may have found a Subversion bug, and I would like to make sure
I have a subversion repository with the standard layout, i.e. trunk/ and branches/ (and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.