view rewrite-log @ 2549:e1831f06eef1

Added ability to clone from a local repository to a (new) remote one. Rearranged the clone command a good bit to make sure it validates that the source does exist and that the destination doesn't before doing anything. Before I moved the source repo check it would create the destination repository before it verified the source existed. Moved the responsibility for creating the destination repo root directory entirly into the localrepo class so that local to local cloning doesn't break. This also simplifies the code a bit since it's no longer being done in both clone and init. Changed the names of the 'repo' and 'other' variables to 'dest_repo' and 'src_repo' to maintain my sanity. Passes 82/83 tests. The only failure is the version number test, which I suspect is supposed to fail since it comes from a generated file.
author Sean Meiners <sean.meiners@linspire.com>
date Fri, 30 Jun 2006 19:24:02 -0700
parents 5f471a75d607
children
line wrap: on
line source

#!/usr/bin/env python
import sys, os
from mercurial import hg

f = sys.argv[1]

r1 = hg.revlog(open, f + ".i", f + ".d")
r2 = hg.revlog(open, f + ".i2", f + ".d2")

tr = hg.transaction(open, "journal")

for i in xrange(r1.count()):
    n = r1.node(i)
    p1, p2 = r1.parents(n)
    l = r1.linkrev(n)
    t = r1.revision(n)
    n2 = r2.addrevision(t, tr, l, p1, p2)
tr.close()

os.rename(f + ".i", f + ".i.old")
os.rename(f + ".d", f + ".d.old")
os.rename(f + ".i2", f + ".i")
os.rename(f + ".d2", f + ".d")