Mercurial > hg
view contrib/undumprevlog @ 19440:4a0d0616c47d
commit: enable --secret option
At the moment, creating secret commits is slightly cumbersome. They
can either be created by changing the default commit phase to secret
or by doing `hg phase --secret --force`. Both of these make secret
commits appear to be like some kind of advanced feature.
Secret commits, however, should be a convenient feature for people who
want to work on a private branch without affecting anyone else. There
should therefore be a prominent and convenient method for creating
secret commits.
Since the default phase is draft and there is no need to use --force
to go from a secret phase to any other phase, this patch
intentionally does not add --draft and --public options.
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 11 Jul 2013 13:11:41 -0400 |
parents | cba222f01056 |
children | 5bd1f6572db0 |
line wrap: on
line source
#!/usr/bin/env python # Undump a dump from dumprevlog # $ hg init # $ undumprevlog < repo.dump import sys from mercurial import revlog, node, scmutil, util, transaction for fp in (sys.stdin, sys.stdout, sys.stderr): util.setbinary(fp) opener = scmutil.opener('.', False) tr = transaction.transaction(sys.stderr.write, opener, "undump.journal") while True: l = sys.stdin.readline() if not l: break if l.startswith("file:"): f = l[6:-1] r = revlog.revlog(opener, f) print f elif l.startswith("node:"): n = node.bin(l[6:-1]) elif l.startswith("linkrev:"): lr = int(l[9:-1]) elif l.startswith("parents:"): p = l[9:-1].split() p1 = node.bin(p[0]) p2 = node.bin(p[1]) elif l.startswith("length:"): length = int(l[8:-1]) sys.stdin.readline() # start marker d = sys.stdin.read(length) sys.stdin.readline() # end marker r.addrevision(d, tr, lr, p1, p2) tr.close()