FYI, this is a proposed solution...

---------- Forwarded message ----------
From: Matt Mackall <[EMAIL PROTECTED]>
Date: Thu, Mar 27, 2008 at 12:09 PM
Subject: Re: mercurial --> plain text --> mercurial
To: didier deshommes <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]



 On Thu, 2008-03-27 at 14:24 +0000, didier deshommes wrote:
 > Hi everyone,
 > Sage (http://www.sagemath.org/) uses hg for its source control and recently a
 > question has come up about the possibility of doing the following:
 >
 >  (1) export everything in the .hg repo to something (perhaps a ton of
 > stuff) in plain text format,
 >  (2) delete .hg/ directory
 >  (3) do something that recovers the .hg/ directory from the output of (1).

 This will work for the export side:

 #!/usr/bin/env python
 import sys
 from mercurial import revlog, node

 for f in sys.argv[1:]:
    r = revlog.revlog(open, f)
    print "file:", f
    for i in xrange(r.count()):
        n = r.node(i)
        p = r.parents(i)
        d = r.revision(n)
        print "node:", node.hex(n)
        print "linkrev:", r.linkrev(n)
        print "parents:", node.hex(p[0]), node.hex(p[1])
        print "length:", len(d)
        print "-start-"
        print d
        print "-end-"

 Then you can do something like:

 find .hg/store -name "*.i" | xargs ./dumprevlog > repo.dump

 This will make a nice flat, uncompressed file with everything you need
 to reconstruct a repo. But it'll be huge. The mercurial repo goes from
 11MB to 435MB. Other projects will get -much- bigger; I've seen large
 revlogs with compression ratios of > 1000:1.

 I'm too busy to write the import side of this today, but it'll be about
 as long. And you shouldn't actually need that piece if you only need to
 scan the dump.

 --
 Mathematics is the supreme nostalgia of our time.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to